pip install firedrake #913
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: Install and test Firedrake (macOS) | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# By default this workflow is run on the "opened", "synchronize" and | |
# "reopened" events. We add "labelled" so it will run if the PR is given a label. | |
types: [opened, synchronize, reopened, labeled] | |
concurrency: | |
# Cancels jobs running if new commits are pushed | |
group: > | |
${{ github.workflow }}- | |
${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build Firedrake (macOS) | |
runs-on: [self-hosted, macOS] | |
# Only run this action if we are pushing to master or the PR is labelled "macOS" | |
if: ${{ (github.ref == 'refs/heads/master') || contains(github.event.pull_request.labels.*.name, 'macOS') }} | |
env: | |
FIREDRAKE_CI: 1 | |
OMP_NUM_THREADS: 1 | |
OPENBLAS_NUM_THREADS: 1 | |
steps: | |
- name: Add homebrew to PATH | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path | |
run: echo "/opt/homebrew/bin" >> "$GITHUB_PATH" | |
- 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: | | |
brew install $(python3 ./firedrake-repo/scripts/firedrake-configure --arch default --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 default --show-petsc-configure-options) \ | |
--with-make-np=4 | |
make | |
make check | |
- name: Install Firedrake | |
id: install | |
run: | | |
export $(python3 ./firedrake-repo/scripts/firedrake-configure --arch default --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 | |
# TODO: We currently have to do an editable install because | |
# 'make -C firedrake-repo check' looks inside the firedrake subfolder | |
# for the compiled code, when it would in fact be inside $VIRTUAL_ENV/lib. | |
pip install --verbose --no-binary h5py --editable './firedrake-repo[test]' | |
firedrake-clean | |
: # Extra test dependencies | |
pip install pytest-timeout | |
pip list | |
- name: Run smoke tests | |
run: | | |
. venv/bin/activate | |
make -C firedrake-repo check CHECK_PYTEST_ARGS="--timeout 60" | |
timeout-minutes: 10 | |
- name: Post-run cleanup | |
if: always() | |
run: | | |
find . -delete |