-
Notifications
You must be signed in to change notification settings - Fork 18
213 lines (208 loc) · 10.2 KB
/
Copy pathTests.yml
File metadata and controls
213 lines (208 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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:
# ── Clone packages and build reference documentation once per image ─────────────────────
prepare-deps:
strategy:
matrix:
image: ["ghcr.io/homalg-project/gap-docker:latest", "ghcr.io/homalg-project/gap-docker-master:latest"]
fail-fast: false
name: Build docs (${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }})
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
defaults:
run:
working-directory: /home/gap/.gap/pkg/
env:
HOME: /home/gap
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
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: Clone dependencies
run: |
cp ./CAP_project/dev/ci_gaprc /home/gap/.gap/gaprc
git clone --depth 1 -vv https://github.com/homalg-project/homalg_project.git
git clone --depth 1 -vv https://github.com/homalg-project/ToricVarieties.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: Package dependencies
run: |
tar cf /tmp/deps.tar --exclude='.git' \
homalg_project/ \
ToricVarieties/ \
CAP_project/CAP/doc/ \
CAP_project/CompilerForCAP/doc/ \
CAP_project/MonoidalCategories/doc/ \
CAP_project/CartesianCategories/doc/ \
CAP_project/AdditiveClosuresForCAP/doc/ \
CAP_project/FreydCategoriesForCAP/doc/
- name: Upload deps artifact
uses: actions/upload-artifact@v4
with:
name: deps-${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }}
path: /tmp/deps.tar
retention-days: 1
# ── Per-package test jobs (run in parallel) ──────────────────────────
test:
needs: prepare-deps
strategy:
matrix:
image: ["ghcr.io/homalg-project/gap-docker:latest", "ghcr.io/homalg-project/gap-docker-master:latest"]
config:
- { packages: [CAP, ActionsForCAP, AttributeCategoryForCAP, GroupRepresentationsForCAP, GroupsAsCategoriesForCAP] }
- { packages: [CartesianCategories, MonoidalCategories] }
- { packages: [ComplexesAndFilteredObjectsForCAP, InternalExteriorAlgebraForCAP, HomologicalAlgebraForCAP, GeneralizedMorphismsForCAP, ToricSheaves] }
- { packages: [CompilerForCAP] }
- { packages: [LinearAlgebraForCAP, LinearClosuresForCAP, AdditiveClosuresForCAP, FreydCategoriesForCAP] }
- { packages: [ModulesOverLocalRingsForCAP, ModulePresentationsForCAP, GradedModulePresentationsForCAP] }
fail-fast: false
name: ${{ matrix.config.targets && format('{0}_{1}', matrix.config.package, join(matrix.config.targets, '_')) || matrix.config.package || join(matrix.config.packages, '_') }} (${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }})
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
defaults:
run:
working-directory: /home/gap/.gap/pkg/
env:
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@v4
with:
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: Download pre-built dependencies
uses: actions/download-artifact@v4
with:
name: deps-${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }}
path: /tmp/
- name: Extract dependencies
run: |
tar xf /tmp/deps.tar
cp ./CAP_project/dev/ci_gaprc /home/gap/.gap/gaprc
- name: Test ${{ matrix.config.targets && format('{0}_{1}', matrix.config.package, join(matrix.config.targets, '_')) || matrix.config.package || join(matrix.config.packages, '_') }}
run: |
PACKAGES="${{ matrix.config.package || join(matrix.config.packages, ' ') }}"
TARGETS="${{ join(matrix.config.targets, ' ') }}"
for pkg in $PACKAGES; do
if [ -z "$TARGETS" ]; then
make -C "CAP_project/$pkg" --trace ci-test
else
for tgt in $TARGETS; do
if [ "$tgt" = "base" ]; then
make -C "CAP_project/$pkg" --trace ci-test-base
else
make -C "CAP_project/$pkg" --trace ci-test-single "TST_ID=$tgt"
fi
done
fi
done
- name: Process coverage files
if: always() && matrix.image == 'ghcr.io/homalg-project/gap-docker:latest'
run: |
cd CAP_project
python3 dev/process_coverage.py
- name: Collect coverage files
if: always() && github.event_name != 'schedule' && matrix.image == 'ghcr.io/homalg-project/gap-docker:latest'
run: |
mkdir -p /tmp/coverage-collect
for pkg in ${{ matrix.config.package || join(matrix.config.packages, ' ') }}; do
mkdir -p "/tmp/coverage-collect/$pkg"
cp "CAP_project/$pkg"/coverage*.json "/tmp/coverage-collect/$pkg/" 2>/dev/null || true
done
- name: Upload coverage artifact
if: always() && github.event_name != 'schedule' && matrix.image == 'ghcr.io/homalg-project/gap-docker:latest'
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.config.targets && format('{0}_{1}', matrix.config.package, join(matrix.config.targets, '_')) || matrix.config.package || join(matrix.config.packages, '_') }}
path: /tmp/coverage-collect/
if-no-files-found: ignore
retention-days: 1
# ── Release / simulate release ───────────────────────────────────────
release:
needs: [prepare-deps, test]
if: always() && !cancelled()
strategy:
matrix:
image: ["ghcr.io/homalg-project/gap-docker:latest", "ghcr.io/homalg-project/gap-docker-master:latest"]
fail-fast: false
name: Release (${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }})
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
defaults:
run:
working-directory: /home/gap/.gap/pkg/
env:
HOME: /home/gap
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
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: Download pre-built dependencies
uses: actions/download-artifact@v4
with:
name: deps-${{ matrix.image == 'ghcr.io/homalg-project/gap-docker:latest' && 'stable' || 'master' }}
path: /tmp/
- name: Extract dependencies
run: |
tar xf /tmp/deps.tar
cp ./CAP_project/dev/ci_gaprc /home/gap/.gap/gaprc
- name: Release package or simulate release
run: |
cd CAP_project
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