fixing tests for github action

master
Martin Scheidt 2022-02-09 19:15:59 +01:00
parent 706803d391
commit 8dee36fcdd
4 changed files with 68 additions and 53 deletions

View File

@ -20,24 +20,22 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
uses: actions/checkout@v2
# - name: "Setup TeX Live"
# # ##
# # uses: DanySK/setup-texlive-action@master
# # with:
# # requirements-file: .github/texlive/packages.test.txt
# # ##
# # uses: teatimeguest/setup-texlive-action@v1
# # with:
# # package-file: .github/texlive/packages.test.txt
# # ##
# # uses: paolobrasolin/setup-texlive-action@v1
# # with:
# # packages-path: .github/texlive/packages.test.txt
- name: "Setup TeX Live"
# ##
# uses: DanySK/setup-texlive-action@master
# with:
# requirements-file: .github/texlive/packages.test.txt
# ##
uses: teatimeguest/setup-texlive-action@v1
with:
package-file: .github/texlive/packages.test.txt
# ##
# uses: paolobrasolin/setup-texlive-action@v1
# with:
# packages-path: .github/texlive/packages.test.txt
# - name: "install tikz-trackschematic"
# run: |
# chmod +x dev-install.sh
# ./dev-install.sh -b
# run: chmod +x dev-install.sh && ./dev-install.sh -b
- name: Setup upterm session
uses: lhotari/action-upterm@v1

View File

@ -25,26 +25,12 @@ jobs:
uses: actions/checkout@v2
- name: "Setup TeX Live"
# ##
# uses: DanySK/setup-texlive-action@master
# with:
# requirements-file: .github/texlive/packages.test.txt
##
uses: teatimeguest/setup-texlive-action@v1
with:
package-file: .github/texlive/packages.test.txt
# ##
# uses: paolobrasolin/setup-texlive-action@v1
# with:
# packages-path: .github/texlive/packages.test.txt
- name: "install tikz-trackschematic"
run: |
chmod +x dev-install.sh
./dev-install.sh -b
run: chmod +x dev-install.sh && ./dev-install.sh -b
- name: "test tikz-trackschematic"
run: |
cd test
chmod +x testing.sh
./testing.sh
run: cd test && chmod +x testing.sh && ./testing.sh

View File

@ -18,7 +18,7 @@ while getopts ":qb" opt; do
q ) verbose=0
;;
b ) batch_mode=1
verbose=0
# verbose=0
;;
\? ) usage
exit 1
@ -37,9 +37,10 @@ DEVDIR="tex/latex/local/tikz-trackschematic-dev"
check_texlive() {
status=0
command -v kpsewhich >/dev/null 2>&1 || status=1
command -v mktexlsr >/dev/null 2>&1 || status=1
if [ $status = 0 ]; then
if [ "$verbose" -eq 1 ]; then
echo "kpsewhich found"
if [ $verbose = 1 ]; then
echo "kpsewhich and mktexlsr found"
fi
return 0
fi
@ -54,14 +55,14 @@ check_sudo() {
rootrun=""
# If we are root, we do note require sudo
if [ "$EUID" = 0 ]; then
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "you are root"
fi
return 0
fi
if sudo -v >/dev/null 2>&1; then
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "sudo ok"
fi
rootrun="sudo"
@ -83,12 +84,20 @@ check_sudo
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
PROJECTDIR=$(pwd -P)
if [ "`echo -n`" = "-n" ]; then
n=""
c="\c"
else
n="-n"
c=""
fi
if [ "$batch_mode" -eq 0 ]; then
echo ""
echo "Do you wish to link this package from"
echo "$PROJECTDIR/src to"
echo "$TEXMFLOCAL/$DEVDIR?"
echo "(y/n)"
echo $n "(y/n) $c"
while true; do
read -p "" answer
case $answer in
@ -122,14 +131,14 @@ for SRC in src/*; do
$rootrun ln -sfn $PROJECTDIR/$SRC $TEXMFLOCAL/$DEVDIR/$DST
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "linked '$DST'"
fi
done
# update TeX Live installation
TEXlsr=`which mktexlsr`
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
$rootrun $TEXlsr
else
$rootrun $TEXlsr --quiet

View File

@ -22,6 +22,9 @@ while getopts ":q" opt; do
esac
done
## -- variables
TESTDIR="../test"
## -- commands
check_tex_distro() {
@ -29,7 +32,7 @@ check_tex_distro() {
status=0
command -v pdflatex >/dev/null 2>&1 || status=1
if [ $status = 0 ]; then
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "pdflatex found"
fi
return 0
@ -46,9 +49,9 @@ check_trackschematic() {
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
DEVDIR="tex/latex/local/tikz-trackschematic-dev"
ls $TEXMFLOCAL/$DEVDIR/tikz-trackschematic.sty >> /dev/null 2>&1 || status=1
ls $TEXMFLOCAL/$DEVDIR/tikz-trackschematic-dev.sty >> /dev/null 2>&1 || status=1
if [ $status = 0 ]; then
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "tikz-trackschematic-dev found"
fi
return 0
@ -64,7 +67,7 @@ check_imagemagick() {
status=0
command -v compare >/dev/null 2>&1 || status=1
if [ $status = 0 ]; then
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "compare found"
fi
return 0
@ -75,25 +78,44 @@ check_imagemagick() {
exit 1
}
#-------------------------------------------------------------------------------
## -- checking system
check_tex_distro
check_trackschematic
check_imagemagick
if [ "`echo -n`" = "-n" ]; then
n=""
c="\c"
else
n="-n"
c=""
fi
## -- doing the tests
mkdir -p .testing
for TEST in $1*.tex; do
if [ "$verbose" -eq 1 ]; then
echo "Testing: ${TEST%.*}"
if [ $verbose = 1 ]; then
echo "==========="
echo "Comparison of the expected appearance with the freshly created."
echo "-----------"
fi
for TEST in `ls $TESTDIR/*.tex`; do
FILE=$(basename "$TEST") # remove path
NAME=${FILE%.*} # remove extension
if [ $verbose = 1 ]; then
echo $n "'$NAME' test: $c"
fi
pdflatex -output-directory=.testing -interaction=batchmode -halt-on-error $TEST 2>&1 > /dev/null
compare -metric DSSIM -colorspace RGB .testing/${TEST%.*}.pdf ${TEST%.*}_expected.pdf .testing/${TEST%.*}_diff.png
if [ "$verbose" -eq 1 ]; then
echo "% difference"
pdflatex -output-directory=.testing -interaction=batchmode -halt-on-error $FILE 2>&1 > /dev/null
compare -metric DSSIM -colorspace RGB .testing/${NAME}.pdf ${NAME}_expected.pdf NULL:
if [ $verbose = 1 ]; then
echo "% difference." # it is actually not in percent! But it helps them humans...
fi
done
if [ "$verbose" -eq 1 ]; then
if [ $verbose = 1 ]; then
echo "-----------"
echo "tests passed!"
fi