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..e4a140dcf2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,14 +2,23 @@ name: Test pull request on: pull_request: - types: [ opened, synchronize, reopened, labeled ] + types: [ opened, synchronize, reopened, labeled, unlabeled ] jobs: test: 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( + 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' 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