Debian Codegraph @

.github/workflows/test_workflow.yml

raw
1 name: Test package
2
3 on:
4 workflow_call:
5 inputs:
6 tag:
7 description: "Tag of DOLFINx docker image"
8 default: "nightly"
9 required: true
10 type: string
11 workflow_dispatch:
12 inputs:
13 tag:
14 description: "Tag of DOLFINx docker image"
15 default: "nightly"
16 required: true
17 type: string
18 env:
19 DEB_PYTHON_INSTALL_LAYOUT: deb_system
20 DEFAULT_TAG: nightly
21 HDF5_MPI: "ON"
22 HDF5_INCLUDEDIR: "/usr/include/hdf5/openmpi"
23 H5PY_SETUP_REQUIRES: 0
24 OMPI_ALLOW_RUN_AS_ROOT: 1
25 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
26 PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe
27 CC: mpicc
28 CXX: mpicxx
29
30 jobs:
31 get_image_tag:
32 runs-on: ubuntu-latest
33 outputs:
34 image: ${{ steps.docker_tag.outputs.image }}
35 steps:
36 - id: docker_tag
37 run: echo "image=${{ inputs.tag || env.DEFAULT_TAG }}" >> $GITHUB_OUTPUT
38
39 test-code:
40 runs-on: ubuntu-24.04
41 # The container tag is now dynamic based on the input passed by the caller
42 container: ghcr.io/fenics/test-env:current
43 needs:
44 [get_image_tag]
45 env:
46 working-directory: ./src
47
48 steps:
49 - uses: actions/checkout@v7
50
51 - name: Update pip
52 run: python3 -m pip install --upgrade pip
53
54 - name: Install build requirements
55 run: python3 -m pip install --group build --no-build-isolation
56
57
58 # Note: We assume the caller workflow has already uploaded these artifacts
59 - name: Download legacy mpich data
60 uses: actions/download-artifact@v8
61 with:
62 name: legacy_mpich
63 path: ./legacy
64
65 - name: Download legacy checkpoint mpich data
66 uses: actions/download-artifact@v8
67 with:
68 name: legacy_checkpoint_mpich
69 path: ./legacy_checkpoint
70
71 - name: Install DOLFINx (stable)
72 if: needs.get_image_tag.outputs.image == 'stable'
73 uses: jorgensd/actions/[email protected]
74 with:
75 adios2: default
76 petsc_arch: linux-gnu-real64-32
77 dolfinx: release
78 basix: release
79 ufl: release
80 ffcx: release
81 working-directory: ${{ env.working-directory}}
82
83 - name: Install DOLFINx (nightly)
84 if: needs.get_image_tag.outputs.image == 'nightly'
85 uses: jorgensd/actions/[email protected]
86 with:
87 adios2: default
88 petsc_arch: linux-gnu-real64-32
89 working-directory: ${{ env.working-directory}}
90
91 - name: Configure HDF5 MPI Environment
92 run: |
93 # Evaluate architecture dynamically and write to GITHUB_ENV
94 ARCH_TRIPLET=$(gcc -print-multiarch)
95 echo "HDF5_LIBDIR=/usr/lib/${ARCH_TRIPLET}/hdf5/openmpi" >> $GITHUB_ENV
96
97 - name: Install package
98 run: |
99 python3 -m pip install "Cython>=3.0.11" "pkgconfig>=1.5.5"
100 python3 -m pip install h5py --no-binary=h5py --no-build-isolation
101 python3 -m pip install --group dev --group test
102 python3 -m pip install . --no-build-isolation
103
104 - name: Show adios2 version
105 run: python3 -c "import adios2; print(adios2.__version__)"
106
107 - name: Show h5py version
108 run: python3 -c "import h5py; print(h5py.__version__)"
109
110 - name: Show hdf5 version
111 run: python3 -c "import h5py; print(h5py.version.hdf5_version)"
112
113 - name: Run tests
114 run: coverage run --rcfile=.coveragerc -m pytest -xvs ./tests/
115
116 - name: Run tests in parallel
117 run: mpirun -n 4 coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/
118
119 - name: Combine coverage reports
120 run: |
121 coverage combine
122 coverage report -m
123 coverage html
124
125 # Use the tag in the artifact name so parallel runs don't overwrite each other
126 - name: Upload coverage report
127 uses: actions/upload-artifact@v7
128 with:
129 name: code-coverage-report-${{ inputs.tag }}
130 path: htmlcov
131 if-no-files-found: error