Tests #4928
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- "master" | |
- "*-ci" | |
pull_request: | |
schedule: | |
- 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: | |
matrix: | |
image: ["ghcr.io/homalg-project/gap-docker:latest", "ghcr.io/homalg-project/gap-docker-master:latest"] | |
fail-fast: false | |
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: | |
- 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 ./CAP_project/dev/ci_gaprc /home/gap/.gap/gaprc | |
git clone --depth 1 -vv https://github.com/gap-packages/AutoDoc.git | |
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/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 CAP_project | |
run: | | |
make -C CAP_project --trace -j $(nproc) --output-sync ci-test | |
- name: Release package or simulate release | |
run: | | |
cd CAP_project | |
python3 dev/process_coverage.py | |
git config --global user.name "Bot" | |
git config --global user.email "empty" | |
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 checkout master; \ | |
TOKEN="${{ secrets.GITHUB_TOKEN }}" SUBSPLIT_PUSH_SECRET="${{ secrets.SUBSPLIT_PUSH_SECRET }}" ./dev/make_dist.sh; \ | |
else \ | |
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-master:latest' | |
run: | | |
cd CAP_project | |
./dev/upload_codecov.sh |