-
Notifications
You must be signed in to change notification settings - Fork 160
208 lines (201 loc) · 7.52 KB
/
build.yml
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
name: Install and Test Firedrake
on:
# Push to master or PR
push:
branches:
- master
pull_request:
schedule:
- cron: '0 0 * * 0'
- cron: '0 0 1 * *' # Monthly release
concurrency:
# Cancels jobs running if new commits are pushed
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RELEASE_TAG: latest
jobs:
test:
name: "Run Firedrake tests (Linux)"
runs-on: [self-hosted, Linux]
container:
image: firedrakeproject/firedrake-env:latest
strategy:
fail-fast: false
matrix:
include:
- scalar-type: real
complex: ""
petsc_arch: default
- scalar-type: complex
complex: --complex
petsc_arch: complex
env:
# PETSC_DIR and MPICH_DIR are set inside the docker image
FIREDRAKE_CI_TESTS: 1
PYOP2_CI_TESTS: 1
PETSC_ARCH: ${{ matrix.petsc_arch }}
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
COMPLEX: ${{ matrix.complex }}
RDMAV_FORK_SAFE: 1
PYTEST_ARGS: --group {#} --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 --verbose
outputs:
scalar-type: ${{ matrix.scalar-type }}
steps:
- uses: actions/checkout@v4
- name: Cleanup
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
- name: Build Firedrake
run: |
cd ..
# Linting should ignore unquoted shell variable $COMPLEX
# shellcheck disable=SC2086
./firedrake/scripts/firedrake-install \
$COMPLEX \
--honour-petsc-dir \
--mpicc="$MPICH_DIR"/mpicc \
--mpicxx="$MPICH_DIR"/mpicxx \
--mpif90="$MPICH_DIR"/mpif90 \
--mpiexec="$MPICH_DIR"/mpiexec \
--mpihome="$MPICH_DIR"/.. \
--venv-name firedrake_venv \
--no-package-manager \
--disable-ssh \
--documentation-dependencies \
--torch \
--jax \
--netgen \
--slepc \
--install thetis \
--install gusto \
--install icepack \
--install irksome \
--install femlium \
--install fascd \
--install defcon \
--install gadopt \
--install asQ \
|| (cat firedrake-install.log && /bin/false)
- name: Install test dependencies
id: build
run: |
sudo apt update
sudo apt -y install parallel
. ../firedrake_venv/bin/activate
python "$(which firedrake-clean)"
python -m pip install \
pytest-timeout \
ipympl \
pytest-split
python -m pip list
- name: Run tests (nprocs = 1)
run: |
. ../firedrake_venv/bin/activate
: # use --quote to stop parallel from parsing the pytest arguments
parallel --line-buffer --tag --quote \
pytest "$PYTEST_ARGS" --splits 12 --junit-xml="firedrake1_{#}.xml" -m "parallel[1] or not parallel" tests/firedrake ::: $(seq 12)
- name: Run tests (nprocs = 2)
# Run even if earlier tests failed
if: ${{ success() || steps.build.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
parallel --line-buffer --tag --quote \
mpiexec -n 2 pytest "$PYTEST_ARGS" --splits 6 --junit-xml="firedrake2_{#}.xml" -m parallel[2] tests/firedrake ::: $(seq 6)
# - name: Run tests (nprocs = 3)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 3 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake3_\$MPISPAWN_TASK_ID1.xml -m parallel[3] -v tests/firedrake
# - name: Run tests (nprocs = 4)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 4 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake4_\$MPISPAWN_TASK_ID1.xml -m parallel[4] -v tests/firedrake
# - name: Run tests (nprocs = 5)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 5 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake5_\$MPISPAWN_TASK_ID1.xml -m parallel[5] -v tests/firedrake
# - name: Run tests (nprocs = 6)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 6 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake6_\$MPISPAWN_TASK_ID1.xml -m parallel[6] -v tests/firedrake
# - name: Run tests (nprocs = 7)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 7 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake7_\$MPISPAWN_TASK_ID1.xml -m parallel[7] -v tests/firedrake
# - name: Run tests (nprocs = 8)
# if: ${{ success() || steps.build.conclusion == 'success' }}
# run: |
# . ../firedrake_venv/bin/activate
# mpispawn -nU 12 -nW 8 --propagate-errcodes \
# pytest "$PYTEST_ARGS" --junit-xml=firedrake8_\$MPISPAWN_TASK_ID1.xml -m parallel[8] -v tests/firedrake
- name: Publish Test Report
uses: mikepenz/[email protected]
if: ${{ always() && ( github.ref != 'refs/heads/master') }}
with:
report_paths: '/__w/firedrake/firedrake/firedrake*.xml'
comment: true
check_name: "Firedrake ${{ matrix.scalar-type }}"
updateComment: true
flaky_summary: true
- name: Test pyadjoint
if: ${{ matrix.scalar-type == 'real' }}
run: |
. ../firedrake_venv/bin/activate
cd ../firedrake_venv/src/pyadjoint
python -m pytest \
--strict-markers \
--durations=200 \
--timeout=600 \
--timeout-method=thread \
-o faulthandler_timeout=660 \
-n 12 --dist worksteal \
-sv tests/firedrake_adjoint
timeout-minutes: 30
- name: Cleanup
# Belt and braces: clean up before and after the run.
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
docker_tag:
name: "Set the Docker release tag"
runs-on: [self-hosted, Linux]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Set release tag
# Set a release tag if triggered by monthly CRON job
if: github.event.schedule == '0 0 1 * *'
run: |
DATE_TAG="$(date +%Y-%m)"
echo "RELEASE_TAG=$DATE_TAG" >> "$GITHUB_ENV"
- name: Print release tag being used
run: |
echo The release tag is "$RELEASE_TAG"
outputs:
tag: ${{ env.RELEASE_TAG }}
docker:
name: "Build Docker containers"
# Only run on master, but always generate firedrake-env image,
# even if build fails (see docker.yml)
if: ${{ (github.ref == 'refs/heads/master') && always() }}
needs: [test, docker_tag]
uses: ./.github/workflows/docker.yml
with:
tag: ${{ needs.docker_tag.outputs.tag }}
status: ${{ needs.test.result }}
secrets: inherit