From 0cdca9e9b67ab74d1d9e65304925558e811a75a4 Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Thu, 3 Nov 2022 15:47:23 +0100 Subject: [PATCH] applied PackageJanitor --- .github/workflows/Tests.yml | 9 ++++----- PackageInfo.g | 2 +- ci_gaprc | 30 +++++++++++++++++++++++++++--- upload_codecov.sh | 2 +- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 27d3160..ba1dae9 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -22,10 +22,8 @@ jobs: steps: # keep workflow active even if repository has no activity for 60 days (do not execute for pull requests) - run: '[ "$GITHUB_EVENT_NAME" = "pull_request" ] || curl --fail -X PUT -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/Tests.yml/enable' - - uses: actions/checkout@v1 - - run: mkdir -p /home/gap/.gap/pkg/ - - run: sudo cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/ - - run: sudo chown -R gap:gap /home/gap/.gap/pkg/ + - uses: actions/checkout@v3 + - run: cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/ - run: | export HOME="/home/gap" cd /home/gap/.gap/pkg/ @@ -53,7 +51,7 @@ jobs: [ -d "homalg_project/homalg" ] && make -C "homalg_project/homalg" doc [ -d "homalg_project/Modules" ] && make -C "homalg_project/Modules" doc [ -d "Toposes" ] && make -C "Toposes" doc - TERM=dumb make -C CatReps -j $(nproc) --output-sync ci-test + make -C CatReps -j $(nproc) --output-sync ci-test cp ./CatReps/.codecov.yml ./ (cd CatReps && LANG=C.UTF-8 python3 process_coverage.py) [ "$GITHUB_EVENT_NAME" != "schedule" ] && [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker-master:latest" ] && ./CatReps/upload_codecov.sh @@ -62,6 +60,7 @@ jobs: cd CatReps CUR_SHA=$(git rev-parse --verify HEAD) if [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker:latest" ] && [ "$CUR_SHA" = "$(git rev-parse origin/master)" ] && [ $(dirname "$GITHUB_REPOSITORY") = "homalg-project" ]; then \ + git fetch origin gh-pages; \ git worktree add gh-pages/ gh-pages || (echo "There was an error. Make sure there is a branch named 'gh-pages'. See https://github.com/homalg-project/PackageJanitor#error-there-was-an-error-make-sure-there-is-a-branch-named-gh-pages"; exit 1); \ git checkout master; \ LANG=C.UTF-8 ./make_dist.sh --token "${{ secrets.GITHUB_TOKEN }}"; \ diff --git a/PackageInfo.g b/PackageInfo.g index 7650d49..7b010a2 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -97,7 +97,7 @@ PackageDoc := rec( ), Dependencies := rec( - GAP := ">= 4.11.1", + GAP := ">= 4.12.1", NeededOtherPackages := [ [ "GAPDoc", ">= 1.5" ], [ "CAP", ">= 2022.09-17" ], diff --git a/ci_gaprc b/ci_gaprc index 88fd324..3ed9280 100644 --- a/ci_gaprc +++ b/ci_gaprc @@ -1,12 +1,36 @@ # Prefer GAPInfo.UserGapRoot over other package directories to prevent accidentally testing package # versions distributed with GAP. -(function() + +FORCE_LOADING_FROM_USER_GAP_ROOT := 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 ); + # work around https://github.com/gap-system/gap/pull/5178 + if IsBound( GAPInfo.PackagesLoaded.(name) ) then + if StartsWith( GAPInfo.PackagesLoaded.(name)[1], GAPInfo.UserGapRoot ) then + continue; + else + Error( "package already loaded at ", GAPInfo.PackagesLoaded.(name)[1] ); + fi; + else + SetPackagePath( name, package_info[pos].InstallationPath ); + fi; fi; od; -end)(); +end; + +FORCE_LOADING_FROM_USER_GAP_ROOT( ); + +MakeReadWriteGlobal( "InitializePackagesInfoRecords" ); +FORCE_LOADING_FROM_USER_GAP_ROOT_InitializePackagesInfoRecords_orig := InitializePackagesInfoRecords; +InitializePackagesInfoRecords := function ( args... ) + local old_PackagesInfo; + old_PackagesInfo := GAPInfo.PackagesInfo; + CallFuncList( FORCE_LOADING_FROM_USER_GAP_ROOT_InitializePackagesInfoRecords_orig, args ); + if not IsIdenticalObj( old_PackagesInfo, GAPInfo.PackagesInfo ) then + FORCE_LOADING_FROM_USER_GAP_ROOT( ); + fi; +end; +MakeReadOnlyGlobal( "InitializePackagesInfoRecords" ); diff --git a/upload_codecov.sh b/upload_codecov.sh index 77b485c..41e8aad 100755 --- a/upload_codecov.sh +++ b/upload_codecov.sh @@ -23,4 +23,4 @@ shasum -a 256 -c codecov.SHA256SUM # execute chmod +x codecov -./codecov -Z || ./codecov -Z || ./codecov -Z +./codecov -Z || (sleep 30; ./codecov -Z || (sleep 30; ./codecov -Z))