Skip to content

Test package

Test package #1437

Workflow file for this run

name: Test package
on:
workflow_call:
inputs:
tag:
description: "Tag of DOLFINx docker image"
default: "nightly"
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: "Tag of DOLFINx docker image"
default: "nightly"
required: true
type: string
pull_request:
branches:
- main
schedule:
- cron: "0 8 * * *"
env:
DEB_PYTHON_INSTALL_LAYOUT: deb_system
DEFAULT_TAG: nightly
jobs:
get_image_tag:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.docker_tag.outputs.image }}
steps:
- id: docker_tag
run: echo "image=${{ inputs.tag || env.DEFAULT_TAG }}" >> $GITHUB_OUTPUT
check-formatting:
needs: get_image_tag
uses: ./.github/workflows/check_formatting.yml
with:
tag: ${{ needs.get_image_tag.outputs.image }}
create-datasets:
uses: ./.github/workflows/create_legacy_data.yml
with:
artifact_name: "legacy_mpich"
create-legacy-datasets:
uses: ./.github/workflows/create_legacy_checkpoint.yml
with:
artifact_name: "legacy_checkpoint_mpich"
test-code:
runs-on: ubuntu-24.04
needs:
[create-datasets, create-legacy-datasets, check-formatting, get_image_tag]
container: ghcr.io/fenics/dolfinx/dolfinx:${{ needs.get_image_tag.outputs.image }}
steps:
- uses: actions/checkout@v4
- name: Update pip
run: python3 -m pip install --break-system-packages --upgrade pip setuptools
- name: Download legacy data
uses: actions/download-artifact@v4
with:
name: legacy_mpich
path: ./legacy
- name: Download legacy data
uses: actions/download-artifact@v4
with:
name: legacy_checkpoint_mpich
path: ./legacy_checkpoint
- name: Install package
run: python3 -m pip install --break-system-packages .[test]
- name: Run tests
run: |
coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/
- name: Run tests in parallel
run: |
mpirun -n 4 coverage run --rcfile=.coveragerc -m mpi4py -m pytest -xvs ./tests/
- name: Combine coverage reports
run: |
coverage combine
coverage report -m
coverage html
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: htmlcov
if-no-files-found: error