From 687471c9d1acb5bda72c3d538d5bc8e541527aee Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Thu, 14 Nov 2024 17:25:55 +0000 Subject: [PATCH] Add a pip install workflow --- .github/workflows/pip.yml | 104 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/workflows/pip.yml diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml new file mode 100644 index 0000000000..076b469218 --- /dev/null +++ b/.github/workflows/pip.yml @@ -0,0 +1,104 @@ +name: Pip install Firedrake + +on: + # Push to master or PR + push: + branches: + - master + pull_request: + +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" + # Run on our self-hosted machines + runs-on: ubuntu-latest + container: + image: firedrakeproject/firedrake-env:latest + strategy: + # Don't immediately kill real if complex fails and vice versa. + fail-fast: false + matrix: + include: + - scalar-type: real + petsc_arch: default + - scalar-type: complex + petsc_arch: complex + env: + # PETSC_DIR, HDF5_DIR and MPICH_DIR are set inside the docker image + FIREDRAKE_CI_TESTS: 1 + PYOP2_CI_TESTS: 1 + PETSC_ARCH: ${{ matrix.petsc_arch }} + OMP_NUM_THREADS: 1 + OPENBLAS_NUM_THREADS: 1 + RDMAV_FORK_SAFE: 1 + steps: + - name: Cleanup + if: ${{ always() }} + run: rm -rf pip_venv + + - name: Create a venv + run: python -m venv pip_venv + + - uses: actions/checkout@v4 + with: + path: pip_venv/src/firedrake + + - name: Pip install + run: | + source pip_venv/bin/activate + cd pip_venv/src + export CC="$MPICH_DIR/mpicc" + export CXX="$MPICH_DIR/mpicxx" + export MPICC="$MPICH_DIR/mpicc" + pip install \ + --log=firedrake-install.log \ + --no-binary mpi4py,h5py \ + -v -e './firedrake[test]' + + - name: Add mpiexec to the venv + run: | + source pip_venv/bin/activate + cat << EOF > $VIRTUAL_ENV/bin/mpiexec + #!/bin/bash + $MPICH_DIR/mpiexec "\$@" + EOF + chmod +x $VIRTUAL_ENV/bin/mpiexec + + - name: Test Firedrake + run: | + source pip_venv/bin/activate + cd pip_venv/src/firedrake + echo OMP_NUM_THREADS is "$OMP_NUM_THREADS" + echo OPENBLAS_NUM_THREADS is "$OPENBLAS_NUM_THREADS" + pytest -v tests/firedrake/test_0init.py + pytest \ + --durations=200 \ + --timeout=1800 \ + --timeout-method=thread \ + -o faulthandler_timeout=1860 \ + -n 12 --dist worksteal \ + --junit-xml=firedrake.xml \ + -sv tests + timeout-minutes: 120 + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v5.0.0-a02 + if: ${{ always() && ( github.ref != 'refs/heads/master') }} + with: + report_paths: '/__w/firedrake/pip_venv/src/firedrake/firedrake.xml' + comment: true + check_name: "Firedrake ${{ matrix.scalar-type }}" + updateComment: true + flaky_summary: true + + - name: Cleanup + # Belt and braces: clean up before and after the run. + if: ${{ always() }} + run: rm -rf pip_venv