Skip to content

Commit 1595b68

Browse files
Add Docker build workflow on release (#170)
Closes #156. This PR sets up a separate workflow for building and pushing a Docker build for the `release` branch. It passes `--build-arg BRANCH=release` to the Firedrake Docker build. It's triggered on updates to the workflow and on a monthly basis. --------- Co-authored-by: Stephan Kramer <s.kramer@imperial.ac.uk>
1 parent a769269 commit 1595b68

6 files changed

Lines changed: 97 additions & 17 deletions

File tree

.github/workflows/docker_firedrake-parmmg.yml renamed to .github/workflows/docker_firedrake-parmmg_main.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
name: Build Firedrake Docker container with (Par)Mmg
1+
name: Build Firedrake Docker container with (Par)Mmg (main)
22

33
on:
44
# Check that Docker build succeeds when these files get changed in an open PR
55
pull_request:
66
paths:
77
- '.github/workflows/reusable_docker_build.yml'
8-
- '.github/workflows/docker_firedrake-parmmg.yml'
9-
- '.github/workflows/reusable_test_suite.yml'
8+
- '.github/workflows/docker_firedrake-parmmg_main.yml'
109
- 'docker/Dockerfile.firedrake-parmmg'
1110
- 'docker/Dockerfile.firedrake-um2n'
1211

@@ -16,8 +15,7 @@ on:
1615
- main
1716
paths:
1817
- '.github/workflows/reusable_docker_build.yml'
19-
- '.github/workflows/docker_firedrake-parmmg.yml'
20-
- '.github/workflows/reusable_test_suite.yml'
18+
- '.github/workflows/docker_firedrake-parmmg_main.yml'
2119
- 'docker/Dockerfile.firedrake-parmmg'
2220
- 'docker/Dockerfile.firedrake-um2n'
2321

@@ -41,10 +39,12 @@ jobs:
4139
packages: write
4240
uses: ./.github/workflows/reusable_docker_build.yml
4341
with:
44-
# use Dockerfile.vanilla from firedrake to build firedrake-parmmg-base image
45-
# which contains a build of petsc+firedrake with (Par)Mmg libraries included
42+
# use Dockerfile.vanilla from Firedrake to build firedrake-parmmg-base image
43+
# which contains a build of PETSc+Firedrake with (Par)Mmg libraries included
4644
dockerfile-repo: 'firedrakeproject/firedrake'
4745
dockerfile-path: 'docker/Dockerfile.vanilla'
46+
dockerfile-branch: 'main'
47+
firedrake-branch: 'main'
4848
docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg-base:latest'
4949
save-docker-image-artifact: 'firedrake-parmmg-base'
5050

@@ -57,6 +57,7 @@ jobs:
5757
# starting from firedrake-parmmg-base, build firedrake-parmmg image
5858
# which includes Animate, Movement, Goalie, and Thetis packages
5959
dockerfile-path: 'docker/Dockerfile.firedrake-parmmg'
60+
firedrake-branch: 'main'
6061
docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg:latest'
6162
load-docker-image-artifact: 'firedrake-parmmg-base'
6263
save-docker-image-artifact: 'firedrake-parmmg'
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Firedrake Docker container with (Par)Mmg (release)
2+
3+
on:
4+
# Check that Docker build succeeds when these files get changed in an open PR
5+
pull_request:
6+
paths:
7+
- '.github/workflows/reusable_docker_build.yml'
8+
- '.github/workflows/docker_firedrake-parmmg_release.yml'
9+
- 'docker/Dockerfile.firedrake-parmmg'
10+
- 'docker/Dockerfile.firedrake-um2n'
11+
12+
# Build and push the Docker container when these files get changed on the main branch
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- '.github/workflows/reusable_docker_build.yml'
18+
- '.github/workflows/docker_firedrake-parmmg_release.yml'
19+
- 'docker/Dockerfile.firedrake-parmmg'
20+
- 'docker/Dockerfile.firedrake-um2n'
21+
22+
# Run test suite at 1AM on the first of the month
23+
schedule:
24+
- cron: '0 1 1 * *'
25+
26+
# Manually trigger the workflow
27+
workflow_dispatch:
28+
29+
permissions: {}
30+
31+
# Stop the workflow if a new run is requested
32+
concurrency:
33+
group: $${{ github.workflow }}-${{ github.ref }}
34+
cancel-in-progress: true
35+
36+
jobs:
37+
docker_base:
38+
permissions:
39+
packages: write
40+
uses: ./.github/workflows/reusable_docker_build.yml
41+
with:
42+
# use Dockerfile.vanilla from Firedrake to build firedrake-parmmg-base image
43+
# which contains a build of PETSc+Firedrake with (Par)Mmg libraries included
44+
dockerfile-repo: 'firedrakeproject/firedrake'
45+
dockerfile-path: 'docker/Dockerfile.vanilla'
46+
dockerfile-branch: 'release'
47+
firedrake-branch: 'release'
48+
docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg-base:release'
49+
save-docker-image-artifact: 'firedrake-parmmg-base-release'
50+
51+
docker_parmmg:
52+
permissions:
53+
packages: write
54+
uses: ./.github/workflows/reusable_docker_build.yml
55+
needs: docker_base
56+
with:
57+
# starting from firedrake-parmmg-base, build firedrake-parmmg image
58+
# which includes Animate, Movement, Goalie, and Thetis packages
59+
dockerfile-path: 'docker/Dockerfile.firedrake-parmmg'
60+
firedrake-branch: 'release'
61+
docker-image-tag: 'ghcr.io/mesh-adaptation/firedrake-parmmg:release'
62+
load-docker-image-artifact: 'firedrake-parmmg-base-release'

.github/workflows/reusable_docker_build.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ on:
88
default: ${{ github.repository }}
99
required: false
1010
type: string
11+
dockerfile-branch:
12+
description: 'Branch of repo containing Dockerfile'
13+
required: false
14+
default: ${{ github.head_ref }}
15+
type: string
16+
firedrake-branch:
17+
description: 'Branch to pass as the BRANCH build argument when building the Docker container'
18+
required: false
19+
default: ${{ github.head_ref }}
20+
type: string
1121
dockerfile-path:
1222
description: 'Path to the Dockerfile to be built'
1323
required: true
@@ -41,6 +51,7 @@ jobs:
4151
with:
4252
persist-credentials: false
4353
repository: ${{ inputs.dockerfile-repo }}
54+
ref: ${{ inputs.dockerfile-branch }}
4455
sparse-checkout: ${{ inputs.dockerfile-path }}
4556
sparse-checkout-cone-mode: false
4657
path: .
@@ -55,7 +66,7 @@ jobs:
5566
- name: Load previously built Docker image
5667
if: ${{ inputs.load-docker-image-artifact != null }}
5768
run: |
58-
if [[ ! "${{ inputs.load-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,11}$ ]]; then
69+
if [[ ! "${{ inputs.load-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,19}$ ]]; then
5970
echo "Invalid input for load-docker-image-artifact"
6071
exit 1
6172
fi
@@ -90,13 +101,13 @@ jobs:
90101
tags: ${{ inputs.docker-image-tag }}
91102
build-args: |
92103
ARCH=default
93-
BRANCH=main
104+
BRANCH=${{ inputs.firedrake-branch }}
94105
PETSC_EXTRA_ARGS=--download-eigen --download-metis --download-parmetis --download-mmg --download-parmmg --download-ptscotch
95106
96107
- name: Save Docker image
97108
if: ${{ inputs.save-docker-image-artifact != null }}
98109
run: |
99-
if [[ ! "${{ inputs.save-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,11}$ ]]; then
110+
if [[ ! "${{ inputs.save-docker-image-artifact }}" =~ ^firedrake-[a-z-]{1,19}$ ]]; then
100111
echo "Invalid input for save-docker-image-artifact"
101112
exit 1
102113
fi

.github/workflows/reusable_test_suite.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
docker-image:
77
description: 'Name of the Firedrake Docker image to use'
88
required: false
9-
default: 'firedrake-parmmg'
9+
default: 'firedrake-parmmg:latest'
1010
type: string
1111

1212
concurrency:
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
timeout-minutes: 20
2222
container:
23-
image: ghcr.io/mesh-adaptation/${{ inputs.docker-image }}:latest
23+
image: ghcr.io/mesh-adaptation/${{ inputs.docker-image }}
2424
options: --user root
2525
env:
2626
# Name of the repository that triggered the workflow

docker/Dockerfile.firedrake-parmmg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# and with the main mesh-adaptation packages installed in /root
33
FROM ghcr.io/mesh-adaptation/firedrake-parmmg-base:latest
44

5+
# Which branch is to be used across all repositories?
6+
ARG BRANCH="main"
7+
58
WORKDIR /root
69

710
# Install Thetis
@@ -12,6 +15,9 @@ RUN git clone https://github.com/mesh-adaptation/adapt_common.git && \
1215
git clone https://github.com/mesh-adaptation/animate.git && \
1316
git clone https://github.com/mesh-adaptation/movement.git && \
1417
git clone https://github.com/mesh-adaptation/goalie.git && \
18+
cd animate && git checkout ${BRANCH} && cd .. && \
19+
cd movement && git checkout ${BRANCH} && cd .. && \
20+
cd goalie && git checkout ${BRANCH} && cd .. && \
1521
cd animate && git submodule init && git submodule update && cd .. && \
1622
cd movement && git submodule init && git submodule update && cd .. && \
1723
pip install -e adapt_common[dev] && \

zizmor.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ rules:
22
template-injection:
33
ignore:
44
# Ignore template injection in cases where we manually check inputs
5-
- reusable_docker_build.yml:56
6-
- reusable_docker_build.yml:60
7-
- reusable_docker_build.yml:63
8-
- reusable_docker_build.yml:104
9-
- reusable_docker_build.yml:109
5+
- reusable_docker_build.yml:69
6+
- reusable_docker_build.yml:73
7+
- reusable_docker_build.yml:74
8+
- reusable_docker_build.yml:110
9+
- reusable_docker_build.yml:115
1010
unpinned-images:
1111
ignore:
1212
# Ignore unpinned images for trusted Docker images

0 commit comments

Comments
 (0)