| 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 |
|
| 19 |
pull_request: |
| 20 |
branches: |
| 21 |
- main |
| 22 |
schedule: |
| 23 |
- cron: "0 8 * * *" |
| 24 |
|
| 25 |
env: |
| 26 |
DEB_PYTHON_INSTALL_LAYOUT: deb_system |
| 27 |
DEFAULT_TAG: nightly |
| 28 |
|
| 29 |
jobs: |
| 30 |
get_image_tag: |
| 31 |
runs-on: ubuntu-latest |
| 32 |
outputs: |
| 33 |
image: ${{ steps.docker_tag.outputs.image }} |
| 34 |
steps: |
| 35 |
- id: docker_tag |
| 36 |
run: echo "image=${{ inputs.tag || env.DEFAULT_TAG }}" >> $GITHUB_OUTPUT |
| 37 |
|
| 38 |
check-formatting: |
| 39 |
needs: get_image_tag |
| 40 |
uses: ./.github/workflows/check_formatting.yml |
| 41 |
with: |
| 42 |
tag: ${{ needs.get_image_tag.outputs.image }} |
| 43 |
|
| 44 |
create-datasets: |
| 45 |
uses: ./.github/workflows/create_legacy_data.yml |
| 46 |
with: |
| 47 |
artifact_name: "legacy_mpich" |
| 48 |
|
| 49 |
create-legacy-datasets: |
| 50 |
uses: ./.github/workflows/create_legacy_checkpoint.yml |
| 51 |
with: |
| 52 |
artifact_name: "legacy_checkpoint_mpich" |
| 53 |
|
| 54 |
test-code: |
| 55 |
runs-on: ubuntu-24.04 |
| 56 |
needs: |
| 57 |
[create-datasets, create-legacy-datasets, check-formatting, get_image_tag] |
| 58 |
container: ghcr.io/fenics/dolfinx/dolfinx:${{ needs.get_image_tag.outputs.image }} |
| 59 |
|
| 60 |
steps: |
| 61 |
- uses: actions/checkout@v5 |
| 62 |
|
| 63 |
- name: Update pip |
| 64 |
run: python3 -m pip install --break-system-packages --upgrade pip setuptools |
| 65 |
|
| 66 |
- name: Download legacy data |
| 67 |
uses: actions/download-artifact@v5 |
| 68 |
with: |
| 69 |
name: legacy_mpich |
| 70 |
path: ./legacy |
| 71 |
|
| 72 |
- name: Download legacy data |
| 73 |
uses: actions/download-artifact@v5 |
| 74 |
with: |
| 75 |
name: legacy_checkpoint_mpich |
| 76 |
path: ./legacy_checkpoint |
| 77 |
|
| 78 |
- name: Install package |
| 79 |
run: python3 -m pip install --break-system-packages .[test] |
| 80 |
|
| 81 |
- name: Run tests |
| 82 |
run: | |
| 83 |
coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/ |
| 84 |
|
| 85 |
- name: Run tests in parallel |
| 86 |
run: | |
| 87 |
mpirun -n 4 coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/ |
| 88 |
|
| 89 |
- name: Combine coverage reports |
| 90 |
run: | |
| 91 |
coverage combine |
| 92 |
coverage report -m |
| 93 |
coverage html |
| 94 |
|
| 95 |
- name: Upload coverage report as artifact |
| 96 |
uses: actions/upload-artifact@v4 |
| 97 |
with: |
| 98 |
name: code-coverage-report |
| 99 |
path: htmlcov |
| 100 |
if-no-files-found: error |