diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index b4f658d..5680d27 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -5,19 +5,16 @@ on: inputs: tag: description: "Tag of DOLFINx docker image" - default: "nightly" + default: "stable" required: true type: string workflow_dispatch: inputs: tag: description: "Tag of DOLFINx docker image" - default: "nightly" + default: "stable" required: true type: string - push: - branches: - - main pull_request: branches: - main @@ -26,7 +23,7 @@ on: env: DEB_PYTHON_INSTALL_LAYOUT: deb_system - DEFAULT_TAG: nightly + DEFAULT_TAG: stable ARTIFACT_NAME: docs PUBLISH_DIR: ./_build/html PIP_NO_BINARY: h5py diff --git a/.github/workflows/deploy_pages.yml b/.github/workflows/deploy_pages.yml index c4b559c..b92f41b 100644 --- a/.github/workflows/deploy_pages.yml +++ b/.github/workflows/deploy_pages.yml @@ -22,13 +22,13 @@ jobs: with: tag: "stable" - run-coverage: - uses: ./.github/workflows/test_package.yml + test-code: + uses: ./.github/workflows/test_workflow.yml with: tag: "stable" deploy: - needs: [run-coverage, build-docs] + needs: [build-docs, test-code] environment: name: github-pages @@ -48,9 +48,10 @@ jobs: # docs artifact is uploaded by build-docs job uses: actions/download-artifact@v7 with: - name: code-coverage-report + name: code-coverage-report-stable path: "./public/code-coverage-report" + - name: Upload artifact uses: actions/upload-pages-artifact@v4 with: diff --git a/.github/workflows/test_dolfinx_versions.yml b/.github/workflows/test_dolfinx_versions.yml new file mode 100644 index 0000000..11f8050 --- /dev/null +++ b/.github/workflows/test_dolfinx_versions.yml @@ -0,0 +1,31 @@ +name: Test dolfinx versions + +on: + push: + branches: [main] + pull_request: + +jobs: + # 1. Prerequisite jobs (Data creation) + 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" + + # 2. The Matrix Job + run-tests: + needs: [create-datasets, create-legacy-datasets] + strategy: + fail-fast: false + matrix: + tag: ["nightly", "stable"] + + # Call the reusable workflow + uses: ./.github/workflows/test_workflow.yml + with: + dolfinx_tag: ${{ matrix.tag }} \ No newline at end of file diff --git a/.github/workflows/test_package.yml b/.github/workflows/test_package.yml deleted file mode 100644 index 851a80b..0000000 --- a/.github/workflows/test_package.yml +++ /dev/null @@ -1,106 +0,0 @@ -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 - PIP_NO_BINARY: h5py - -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@v6 - - - name: Update pip - run: python3 -m pip install --upgrade pip - - - name: Install build requirements - run: python3 -m pip install -r build-requirements.txt - - - name: Download legacy data - uses: actions/download-artifact@v7 - with: - name: legacy_mpich - path: ./legacy - - - name: Download legacy data - uses: actions/download-artifact@v7 - with: - name: legacy_checkpoint_mpich - path: ./legacy_checkpoint - - - name: Install package - run: | - HDF5_MPI=ON HDF5_PKGCONFIG_NAME="hdf5" python3 -m pip install h5py --no-build-isolation --no-binary=h5py - python3 -m pip install .[test] - - - name: Run tests - run: | - 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@v6 - with: - name: code-coverage-report - path: htmlcov - if-no-files-found: error diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml new file mode 100644 index 0000000..7f0ee4e --- /dev/null +++ b/.github/workflows/test_workflow.yml @@ -0,0 +1,70 @@ +name: Test + +on: + workflow_call: + inputs: + dolfinx_tag: + required: true + type: string + +jobs: + test-code: + runs-on: ubuntu-24.04 + # The container tag is now dynamic based on the input passed by the caller + container: ghcr.io/fenics/dolfinx/dolfinx:${{ inputs.dolfinx_tag }} + + steps: + - uses: actions/checkout@v6 + + - name: Update pip + run: python3 -m pip install --upgrade pip + + - name: Install build requirements + run: python3 -m pip install -r build-requirements.txt + + # Note: We assume the caller workflow has already uploaded these artifacts + - name: Download legacy mpich data + uses: actions/download-artifact@v7 + with: + name: legacy_mpich + path: ./legacy + + - name: Download legacy checkpoint mpich data + uses: actions/download-artifact@v7 + with: + name: legacy_checkpoint_mpich + path: ./legacy_checkpoint + + - name: Install package + run: | + HDF5_MPI=ON HDF5_PKGCONFIG_NAME="hdf5" python3 -m pip install h5py --no-build-isolation --no-binary=h5py + python3 -m pip install .[test] + + - name: Show adios2 version + run: python3 -c "import adios2; print(adios2.__version__)" + + - name: Show h5py version + run: python3 -c "import h5py; print(h5py.__version__)" + + - name: Show hdf5 version + run: python3 -c "import h5py; print(h5py.version.hdf5_version)" + + - name: Run tests + run: coverage run --rcfile=.coveragerc -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 + + # Use the tag in the artifact name so parallel runs don't overwrite each other + - name: Upload coverage report + uses: actions/upload-artifact@v6 + with: + name: code-coverage-report-${{ inputs.dolfinx_tag }} + path: htmlcov + if-no-files-found: error \ No newline at end of file