Skip to content

Commit

Permalink
Merge pull request #60 from mohamed-barakat/devel
Browse files Browse the repository at this point in the history
applied PackageJanitor
  • Loading branch information
mohamed-barakat authored Jan 1, 2023
2 parents 8f6f2ce + 12963d7 commit 962c035
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
- cron: "0 4 * * *" # after gap-docker(-master) is rebuilt
workflow_dispatch:

# cancel runs for pull requests on force push
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}-${{ github.run_attempt }}
cancel-in-progress: true

jobs:
test:
strategy:
Expand All @@ -23,6 +29,10 @@ jobs:
# 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@v3
with:
# the persisted token interferes with the subsplit token used below
persist-credentials: false
fetch-depth: 0
- run: cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/
- run: |
export HOME="/home/gap"
Expand Down Expand Up @@ -52,12 +62,11 @@ jobs:
[ -d "homalg_project/Modules" ] && make -C "homalg_project/Modules" doc
[ -d "Toposes" ] && make -C "Toposes" doc
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
cd CatReps
LANG=C.UTF-8 python3 process_coverage.py
[ "$GITHUB_EVENT_NAME" != "schedule" ] && [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker-master:latest" ] && ./upload_codecov.sh
git config --global user.name "Bot"
git config --global user.email "empty"
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; \
Expand Down
2 changes: 1 addition & 1 deletion PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "CatReps",
Subtitle := "Representations and cohomology of finite categories",
Version := "2022.12-02",
Version := "2022.01-01",

Date := ~.Version{[ 1 .. 10 ]},
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
Expand Down
14 changes: 7 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ test: doc
gap tst/testall.g

test-basic-spacing:
grep -RPl "\t" examples/ gap/ && echo "Tabs found" && exit 1 || exit 0
grep -RPl "\r" examples/ gap/ && echo "Windows line-endings found" && exit 1 || exit 0
# the second grep is a hack to fix the exit code with -L for grep <= 3.1
grep -RPzL "\n\z" examples/ gap/ | grep "" && echo "File with no newline at end of file found" && exit 1 || exit 0
# exit code 1 means no match, which is what we want here (exit code 2 signals an error)
grep -RPl "\t" examples/ gap/; test $$? -eq 1 || (echo "Tabs found" && exit 1)
grep -RPl "\r" examples/ gap/; test $$? -eq 1 || (echo "Windows line-endings found" && exit 1)
grep -RPzL "\n\z" examples/ gap/ | grep ""; test $$? -eq 1 || (echo "File with no newline at end of file found" && exit 1)

test-doc: doc
cp -aT doc/ doc_tmp/
Expand All @@ -44,12 +44,12 @@ test-notebooks:
done

test-spacing:
grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0
# exit code 1 means no match, which is what we want here (exit code 2 signals an error)
grep -R "[^ [\"] " gap/*.gi; test $$? -eq 1 || (echo "Duplicate spaces found" && exit 1)
grep -RE '[^ ] +$$' gap/*; test $$? -eq 1 || (echo "Trailing whitespace found" && exit 1)
for filename in gap/*; do \
echo $$filename; \
gap --quitonbreak --norepl --banner -c "LoadPackage(\"CatReps\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));"; \
echo -e "\033[0m"; \
# 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; \
Expand Down
2 changes: 1 addition & 1 deletion process_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
data = json.load(json_file)
files = data["coverage"]
for filename, lines_covered in files.items():
if filename.startswith(os.getcwd() + "/"):
if filename.startswith(os.getcwd() + "/") and not filename.endswith("manual.six"):
print(" processing code file " + filename)
# ignored lines will be delete from lines_covered in-place
new_data["coverage"][filename.replace(os.getcwd() + "/", "", 1)] = lines_covered
Expand Down
8 changes: 8 additions & 0 deletions tst/100_LoadPackage.tst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@
gap> PushOptions( rec( OnlyNeeded := true ) );
gap> package_loading_info_level := InfoLevel( InfoPackageLoading );;
gap> SetInfoLevel( InfoPackageLoading, PACKAGE_ERROR );;
gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> LoadPackage( "Toposes", false );
true
gap> LoadPackage( "CatReps", false );
true
gap> SetInfoLevel( InfoPackageLoading, PACKAGE_INFO );;
gap> LoadPackage( "FreydCategoriesForCAP" );
true
gap> LoadPackage( "Toposes" );
true
gap> LoadPackage( "CatReps" );
true
gap> SetInfoLevel( InfoPackageLoading, package_loading_info_level );;
2 changes: 1 addition & 1 deletion upload_codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ shasum -a 256 -c codecov.SHA256SUM

# execute
chmod +x codecov
./codecov -Z || (sleep 30; ./codecov -Z || (sleep 30; ./codecov -Z))
./codecov -Z -v -s ../ || (sleep 30; ./codecov -Z -v -s ../ || (sleep 30; ./codecov -Z -v -s ../))

0 comments on commit 962c035

Please sign in to comment.