2121 RELEASE_TAG : latest
2222
2323jobs :
24- build :
25- name : " Build Firedrake"
26- # Run on our self-hosted machines
24+ test :
25+ name : " Run Firedrake tests (Linux)"
2726 runs-on : [self-hosted, Linux]
2827 container :
2928 image : firedrakeproject/firedrake-env:latest
3029 strategy :
31- # Don't immediately kill real if complex fails and vice versa.
30+ # We want to know all of the tests which fail, so don't kill real if
31+ # complex fails and vice-versa
3232 fail-fast : false
3333 matrix :
3434 include :
@@ -47,13 +47,16 @@ jobs:
4747 OPENBLAS_NUM_THREADS : 1
4848 COMPLEX : ${{ matrix.complex }}
4949 RDMAV_FORK_SAFE : 1
50+ EXTRA_PYTEST_ARGS : --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 tests/firedrake
5051 steps :
5152 - uses : actions/checkout@v4
53+
5254 - name : Cleanup
5355 if : ${{ always() }}
5456 run : |
5557 cd ..
5658 rm -rf firedrake_venv
59+
5760 - name : Build Firedrake
5861 run : |
5962 cd ..
@@ -87,56 +90,108 @@ jobs:
8790 --package-branch fiat indiamai/integrate_fuse \
8891 --package-branch fuse main \
8992 || (cat firedrake-install.log && /bin/false)
93+
9094 - name : Install test dependencies
95+ id : build
9196 run : |
97+ sudo apt update
98+ sudo apt -y install parallel
9299 . ../firedrake_venv/bin/activate
93100 python "$(which firedrake-clean)"
94- python -m pip install \
95- pytest-xdist pytest-timeout ipympl
101+ python -m pip install pytest-timeout ipympl pytest-split pytest-xdist
96102 python -m pip list
97- - name : Test Firedrake
103+
104+ - name : Run tests (nprocs = 1)
98105 run : |
106+ : # Use pytest-xdist here so we can have a single collated output (not possible
107+ : # for parallel tests)
99108 . ../firedrake_venv/bin/activate
100- echo OMP_NUM_THREADS is "$OMP_NUM_THREADS"
101- echo OPENBLAS_NUM_THREADS is "$OPENBLAS_NUM_THREADS"
102- python -m pytest -v tests/firedrake/test_0init.py
103- python -m pytest \
104- --durations=200 \
105- --timeout=1800 \
106- --timeout-method=thread \
107- -o faulthandler_timeout=1860 \
108- -n 12 --dist worksteal \
109- --junit-xml=firedrake.xml \
110- -sv tests/firedrake
111- timeout-minutes : 120
109+ firedrake-run-split-tests 1 1 "-n 12 $EXTRA_PYTEST_ARGS --junit-xml=firedrake1_{#}.xml"
110+
111+ - name : Run tests (nprocs = 2)
112+ # Run even if earlier tests failed
113+ if : ${{ success() || steps.build.conclusion == 'success' }}
114+ run : |
115+ . ../firedrake_venv/bin/activate
116+ firedrake-run-split-tests 2 6 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake2_{#}.xml"
117+
118+ - name : Run tests (nprocs = 3)
119+ if : ${{ success() || steps.build.conclusion == 'success' }}
120+ run : |
121+ . ../firedrake_venv/bin/activate
122+ firedrake-run-split-tests 3 4 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake3_{#}.xml"
123+
124+ - name : Run tests (nprocs = 4)
125+ if : ${{ success() || steps.build.conclusion == 'success' }}
126+ run : |
127+ . ../firedrake_venv/bin/activate
128+ firedrake-run-split-tests 4 3 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake4_{#}.xml"
129+
130+ - name : Run tests (nprocs = 5)
131+ if : ${{ success() || steps.build.conclusion == 'success' }}
132+ run : |
133+ . ../firedrake_venv/bin/activate
134+ firedrake-run-split-tests 5 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake5_{#}.xml"
135+
136+ - name : Run tests (nprocs = 6)
137+ if : ${{ success() || steps.build.conclusion == 'success' }}
138+ run : |
139+ . ../firedrake_venv/bin/activate
140+ firedrake-run-split-tests 6 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake6_{#}.xml"
141+
142+ - name : Run tests (nprocs = 7)
143+ if : ${{ success() || steps.build.conclusion == 'success' }}
144+ run : |
145+ . ../firedrake_venv/bin/activate
146+ firedrake-run-split-tests 7 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake7_{#}.xml"
147+
148+ - name : Run tests (nprocs = 8)
149+ if : ${{ success() || steps.build.conclusion == 'success' }}
150+ run : |
151+ . ../firedrake_venv/bin/activate
152+ firedrake-run-split-tests 8 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake8_{#}.xml"
153+
112154 - name : Publish Test Report
113155 uses : mikepenz/action-junit-report@v5.0.0-a02
114- if : ${{ always() && ( github.ref != 'refs/heads/master') }}
156+ # To avoid permissions issues do not run with forked repos
157+ # (see https://github.com/mikepenz/action-junit-report/issues/23)
158+ if : ${{ always() && (github.ref != 'refs/heads/master') && (github.event.pull_request.head.repo.full_name == github.repository) }}
115159 with :
116- report_paths : ' /__w/ firedrake/firedrake/firedrake .xml'
160+ report_paths : ' firedrake* .xml'
117161 comment : true
118162 check_name : " Firedrake ${{ matrix.scalar-type }}"
119163 updateComment : true
120164 flaky_summary : true
165+
166+ - name : Upload log files
167+ uses : actions/upload-artifact@v4
168+ if : always()
169+ with :
170+ name : firedrake-logs-${{ matrix.scalar-type }}
171+ path : pytest_*.log
172+
121173 - name : Test pyadjoint
122174 if : ${{ matrix.scalar-type == 'real' }}
123175 run : |
124176 . ../firedrake_venv/bin/activate
125177 cd ../firedrake_venv/src/pyadjoint
126178 python -m pytest \
179+ --strict-markers \
127180 --durations=200 \
128181 --timeout=600 \
129182 --timeout-method=thread \
130183 -o faulthandler_timeout=660 \
131184 -n 12 --dist worksteal \
132185 -sv tests/firedrake_adjoint
133186 timeout-minutes : 30
187+
134188 - name : Cleanup
135189 # Belt and braces: clean up before and after the run.
136190 if : ${{ always() }}
137191 run : |
138192 cd ..
139193 rm -rf firedrake_venv
194+
140195 docker_tag :
141196 name : " Set the Docker release tag"
142197 runs-on : [self-hosted, Linux]
@@ -153,14 +208,15 @@ jobs:
153208 echo The release tag is "$RELEASE_TAG"
154209 outputs :
155210 tag : ${{ env.RELEASE_TAG }}
211+
156212 docker :
157213 name : " Build Docker containers"
158214 # Only run on master, but always generate firedrake-env image,
159215 # even if build fails (see docker.yml)
160216 if : ${{ (github.ref == 'refs/heads/master') && always() }}
161- needs : [build , docker_tag]
217+ needs : [test , docker_tag]
162218 uses : ./.github/workflows/docker.yml
163219 with :
164220 tag : ${{ needs.docker_tag.outputs.tag }}
165- status : ${{ needs.build .result }}
221+ status : ${{ needs.test .result }}
166222 secrets : inherit
0 commit comments