Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 61 additions & 32 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 @@ -19,43 +25,66 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
defaults:
run:
working-directory: /home/gap/.gap/pkg/
env:
# HOME is already set in the docker container, but GitHub Actions overwrites it
HOME: /home/gap
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/
- run: |
export HOME="/home/gap"
cd /home/gap/.gap/pkg/
cp ./LessGenerators/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
# set SOURCE_DATE_EPOCH for reproducible PDFs
export SOURCE_DATE_EPOCH=0
# build documentation of packages which we might want to reference, keep this in sync with `release-gap-package`
[ -d "CAP_project/CAP" ] && make -C "CAP_project/CAP" doc
[ -d "CAP_project/CompilerForCAP" ] && make -C "CAP_project/CompilerForCAP" doc
[ -d "CAP_project/MonoidalCategories" ] && make -C "CAP_project/MonoidalCategories" doc
[ -d "CAP_project/CartesianCategories" ] && make -C "CAP_project/CartesianCategories" doc
[ -d "CAP_project/FreydCategoriesForCAP" ] && make -C "CAP_project/FreydCategoriesForCAP" doc
[ -d "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" ] && make -C "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" doc
[ -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 LessGenerators -j $(nproc) --output-sync ci-test
cp ./LessGenerators/.codecov.yml ./
(cd LessGenerators && LANG=C.UTF-8 python3 process_coverage_ignored_lines.py)
[ "$GITHUB_EVENT_NAME" != "schedule" ] && [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker-master:latest" ] && ./LessGenerators/upload_codecov.sh
- name: Keep workflow active even if repository has no activity for 60 days
if: github.event_name != 'pull_request'
run: |
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"
- name: Check out repo
uses: actions/checkout@v3
with:
# the persisted token interferes with the subsplit token used below
persist-credentials: false
fetch-depth: 0
- name: Move checked out repo to GAP user root dir
run: |
cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/
- name: Prepare environment
run: |
cp ./LessGenerators/dev/ci_gaprc /home/gap/.gap/gaprc
git clone --depth 1 -vv https://github.com/homalg-project/homalg_project.git
- name: Build documentation of packages which we might want to reference
run: |
# keep this in sync with `dev/.release`
if [ -d "CAP_project/CAP" ]; then make -C "CAP_project/CAP" doc; fi
if [ -d "CAP_project/CompilerForCAP" ]; then make -C "CAP_project/CompilerForCAP" doc; fi
if [ -d "CAP_project/MonoidalCategories" ]; then make -C "CAP_project/MonoidalCategories" doc; fi
if [ -d "CAP_project/CartesianCategories" ]; then make -C "CAP_project/CartesianCategories" doc; fi
if [ -d "CAP_project/AdditiveClosuresForCAP" ]; then make -C "CAP_project/AdditiveClosuresForCAP" doc; fi
if [ -d "CAP_project/FreydCategoriesForCAP" ]; then make -C "CAP_project/FreydCategoriesForCAP" doc; fi
if [ -d "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" ]; then make -C "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" doc; fi
if [ -d "homalg_project/homalg" ]; then make -C "homalg_project/homalg" doc; fi
if [ -d "homalg_project/Modules" ]; then make -C "homalg_project/Modules" doc; fi
if [ -d "CategoricalTowers/ToolsForCategoricalTowers" ]; then make -C "CategoricalTowers/ToolsForCategoricalTowers" doc; fi
if [ -d "CategoricalTowers/Toposes" ]; then make -C "CategoricalTowers/Toposes" doc; fi
- name: Test LessGenerators
run: |
make -C LessGenerators --trace -j $(nproc) --output-sync ci-test
- name: Release package or simulate release
run: |
cd LessGenerators
python3 dev/process_coverage.py
git config --global user.name "Bot"
git config --global user.email "empty"
cd LessGenerators
CUR_SHA=$(git rev-parse --verify HEAD)
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)
if [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker:latest" ] && [ "$CUR_SHA" = "$(git rev-parse origin/master)" ] && [ $(dirname "$GITHUB_REPOSITORY") = "homalg-project" ]; then \
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 }}"; \
TOKEN="${{ secrets.GITHUB_TOKEN }}" SUBSPLIT_PUSH_SECRET="${{ secrets.SUBSPLIT_PUSH_SECRET }}" ./dev/make_dist.sh; \
else \
echo "Not making a release."; \
TOKEN="${{ secrets.GITHUB_TOKEN }}" ./dev/simulate_dist.sh; \
fi
- name: Upload code coverage
if: github.event_name != 'schedule' && matrix.image == 'ghcr.io/homalg-project/gap-docker:latest'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
cd LessGenerators
./dev/upload_codecov.sh
6 changes: 3 additions & 3 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ SetPackageInfo( rec(

PackageName := "LessGenerators",
Subtitle := "Find smaller generating sets for modules",
Version := "2022.07-01",
Version := "2025.12-01",

Date := ~.Version{[ 1 .. 10 ]},
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Persons := [
Expand Down Expand Up @@ -100,7 +100,7 @@ PackageDoc := rec(
),

Dependencies := rec(
GAP := ">= 4.11.1",
GAP := ">= 4.13.0",
NeededOtherPackages := [
[ "AutoDoc", ">= 2013.08.07" ],
[ "Modules", ">= 2017.06.19" ],
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ To obtain current versions of all dependencies, `git clone` (or `git pull` to up
[date-img]: https://img.shields.io/endpoint?url=https://homalg-project.github.io/LessGenerators/badge_date.json&label=🔗%20released%20on&color=yellow
[date-url]: https://homalg-project.github.io/LessGenerators/view_release.html

[tests-img]: https://github.com/homalg-project/LessGenerators/workflows/Tests/badge.svg?branch=master
[tests-url]: https://github.com/homalg-project/LessGenerators/actions?query=workflow%3ATests+branch%3Amaster
[tests-img]: https://github.com/homalg-project/LessGenerators/actions/workflows/Tests.yml/badge.svg?branch=master
[tests-url]: https://github.com/homalg-project/LessGenerators/actions/workflows/Tests.yml?query=branch%3Amaster

[codecov-img]: https://codecov.io/gh/homalg-project/LessGenerators/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/homalg-project/LessGenerators
[codecov-url]: https://app.codecov.io/gh/homalg-project/LessGenerators

[code-img]: https://img.shields.io/badge/-View%20code-blue?logo=github
[code-url]: https://github.com/homalg-project/LessGenerators#top
Expand Down
12 changes: 0 additions & 12 deletions ci_gaprc

This file was deleted.

35 changes: 35 additions & 0 deletions dev/.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# This script is intended to be run by the release-gap-package script which is
# part of the the ReleaseTools for GAP:
#
# https://github.com/gap-system/ReleaseTools

set -e

# adjust date
# Note that we cannot use sed's `-i` option for in-place editing, as
# that is a non-portable extension of POSIX, which works differently in
# BSD and GNU make.
sed "s;Date := .*;Date := \"$(date -I)\",;" PackageInfo.g > PackageInfo.g.bak
mv PackageInfo.g.bak PackageInfo.g

# replace links to packages which are possibly referenced in the documentation, keep this in sync with `Tests.yml.j2`
for package in CAP_project/CAP CAP_project/CompilerForCAP CAP_project/MonoidalCategories CAP_project/CartesianCategories CAP_project/AdditiveClosuresForCAP CAP_project/FreydCategoriesForCAP HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra homalg_project/homalg homalg_project/Modules CategoricalTowers/ToolsForCategoricalTowers CategoricalTowers/Toposes; do

# adjust links to other manuals
# Note that we cannot use sed's `-i` option for in-place editing, as
# that is a non-portable extension of POSIX, which works differently in
# BSD and GNU make.
for f in ./*/*.htm* ; do
sed "s;href=\"/home/gap/.gap/pkg/$package/doc/;href=\"https://homalg-project.github.io/$package/doc/;g" "$f" > "$f.bak"
mv "$f.bak" "$f"
done

done

if [ "$PDFFiles" != "doc/manual.pdf" ] ; then
error "PackageDoc set to $PDFFiles but expected doc/manual.pdf"
fi

# remove dev directory
rm -rf dev
29 changes: 29 additions & 0 deletions dev/ci_gaprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SetUserPreference( "ShortBanners", true );

# Prefer GAPInfo.UserGapRoot over other package directories to prevent accidentally testing package
# versions distributed with GAP.

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 );
fi;
od;
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" );
4 changes: 0 additions & 4 deletions .codecov.yml → dev/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
codecov:
disable_default_path_fixes: true
require_ci_to_pass: false
fixes:
- "/home/gap/.gap/pkg/LessGenerators/::"
ignore:
- "home/"
5 changes: 5 additions & 0 deletions dev/make_dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

GAP_PKG_RELEASE_DATE=$(date -I) ./dev/release-gap-package --skip-existing-release --release-script dev/.release
16 changes: 13 additions & 3 deletions process_coverage_ignored_lines.py → dev/process_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# c) calls of `TryNextMethod` leading to external code.
#######################################################

# This script applies three rules to all coverage*.json files below the current working directory:
# a) Remove all coverage information of files not below the current working directory
# (this technically includes "tst/testall.g" because it is not referenced by an absolute path).
# b) Strip the current working directory from the paths of files below the current working directory.
# c) Ignore lines with one of the "COVERAGE_IGNORE_..." annotations (see below).

import json
import re
import os
Expand All @@ -17,14 +23,18 @@
regex_next_line = re.compile("^\s*# COVERAGE_IGNORE_NEXT_LINE$")
regex_return_void = re.compile("^\s*return;$")

for coverage_filename in Path(".").glob("**/coverage*.json"):
for coverage_filename in Path("../").glob("**/coverage*.json"):
print("processing coverage file " + str(coverage_filename))
new_data = {}
new_data["coverage"] = {}
with open(coverage_filename) as json_file:
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
line_number = 0
ignoring = False
ignored_lines = []
Expand Down Expand Up @@ -77,4 +87,4 @@
del lines_covered[str(line_number)]

with open(coverage_filename, "w") as outfile:
json.dump(data, outfile, indent=0)
json.dump(new_data, outfile, indent=0)
Loading