Skip to content

pip install firedrake #7145

pip install firedrake

pip install firedrake #7145

Workflow file for this run

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:
FIREDRAKE_CI: 1
PYOP2_CI_TESTS: 1
PYOP2_SPMD_STRICT: 1
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=600 --timeout-method=thread -o faulthandler_timeout=660 firedrake-repo/tests/firedrake
steps:
- name: Pre-run cleanup
# Make sure the current directory is empty
run: find . -delete
- uses: actions/checkout@v4
with:
path: firedrake-repo
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get -y install \
$(python3 ./firedrake-repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-packages)
- name: Install PETSc
run: |
git clone https://github.com/firedrakeproject/petsc.git
cd petsc
./configure \
$(python3 ../firedrake-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 $(python3 ./firedrake-repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-env)
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 './firedrake-repo[ci]'
firedrake-clean
: # Extra test dependencies
pip install --extra-index-url https://download.pytorch.org/whl/cpu \
jax matplotlib ngsPETSc torch vtk
pip list
- name: Run firedrake-check
run: |
. venv/bin/activate
firedrake-check
timeout-minutes: 5
- name: Run tests (nprocs = 1)
# Run even if earlier tests failed
if: ${{ success() || steps.install.conclusion == 'success' }}
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: 60
- name: Run tests (nprocs = 2)
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: 30
- 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: 60
- 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: 15
- 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: 15
- 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: 15
- 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: 15
- 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: 15
- 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
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
lint:
name: Lint codebase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Install linting packages
run: pip install flake8 pylint
- name: Lint codebase
run: make lint GITHUB_ACTIONS_FORMATTING=1
zenodo_canary:
name: Run zenodo canary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install deps
run: pip install requests packaging
- name: Zenodo API canary
run: python scripts/firedrake-install --test-doi-resolution
- name: Upload log
uses: actions/upload-artifact@v4
if: failure()
with:
name: "zenodo-canary"
path: firedrake-install.log