diff --git a/.github/workflows/docker_firedrake-parmmg.yml b/.github/workflows/docker_firedrake-parmmg_main.yml similarity index 84% rename from .github/workflows/docker_firedrake-parmmg.yml rename to .github/workflows/docker_firedrake-parmmg_main.yml index ae4d6b9..750ae06 100644 --- a/.github/workflows/docker_firedrake-parmmg.yml +++ b/.github/workflows/docker_firedrake-parmmg_main.yml @@ -1,12 +1,11 @@ -name: Build Firedrake Docker container with (Par)Mmg +name: Build Firedrake Docker container with (Par)Mmg (main) on: # Check that Docker build succeeds when these files get changed in an open PR pull_request: paths: - '.github/workflows/reusable_docker_build.yml' - - '.github/workflows/docker_firedrake-parmmg.yml' - - '.github/workflows/reusable_test_suite.yml' + - '.github/workflows/docker_firedrake-parmmg_main.yml' - 'docker/Dockerfile.firedrake-parmmg' - 'docker/Dockerfile.firedrake-um2n' @@ -16,8 +15,7 @@ on: - main paths: - '.github/workflows/reusable_docker_build.yml' - - '.github/workflows/docker_firedrake-parmmg.yml' - - '.github/workflows/reusable_test_suite.yml' + - '.github/workflows/docker_firedrake-parmmg_main.yml' - 'docker/Dockerfile.firedrake-parmmg' - 'docker/Dockerfile.firedrake-um2n' @@ -41,10 +39,12 @@ jobs: packages: write uses: ./.github/workflows/reusable_docker_build.yml with: - # use Dockerfile.vanilla from firedrake to build firedrake-parmmg-base image - # which contains a build of petsc+firedrake with (Par)Mmg libraries included + # use Dockerfile.vanilla from Firedrake to build firedrake-parmmg-base image + # which contains a build of PETSc+Firedrake with (Par)Mmg libraries included dockerfile-repo: 'firedrakeproject/firedrake' dockerfile-path: 'docker/Dockerfile.vanilla' + dockerfile-branch: 'main' + firedrake-branch: 'main' docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg-base:latest' save-docker-image-artifact: 'firedrake-parmmg-base' @@ -57,6 +57,7 @@ jobs: # starting from firedrake-parmmg-base, build firedrake-parmmg image # which includes Animate, Movement, Goalie, and Thetis packages dockerfile-path: 'docker/Dockerfile.firedrake-parmmg' + firedrake-branch: 'main' docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg:latest' load-docker-image-artifact: 'firedrake-parmmg-base' save-docker-image-artifact: 'firedrake-parmmg' diff --git a/.github/workflows/docker_firedrake-parmmg_release.yml b/.github/workflows/docker_firedrake-parmmg_release.yml new file mode 100644 index 0000000..14d1db9 --- /dev/null +++ b/.github/workflows/docker_firedrake-parmmg_release.yml @@ -0,0 +1,62 @@ +name: Build Firedrake Docker container with (Par)Mmg (release) + +on: + # Check that Docker build succeeds when these files get changed in an open PR + pull_request: + paths: + - '.github/workflows/reusable_docker_build.yml' + - '.github/workflows/docker_firedrake-parmmg_release.yml' + - 'docker/Dockerfile.firedrake-parmmg' + - 'docker/Dockerfile.firedrake-um2n' + + # Build and push the Docker container when these files get changed on the main branch + push: + branches: + - main + paths: + - '.github/workflows/reusable_docker_build.yml' + - '.github/workflows/docker_firedrake-parmmg_release.yml' + - 'docker/Dockerfile.firedrake-parmmg' + - 'docker/Dockerfile.firedrake-um2n' + + # Run test suite at 1AM on the first of the month + schedule: + - cron: '0 1 1 * *' + + # Manually trigger the workflow + workflow_dispatch: + +permissions: {} + +# Stop the workflow if a new run is requested +concurrency: + group: $${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + docker_base: + permissions: + packages: write + uses: ./.github/workflows/reusable_docker_build.yml + with: + # use Dockerfile.vanilla from Firedrake to build firedrake-parmmg-base image + # which contains a build of PETSc+Firedrake with (Par)Mmg libraries included + dockerfile-repo: 'firedrakeproject/firedrake' + dockerfile-path: 'docker/Dockerfile.vanilla' + dockerfile-branch: 'release' + firedrake-branch: 'release' + docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg-base:release' + save-docker-image-artifact: 'firedrake-parmmg-base-release' + + docker_parmmg: + permissions: + packages: write + uses: ./.github/workflows/reusable_docker_build.yml + needs: docker_base + with: + # starting from firedrake-parmmg-base, build firedrake-parmmg image + # which includes Animate, Movement, Goalie, and Thetis packages + dockerfile-path: 'docker/Dockerfile.firedrake-parmmg' + firedrake-branch: 'release' + docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg:release' + load-docker-image-artifact: 'firedrake-parmmg-base-release' diff --git a/.github/workflows/reusable_docker_build.yml b/.github/workflows/reusable_docker_build.yml index 52de499..f66e8c9 100644 --- a/.github/workflows/reusable_docker_build.yml +++ b/.github/workflows/reusable_docker_build.yml @@ -8,6 +8,16 @@ on: default: ${{ github.repository }} required: false type: string + dockerfile-branch: + description: 'Branch of repo containing Dockerfile' + required: false + default: ${{ github.head_ref }} + type: string + firedrake-branch: + description: 'Branch to pass as the BRANCH build argument when building the Docker container' + required: false + default: ${{ github.head_ref }} + type: string dockerfile-path: description: 'Path to the Dockerfile to be built' required: true @@ -41,6 +51,7 @@ jobs: with: persist-credentials: false repository: ${{ inputs.dockerfile-repo }} + ref: ${{ inputs.dockerfile-branch }} sparse-checkout: ${{ inputs.dockerfile-path }} sparse-checkout-cone-mode: false path: . @@ -55,7 +66,7 @@ jobs: - name: Load previously built Docker image if: ${{ inputs.load-docker-image-artifact != null }} run: | - if [[ ! "${{ inputs.load-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,11}$ ]]; then + if [[ ! "${{ inputs.load-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,19}$ ]]; then echo "Invalid input for load-docker-image-artifact" exit 1 fi @@ -90,13 +101,13 @@ jobs: tags: ${{ inputs.docker-image-tag }} build-args: | ARCH=default - BRANCH=main + BRANCH=${{ inputs.firedrake-branch }} PETSC_EXTRA_ARGS=--download-eigen --download-metis --download-parmetis --download-mmg --download-parmmg --download-ptscotch - name: Save Docker image if: ${{ inputs.save-docker-image-artifact != null }} run: | - if [[ ! "${{ inputs.save-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,11}$ ]]; then + if [[ ! "${{ inputs.save-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,19}$ ]]; then echo "Invalid input for save-docker-image-artifact" exit 1 fi diff --git a/.github/workflows/reusable_test_suite.yml b/.github/workflows/reusable_test_suite.yml index 0b0c1ca..7c0d470 100644 --- a/.github/workflows/reusable_test_suite.yml +++ b/.github/workflows/reusable_test_suite.yml @@ -6,7 +6,7 @@ on: docker-image: description: 'Name of the Firedrake Docker image to use' required: false - default: 'firedrake-parmmg' + default: 'firedrake-parmmg:latest' type: string concurrency: @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 container: - image: ghcr.io/mesh-adaptation/${{ inputs.docker-image }}:latest + image: ghcr.io/mesh-adaptation/${{ inputs.docker-image }} options: --user root env: # Name of the repository that triggered the workflow diff --git a/docker/Dockerfile.firedrake-parmmg b/docker/Dockerfile.firedrake-parmmg index 856aa00..0210779 100644 --- a/docker/Dockerfile.firedrake-parmmg +++ b/docker/Dockerfile.firedrake-parmmg @@ -2,6 +2,9 @@ # and with the main mesh-adaptation packages installed in /root FROM ghcr.io/mesh-adaptation/firedrake-parmmg-base:latest +# Which branch is to be used across all repositories? +ARG BRANCH="main" + WORKDIR /root # Install Thetis @@ -12,6 +15,9 @@ RUN git clone https://github.com/mesh-adaptation/adapt_common.git && \ git clone https://github.com/mesh-adaptation/animate.git && \ git clone https://github.com/mesh-adaptation/movement.git && \ git clone https://github.com/mesh-adaptation/goalie.git && \ + cd animate && git checkout ${BRANCH} && cd .. && \ + cd movement && git checkout ${BRANCH} && cd .. && \ + cd goalie && git checkout ${BRANCH} && cd .. && \ cd animate && git submodule init && git submodule update && cd .. && \ cd movement && git submodule init && git submodule update && cd .. && \ pip install -e adapt_common[dev] && \ diff --git a/zizmor.yml b/zizmor.yml index 5f2ed54..ab9f8ec 100644 --- a/zizmor.yml +++ b/zizmor.yml @@ -2,11 +2,11 @@ rules: template-injection: ignore: # Ignore template injection in cases where we manually check inputs - - reusable_docker_build.yml:56 - - reusable_docker_build.yml:60 - - reusable_docker_build.yml:63 - - reusable_docker_build.yml:104 - - reusable_docker_build.yml:109 + - reusable_docker_build.yml:69 + - reusable_docker_build.yml:73 + - reusable_docker_build.yml:74 + - reusable_docker_build.yml:110 + - reusable_docker_build.yml:115 unpinned-images: ignore: # Ignore unpinned images for trusted Docker images