Skip to content

Commit 8fc51b0

Browse files
committed
Try making a matrix to test different dolfinx versions
1 parent dc25b91 commit 8fc51b0

5 files changed

Lines changed: 107 additions & 117 deletions

File tree

.github/workflows/build_docs.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
tag: ${{ needs.get_image_tag.outputs.image }}
4444

4545
build-docs:
46-
needs: [get_image_tag, test-code]
46+
needs: get_image_tag
4747
runs-on: ubuntu-latest
4848
container: ghcr.io/fenics/dolfinx/dolfinx:${{ needs.get_image_tag.outputs.image }}
4949

@@ -60,13 +60,6 @@ jobs:
6060
- name: Build docs
6161
run: jupyter book build .
6262

63-
- name: Download docs artifact
64-
# docs artifact is uploaded by build-docs job
65-
uses: actions/download-artifact@v7
66-
with:
67-
name: code-coverage-report
68-
path: "./_build/html/code-coverage-report"
69-
7063
- name: Upload documentation as artifact
7164
uses: actions/upload-artifact@v6
7265
if: always()

.github/workflows/deploy_pages.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ jobs:
2222
with:
2323
tag: "stable"
2424

25+
test-code:
26+
uses: ./.github/workflows/test_workflow.yml
27+
with:
28+
tag: "stable"
29+
2530
deploy:
26-
needs: [build-docs]
31+
needs: [build-docs, test-code]
2732

2833
environment:
2934
name: github-pages
@@ -39,6 +44,13 @@ jobs:
3944
name: docs
4045
path: "./public"
4146

47+
- name: Download docs artifact
48+
# docs artifact is uploaded by build-docs job
49+
uses: actions/download-artifact@v7
50+
with:
51+
name: code-coverage-report-stable
52+
path: "./public/code-coverage-report"
53+
4254

4355
- name: Upload artifact
4456
uses: actions/upload-pages-artifact@v4
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .github/workflows/test-matrix.yml
2+
name: Test Matrix (All Versions)
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
9+
jobs:
10+
# 1. Prerequisite jobs (Data creation)
11+
create-datasets:
12+
uses: ./.github/workflows/create_legacy_data.yml
13+
with:
14+
artifact_name: "legacy_mpich"
15+
16+
create-legacy-datasets:
17+
uses: ./.github/workflows/create_legacy_checkpoint.yml
18+
with:
19+
artifact_name: "legacy_checkpoint_mpich"
20+
21+
# 2. The Matrix Job
22+
run-tests:
23+
needs: [create-datasets, create-legacy-datasets]
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
tag: ["nightly", "stable", "v0.9"]
28+
29+
# Call the reusable workflow
30+
uses: ./.github/workflows/test_workflow.yml
31+
with:
32+
dolfinx_tag: ${{ matrix.tag }}

.github/workflows/test_package.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Single test run
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
dolfinx_tag:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
test-code:
12+
runs-on: ubuntu-24.04
13+
# The container tag is now dynamic based on the input passed by the caller
14+
container: ghcr.io/fenics/dolfinx/dolfinx:${{ inputs.dolfinx_tag }}
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- name: Update pip
20+
run: python3 -m pip install --upgrade pip
21+
22+
- name: Install build requirements
23+
run: python3 -m pip install -r build-requirements.txt
24+
25+
# Note: We assume the caller workflow has already uploaded these artifacts
26+
- name: Download legacy data
27+
uses: actions/download-artifact@v7
28+
with:
29+
name: legacy_mpich
30+
path: ./legacy
31+
32+
- name: Download legacy data
33+
uses: actions/download-artifact@v7
34+
with:
35+
name: legacy_checkpoint_mpich
36+
path: ./legacy_checkpoint
37+
38+
- name: Install package
39+
run: |
40+
HDF5_MPI=ON HDF5_PKGCONFIG_NAME="hdf5" python3 -m pip install h5py --no-build-isolation --no-binary=h5py
41+
python3 -m pip install .[test]
42+
43+
- name: Run tests
44+
run: coverage run --rcfile=.coveragerc -m pytest -xvs ./tests/
45+
46+
- name: Run tests in parallel
47+
run: mpirun -n 4 coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/
48+
49+
- name: Combine coverage reports
50+
run: |
51+
coverage combine
52+
coverage report -m
53+
coverage html
54+
55+
# Use the tag in the artifact name so parallel runs don't overwrite each other
56+
- name: Upload coverage report
57+
uses: actions/upload-artifact@v6
58+
with:
59+
name: code-coverage-report-${{ inputs.dolfinx_tag }}
60+
path: htmlcov
61+
if-no-files-found: error

0 commit comments

Comments
 (0)