pip install firedrake #7016
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 0' | |
- cron: '0 0 1 * *' # Monthly release | |
concurrency: | |
# Cancel running jobs if new commits are pushed | |
group: > | |
${{ github.workflow }}- | |
${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
RELEASE_TAG: latest | |
jobs: | |
test: | |
name: Install and test Firedrake (Linux) | |
strategy: | |
# We want to know all of the tests which fail, so don't kill real if | |
# complex fails and vice-versa | |
fail-fast: false | |
matrix: | |
arch: [default, complex] | |
runs-on: [self-hosted, Linux] | |
container: | |
image: firedrakeproject/firedrake-env:pip | |
env: | |
# NOTE: Do not set a lot of vars here, single source of truth | |
FIREDRAKE_CI_TESTS: 1 | |
PYOP2_CI_TESTS: 1 | |
PYOP2_SPMD_STRICT: 1 | |
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 repo/tests/firedrake | |
steps: | |
- name: Pre-run cleanup | |
run: | | |
: # Make sure the current directory is empty | |
find . -delete | |
- uses: actions/checkout@v4 | |
with: | |
path: repo | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install \ | |
$(python3 ./repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-dependencies) | |
: # Extra test dependencies | |
sudo apt-get -y install parallel | |
- name: Install PETSc | |
run: | | |
git clone https://github.com/firedrakeproject/petsc.git | |
cd petsc | |
./configure \ | |
$(python3 ../repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-petsc-configure-options) \ | |
--with-make-np=12 | |
make | |
# TODO: This fails for some reason | |
# make check | |
- name: Install Firedrake | |
id: install | |
run: | | |
export PETSC_DIR=$PWD/petsc PETSC_ARCH=arch-firedrake-${{ matrix.arch }} | |
export HDF5_MPI=ON | |
export CC=mpicc CXX=mpicxx | |
export MPICC=$CC | |
python3 -m venv venv | |
. venv/bin/activate | |
: # Force a rebuild of petsc4py as the cached one will not link to the fresh | |
: # install of PETSc. A similar trick may be needed for compiled dependencies | |
: # like h5py or mpi4py if changing HDF5/MPI libraries. | |
pip cache remove petsc4py | |
pip install --verbose --no-binary h5py ./repo[test] | |
firedrake-clean | |
: # Extra test dependencies | |
pip install ipympl pytest-split pytest-timeout pytest-xdist | |
pip list | |
- name: Run tests (nprocs = 1) | |
run: | | |
. venv/bin/activate | |
: # Use pytest-xdist here so we can have a single collated output (not possible | |
: # for parallel tests) | |
firedrake-run-split-tests 1 1 "-n 12 $EXTRA_PYTEST_ARGS --junit-xml=firedrake1_{#}.xml" | |
timeout-minutes: 45 | |
- name: Run tests (nprocs = 2) | |
# Run even if earlier tests failed | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 2 6 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake2_{#}.xml" | |
timeout-minutes: 15 | |
- name: Run tests (nprocs = 3) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 3 4 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake3_{#}.xml" | |
timeout-minutes: 30 | |
- name: Run tests (nprocs = 4) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 4 3 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake4_{#}.xml" | |
timeout-minutes: 10 | |
- name: Run tests (nprocs = 5) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 5 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake5_{#}.xml" | |
timeout-minutes: 10 | |
- name: Run tests (nprocs = 6) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 6 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake6_{#}.xml" | |
timeout-minutes: 10 | |
- name: Run tests (nprocs = 7) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 7 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake7_{#}.xml" | |
timeout-minutes: 10 | |
- name: Run tests (nprocs = 8) | |
if: ${{ success() || steps.install.conclusion == 'success' }} | |
run: | | |
. venv/bin/activate | |
firedrake-run-split-tests 8 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake8_{#}.xml" | |
timeout-minutes: 10 | |
- name: Run Gusto smoke tests | |
# Only test Gusto in real mode | |
if: (success() || steps.install.conclusion == 'success') && matrix.arch == 'default' | |
run: | | |
. venv/bin/activate | |
git clone --depth 1 https://github.com/firedrakeproject/gusto.git gusto-repo --branch connorjward/pyproject-fixup | |
pip install --verbose ./gusto-repo | |
python -m pytest -n 12 --verbose \ | |
gusto-repo/integration-tests/balance/test_saturated_balance.py \ | |
gusto-repo/integration-tests/equations/test_thermal_sw.py \ | |
gusto-repo/integration-tests/transport/test_embedded_dg_advection.py | |
timeout-minutes: 10 | |
- name: Publish test report | |
uses: mikepenz/[email protected] | |
# To avoid permissions issues do not run with forked repos | |
# (see https://github.com/mikepenz/action-junit-report/issues/23) | |
if: | | |
(success() || steps.install.conclusion == 'success') | |
&& (github.ref != 'refs/heads/master') | |
&& (github.event.pull_request.head.repo.full_name == github.repository) | |
with: | |
report_paths: 'firedrake*.xml' | |
comment: true | |
check_name: "Firedrake ${{ matrix.arch }}" | |
updateComment: true | |
flaky_summary: true | |
- name: Upload log files | |
uses: actions/upload-artifact@v4 | |
if: success() || steps.install.conclusion == 'success' | |
with: | |
name: firedrake-logs-${{ matrix.arch }} | |
path: pytest_*.log | |
- name: Post-run cleanup | |
if: always() | |
run: find . -delete | |
docker_tag: | |
name: "Set the Docker release tag" | |
runs-on: [self-hosted, Linux] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Set release tag | |
# Set a release tag if triggered by monthly CRON job | |
if: github.event.schedule == '0 0 1 * *' | |
run: | | |
DATE_TAG="$(date +%Y-%m)" | |
echo "RELEASE_TAG=$DATE_TAG" >> "$GITHUB_ENV" | |
- name: Print release tag being used | |
run: | | |
echo The release tag is "$RELEASE_TAG" | |
outputs: | |
tag: ${{ env.RELEASE_TAG }} | |
docker: | |
name: "Build Docker containers" | |
# Only run on master, but always generate firedrake-env image, | |
# even if build fails (see docker.yml) | |
# if: always() && (github.ref == 'refs/heads/master') | |
# needs: [test, docker_tag] | |
uses: ./.github/workflows/docker.yml | |
with: | |
tag: pip | |
status: success | |
secrets: inherit |