diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d84bca0c..4a2be788 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,153 +2,62 @@ name: Run tests # I stole this from the main firedrake repo on: - # Run on pushes to main - push: - branches: - - main - # And all pull requests - # cd /opt/firedrake/ - # git fetch - # git checkout indiamai/fuse-closures-with-pyop3 - # git pull - pull_request: +# # Run on pushes to main + push: + branches: + - main +# # And all pull requests + pull_request: + +concurrency: + # Cancel running jobs if new commits are pushed + group: > + ${{ github.workflow }}- + ${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + OMP_NUM_THREADS: 1 + OPENBLAS_NUM_THREADS: 1 + PYTEST_MPI_MAX_NPROCS: 8 + PYOP2_SPMD_STRICT: 1 + FIREDRAKE_CI: 1 + FIREDRAKE_USE_FUSE: 1 + # NOTE: One should occasionally update test_durations.json by running + # 'make test_durations' inside a 'firedrake:latest' Docker image. + EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=600 --timeout-method=thread -o faulthandler_timeout=660 + jobs: test: - name: Run tests - 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] + name: Test runs-on: [self-hosted, Linux] container: image: ubuntu:latest env: - OMPI_ALLOW_RUN_AS_ROOT: 1 - OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 - OMP_NUM_THREADS: 1 - OPENBLAS_NUM_THREADS: 1 - FIREDRAKE_CI: 1 - PYOP2_SPMD_STRICT: 1 - EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=600 --timeout-method=thread -o faulthandler_timeout=660 --durations-path=./fuse-repo/test/test_durations.json --durations=50 - PYTEST_MPI_MAX_NPROCS: 8 - FIREDRAKE_USE_FUSE: 1 + # Disable some compiler optimisations as they cause runner-specific bugs + PYOP2_CFLAGS: -O1 -fno-fast-math steps: - - name: Fix HOME - # For unknown reasons GitHub actions overwrite HOME to /github/home - # which will break everything unless fixed - # (https://github.com/actions/runner/issues/863) - run: echo "HOME=/root" >> "$GITHUB_ENV" - - name: Pre-run cleanup # Make sure the current directory is empty run: find . -delete - # Use a different mirror to fetch apt packages from to get around - # temporary outage. - # (https://askubuntu.com/questions/1549622/problem-with-archive-ubuntu-com-most-of-the-servers-are-not-responding) - # The mirror was chosen from https://launchpad.net/ubuntu/+archivemirrors. - - name: Configure apt - run: | - sed -i 's|http://archive.ubuntu.com/ubuntu|http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources - apt-get update - - # Git is needed for actions/checkout and Python for firedrake-configure - - name: Install system dependencies (1) - run: apt-get -y install git python3 - - uses: actions/checkout@v5 with: repository: firedrakeproject/firedrake path: firedrake-repo ref: refs/heads/connorjward/pyop3-develop - - name: Validate single source of truth - run: ./firedrake-repo/scripts/check-config - - # Check that the Dockerfile is using the latest Ubuntu version. - # The version is hardcoded into the Dockerfile so that the OS - # for each release is fixed. - - name: Check Dockerfile Ubuntu version - run: | - latest_version=$(grep "VERSION_ID=" /etc/os-release | cut -d '"' -f 2) - docker_version=$(grep FROM firedrake-repo/docker/Dockerfile.vanilla | cut -d ':' -f 2) - echo "Latest version: $latest_version" - echo "Docker version: $docker_version" - if [[ "$docker_version" != "$latest_version" ]]; then - echo "Ubuntu version ${docker_version} in Dockerfile is out of date with latest version ${latest_version}" - exit 1 - fi - - - name: Install system dependencies (2) - run: | - apt-get -y install \ - $(python3 ./firedrake-repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-packages) - apt-get -y install python3-venv - : # Dependencies needed to run the test suite - apt-get -y install fonts-dejavu graphviz graphviz-dev parallel poppler-utils - - - name: Install PETSc - run: | - git clone --depth 1 https://gitlab.com/petsc/petsc.git - cd petsc - python3 ../firedrake-repo/scripts/firedrake-configure \ - --arch ${{ matrix.arch }} --show-petsc-configure-options | \ - xargs -L1 ./configure --with-make-np=8 --download-slepc - make PETSC_DIR=/__w/fuse/fuse/petsc PETSC_ARCH=arch-firedrake-${{ matrix.arch }} - make check - { - echo "PETSC_DIR=/__w/fuse/fuse/petsc" - echo "PETSC_ARCH=arch-firedrake-${{ matrix.arch }}" - echo "SLEPC_DIR=/__w/fuse/fuse/petsc/arch-firedrake-${{ matrix.arch }}" - } >> "$GITHUB_ENV" - - 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 - - : # Empty the pip cache to ensure that everything is compiled from scratch - pip cache purge - - : # Fix for petsc4py+slepc4py build - echo 'setuptools<81' > constraints.txt - export PIP_CONSTRAINT=constraints.txt - - : # Install build dependencies - pip install "$PETSC_DIR"/src/binding/petsc4py - pip install -r ./firedrake-repo/requirements-build.txt - - : # Install runtime dependencies that have been removed from the pyproject.toml - : # because they rely on non-PyPI versions of petsc4py. - pip install --no-build-isolation --no-deps \ - "$PETSC_DIR"/"$PETSC_ARCH"/externalpackages/git.slepc/src/binding/slepc4py - pip install --no-deps git+https://github.com/NGSolve/ngsPETSc.git netgen-mesher netgen-occt - - : # We have to pass '--no-build-isolation' to use a custom petsc4py - EXTRA_BUILD_ARGS='--no-isolation' - EXTRA_PIP_FLAGS='--no-build-isolation' - - : # Install from an sdist so we can make sure that it is not ill-formed - : # pip install build - : # python -m build ./firedrake-repo --sdist $EXTRA_BUILD_ARGS - - : #pip install --verbose $EXTRA_PIP_FLAGS \ - : # --no-binary h5py \ - : # --extra-index-url https://download.pytorch.org/whl/cpu \ - : # "$(echo ./firedrake-repo/dist/firedrake-*.tar.gz)[ci]" - - pip install --verbose $EXTRA_PIP_FLAGS \ - --no-binary h5py \ - --extra-index-url https://download.pytorch.org/whl/cpu \ - -e ./firedrake-repo[ci] - - firedrake-clean - pip list + uses: ./firedrake-repo/.github/actions/install + with: + os: linux + source_ref: refs/heads/connorjward/pyop3-develop + base_ref: main + deps: ci - uses: actions/checkout@v5 with: