From 4d63e4ae15210bc0ec994ae4578785598d477cd0 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 18 May 2026 10:39:08 +0100 Subject: [PATCH 1/3] Enable setting the base for a PR using labels Helpful for multi-PR changes. --- .github/workflows/core.yml | 26 +++++++++++++------------- .github/workflows/pr.yml | 11 ++++++++++- .github/workflows/push.yml | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 86515d1ac9..4a8eb4eb81 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -7,8 +7,8 @@ on: description: The input Git ref to checkout type: string required: true - target_branch: - description: The target branch (usually 'main' or 'release') + base_ref: + description: The base branch ('main' or 'release') type: string required: true build_docs: @@ -34,8 +34,8 @@ on: description: The input Git ref to checkout type: string required: true - target_branch: - description: The target branch (usually 'main' or 'release') + base_ref: + description: The base branch ('main' or 'release') type: string required: true build_docs: @@ -108,7 +108,7 @@ jobs: with: os: linux source_ref: ${{ inputs.source_ref }} - base_ref: ${{ inputs.target_branch }} + base_ref: ${{ inputs.base_ref }} scalar_type: ${{ matrix.arch }} deps: ci @@ -200,7 +200,7 @@ jobs: matrix.arch == 'default' run: | . venv/bin/activate - if [ ${{ inputs.target_branch }} = 'release' ]; then + if [ ${{ inputs.base_ref }} = 'release' ]; then GUSTO_BRANCH='main' else GUSTO_BRANCH='future' @@ -219,7 +219,7 @@ jobs: matrix.arch == 'default' run: | . venv/bin/activate - git clone --depth 1 https://github.com/thetisproject/thetis.git thetis-repo --branch ${{ inputs.target_branch }} + git clone --depth 1 https://github.com/thetisproject/thetis.git thetis-repo --branch ${{ inputs.base_ref }} pip install --verbose ./thetis-repo python -m pytest -n 8 --verbose thetis-repo/test_adjoint/test_swe_adjoint.py timeout-minutes: 10 @@ -241,7 +241,7 @@ jobs: matrix.arch == 'default' run: | . venv/bin/activate - git clone --depth 1 https://github.com/g-adopt/g-adopt.git g-adopt-repo --branch ${{ inputs.target_branch }} + git clone --depth 1 https://github.com/g-adopt/g-adopt.git g-adopt-repo --branch ${{ inputs.base_ref }} pip install --verbose ./g-adopt-repo make -C g-adopt-repo/demos/mantle_convection/base_case check timeout-minutes: 5 @@ -281,7 +281,7 @@ jobs: with: os: macos source_ref: ${{ inputs.source_ref }} - base_ref: ${{ inputs.target_branch }} + base_ref: ${{ inputs.base_ref }} deps: check - name: Post-run cleanup @@ -326,7 +326,7 @@ jobs: with: os: linux source_ref: ${{ inputs.source_ref }} - base_ref: ${{ inputs.target_branch }} + base_ref: ${{ inputs.base_ref }} gpu: cuda deps: check @@ -394,7 +394,7 @@ jobs: name: Build documentation runs-on: [self-hosted, Linux] container: - image: firedrakeproject/firedrake-vanilla-default:dev-${{ inputs.target_branch }} + image: firedrakeproject/firedrake-vanilla-default:dev-${{ inputs.base_ref }} outputs: conclusion: ${{ steps.report_docs.outputs.conclusion }} steps: @@ -421,7 +421,7 @@ jobs: id: build_docs working-directory: firedrake-repo/docs run: | - make SPHINXOPTS="-t ${{ inputs.target_branch }}" html + make SPHINXOPTS="-t ${{ inputs.base_ref }}" html make latex make latexpdf # : Copy manual to HTML tree @@ -476,7 +476,7 @@ jobs: if: | always() && inputs.deploy_website && - inputs.target_branch == 'main' && + inputs.base_ref == 'main' && needs.build_docs.outputs.conclusion == 'success' permissions: pages: write diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4ea32ccce6..78263db94f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,7 +9,16 @@ jobs: uses: ./.github/workflows/core.yml with: source_ref: ${{ github.ref }} - target_branch: ${{ github.base_ref }} + # If not the actual target of the PR, the target branch ('main' or 'release') + # can be set with an appropriate label ('base:main' or 'base:release') + base_ref: |- + ${{ case( + github.base_ref == 'main', 'main', + github.base_ref == 'release', 'release', + contains(github.event.pull_request.labels.*.name, 'base:main'), 'main', + contains(github.event.pull_request.labels.*.name, 'base:release'), 'release', + 'INVALID_BASE_REF' + ) }} # Only run macOS tests if the PR is labelled 'macOS' test_macos: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }} # Only run GPU tests if the PR is labelled 'gpu' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6e17222d27..0b8e13419e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/core.yml with: source_ref: ${{ github.ref_name }} - target_branch: ${{ github.ref_name }} + base_ref: ${{ github.ref_name }} test_macos: true test_gpu: true deploy_website: true From 3ccaab7ef5aad58ce7ad3533107d5f9378cae161 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 18 May 2026 11:05:25 +0100 Subject: [PATCH 2/3] fixup --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 78263db94f..e4a140dcf2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,7 +2,7 @@ name: Test pull request on: pull_request: - types: [ opened, synchronize, reopened, labeled ] + types: [ opened, synchronize, reopened, labeled, unlabeled ] jobs: test: @@ -13,10 +13,10 @@ jobs: # can be set with an appropriate label ('base:main' or 'base:release') base_ref: |- ${{ case( - github.base_ref == 'main', 'main', - github.base_ref == 'release', 'release', contains(github.event.pull_request.labels.*.name, 'base:main'), 'main', contains(github.event.pull_request.labels.*.name, 'base:release'), 'release', + github.base_ref == 'main', 'main', + github.base_ref == 'release', 'release', 'INVALID_BASE_REF' ) }} # Only run macOS tests if the PR is labelled 'macOS' From fb189ec91d7068316cf443c1b0503e9dc5b7fafb Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Mon, 18 May 2026 11:48:37 +0100 Subject: [PATCH 3/3] empty