diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 0154783..8ce6627 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -8,6 +8,7 @@ on: pull_request: schedule: - cron: "0 0 * * *" + workflow_dispatch: jobs: test: @@ -31,6 +32,7 @@ jobs: sudo apt update sudo apt dist-upgrade -y sudo apt install -y texlive-latex-extra texlive-fonts-extra + cp ./CatReps/ci_gaprc /home/gap/.gap/gaprc git clone --depth 1 https://github.com/gap-packages/AutoDoc.git git clone --depth 1 https://github.com/homalg-project/homalg_project.git git clone --depth 1 https://github.com/homalg-project/CAP_project.git diff --git a/ci_gaprc b/ci_gaprc new file mode 100644 index 0000000..88fd324 --- /dev/null +++ b/ci_gaprc @@ -0,0 +1,12 @@ +# Prefer GAPInfo.UserGapRoot over other package directories to prevent accidentally testing package +# versions distributed with GAP. +(function() + local name, package_info, pos; + for name in RecNames( GAPInfo.PackagesInfo ) do + package_info := GAPInfo.PackagesInfo.(name); + pos := PositionProperty( package_info, info -> StartsWith( info.InstallationPath, GAPInfo.UserGapRoot ) ); + if pos <> fail then + SetPackagePath( name, package_info[pos].InstallationPath ); + fi; + od; +end)(); diff --git a/makefile b/makefile index 74df88b..7202fdb 100644 --- a/makefile +++ b/makefile @@ -32,14 +32,18 @@ test-with-coverage: doc echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak test-spacing: - grep -R "[^ [] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0 + grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0 grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0 for filename in gap/*; do \ echo $$filename; \ - echo "LoadPackage(\"CatReps\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", PrintString(func));" | gap --quitonbreak --banner; \ + echo "LoadPackage(\"CatReps\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));" | gap --quitonbreak --banner; \ echo -e "\033[0m"; \ - cat "gap_spacing" | sed 's/^function ( ) //g' | sed 's/ return; end$$//g' | sed 's/;/;\n/g' > modified_gap_spacing; \ - cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" | head -c -1 > modified_custom_spacing; \ + # In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \ + # so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \ + cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \ + cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \ + # Our code might still differ from the GAP code, for example because of additional brackets. \ + # Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \ diff modified_gap_spacing modified_custom_spacing > spacing_diff; \ diff modified_gap_spacing modified_custom_spacing --ignore-all-space --ignore-space-change --ignore-trailing-space --ignore-blank-lines > spacing_diff_no_blanks; \ diff spacing_diff_no_blanks spacing_diff || exit; \ diff --git a/release-gap-package b/release-gap-package index 3aa1cdd..f85ba72 100755 --- a/release-gap-package +++ b/release-gap-package @@ -43,12 +43,13 @@ Actions -p, --push perform the final push, completing the release [Default] -P, --no-push do not perform the final push -f, --force if a release with the same name already exists: overwrite it + --skip-existing-release if a release with the same name already exists: exit without error Paths --srcdir path of directory containing PackageInfo.g [Default: current directory] --tmpdir path of temporary directory [Default: tmp subdirectory of srcdir] --webdir path of web directory [Default: gh-pages subdirectory of srcdir] - --update-file path of the update.g file [Default: update.g in webdir] + --update-script path of the update script [Default: update.g in webdir] Custom settings --token GitHub access token @@ -145,12 +146,12 @@ while [ x"$1" != x ]; do --srcdir ) SRC_DIR="$1"; shift ;; --webdir ) WEB_DIR="$1"; shift ;; --tmpdir ) TMP_DIR="$1"; shift ;; - --update-file ) UPDATE_FILE="$1"; shift ;; + --update-script ) UPDATE_SCRIPT="$1"; shift ;; --srcdir=*) SRC_DIR=${option#--srcdir=}; shift ;; --webdir=*) WEB_DIR=${option#--webdir=}; shift ;; --tmpdir=*) TMP_DIR=${option#--tmpdir=}; shift ;; - --update-file=*) UPDATE_FILE=${option#--update-file=}; shift ;; + --update-script=*) UPDATE_SCRIPT=${option#--update-script=}; shift ;; --token ) TOKEN="$1"; shift ;; @@ -189,12 +190,12 @@ if [ ! -d "$WEB_DIR" ] ; then error "could not find 'webdir' with clone of your gh-pages branch" fi -# Check for presence of update.g file -if [ "x$UPDATE_FILE" = x ] ; then - UPDATE_FILE="$WEB_DIR/update.g" +# Check for presence of the update script +if [ "x$UPDATE_SCRIPT" = x ] ; then + UPDATE_SCRIPT="$WEB_DIR/update.g" fi -if [ ! -f "$UPDATE_FILE" ] ; then - error "could not find update.g file" +if [ ! -f "$UPDATE_SCRIPT" ] ; then + error "could not find update script \"${UPDATE_SCRIPT}\"" fi # Check whether GAP is usable @@ -416,8 +417,8 @@ sed "s;Date := .*;Date := \"$(date +%d/%m/%Y)\",;" PackageInfo.g > PackageInfo.g mv PackageInfo.g.bak PackageInfo.g notice "Removing unnecessary files" -rm -rf .github .circleci -rm -f .git* .hg* .cvs* +# Remove recursively in case there is a .github directory +rm -rf .git* .hg* .cvs* .circleci rm -f .appveyor.yml .codecov.yml .travis.yml # execute .release script, if present @@ -447,7 +448,7 @@ fi; PushOptions(rec(relativePath:="../../..")); Read("makedoc.g"); GAPInput - rm -f doc/*.lab doc/*.tex + rm -f doc/*.tex rm -f doc/*.aux doc/*.bbl doc/*.blg doc/*.brf doc/*.idx doc/*.ilg doc/*.ind doc/*.log doc/*.out doc/*.pnr doc/*.tst elif [ -f doc/make_doc ] ; then notice "Copying GAP package documentation for archives (using doc/make_doc)" @@ -565,7 +566,7 @@ fi DATA=$(cat <