Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/ci-approval-allowlist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
exempt:
- workflow: contributor-declaration.yml
- workflow: label-public-pr.yml
- workflow: notify-pull-request.yml
- workflow: pr-label-downstream-ci.yml
- workflow: old_CI.yml
reason: "legacy, retiring; gates downstream-ci with an if: rather than needs:"
48 changes: 30 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [develop, master]
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
types: [opened, reopened, synchronize, labeled]
workflow_dispatch:

concurrency:
Expand All @@ -30,8 +30,17 @@ jobs:
steps:
- uses: ecmwf/ci-infrastructure/actions/require-ci-approval@main

resolve:
pre-commit:
needs: ci-approval
runs-on: ubuntu-slim
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
steps:
- uses: actions/checkout@v6
- uses: ecmwf/ci-infrastructure/actions/pre-commit@main

resolve:
needs: [ci-approval, pre-commit]
runs-on: arc-runner-normal
container:
image: eccr.ecmwf.int/public-ci-images/ubuntu24.04-base:latest
Expand All @@ -47,9 +56,7 @@ jobs:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.number && format('refs/pull/{0}/merge', github.event.pull_request.number) || '' }}
- uses: ecmwf/ci-infrastructure/actions/checkout-under-test@main
- id: r
uses: ecmwf/ci-infrastructure/actions/resolve-deps@main
with:
Expand All @@ -61,7 +68,7 @@ jobs:

build:
needs: [ci-approval, resolve]
name: build+test (${{ matrix.platform }}, ${{ matrix.cxx-compiler }})
name: build+test (${{ matrix._resolved['job-name'] }})
runs-on: ${{ matrix['runs-on'] }}
container:
image: ${{ matrix.container || '' }}
Expand All @@ -77,9 +84,7 @@ jobs:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.number && format('refs/pull/{0}/merge', github.event.pull_request.number) || '' }}
- uses: ecmwf/ci-infrastructure/actions/checkout-under-test@main

- name: Fetch resolved deps
id: deps
Expand All @@ -96,11 +101,6 @@ jobs:
cxx-compiler: ${{ matrix.cxx-compiler }}
build-type: ${{ matrix.build-type }}

- name: Print dependency table
uses: ecmwf/ci-infrastructure/actions/print-dep-table@main
with:
resolved-json: ${{ toJSON(matrix._resolved) }}

# Invocation comes from .ci/manifest.toml's [matrix.build], the same place
# the generated cross-repo-trigger.yml renders its Test step from. Spelling
# it out again here is how the two lanes drift apart.
Expand All @@ -114,9 +114,15 @@ jobs:
install-path: ${{ steps.build.outputs.install-path }}
artifact-name: ${{ matrix._resolved.own-artifact-name }}

- name: Print dependency table
if: always()
uses: ecmwf/ci-infrastructure/actions/print-dep-table@main
with:
resolved: ${{ toJSON(matrix._resolved) }}

build-hpc:
needs: [ci-approval, resolve]
name: build-hpc (${{ matrix.platform }})
name: build-hpc (${{ matrix._resolved['job-name'] }})
runs-on: ${{ matrix['runs-on'] }}
container:
image: ${{ matrix.container }}
Expand All @@ -135,9 +141,7 @@ jobs:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.number && format('refs/pull/{0}/merge', github.event.pull_request.number) || '' }}
- uses: ecmwf/ci-infrastructure/actions/checkout-under-test@main

- name: Fetch resolved deps
id: deps
Expand All @@ -150,6 +154,7 @@ jobs:
install-python-deps: 'false'

- name: Build eckit on HPC
id: build
uses: ecmwf/ci-infrastructure/actions/build-on-hpc@main
with:
site: ${{ matrix.site }}
Expand All @@ -161,3 +166,10 @@ jobs:
work-dir: ${{ vars.HPC_CI_WORK_DIR }}
remote-work-dir: ${{ vars.HPC_CI_REMOTE_WORK_DIR }}
troika-user: ${{ secrets.HPC_CI_SSH_USER }}

- name: Print dependency table
if: always()
uses: ecmwf/ci-infrastructure/actions/print-dep-table@main
with:
resolved: ${{ toJSON(matrix._resolved) }}
own-source: ${{ steps.build.outputs.cache-hit == 'true' && 'artifact' || 'built' }}
14 changes: 9 additions & 5 deletions .github/workflows/contributor-declaration.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Contributor Declaration

on:
# pull_request_target runs the BASE branch's copy of this file, so a pull
# request cannot edit the gate that judges it. Safe here because nothing from
# the pull request is ever checked out or executed and no write token is used.
pull_request_target:
types: [opened, edited, reopened, synchronize]
# Parked: run it by hand only, until the declaration check comes back. To
# restore, put back the trigger below -- pull_request_target runs the BASE
# branch's copy of this file, so a pull request cannot edit the gate that
# judges it, and it is safe here because nothing from the pull request is ever
# checked out or executed and no write token is used.
#
# pull_request_target:
# types: [opened, edited, reopened, synchronize]
workflow_dispatch:

permissions:
contents: read
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cross-repo-trigger-hpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
needs:
- resolve
if: contains(fromJSON(inputs.from-jobs), 'ecbuild/build-hpc') || contains(fromJSON(inputs.from-jobs), 'stack-deps/build-hpc') || inputs.rebuild-request
name: eckit/build-hpc (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build-hpc (${{ matrix._resolved['job-name'] }})
runs-on: ${{ matrix['runs-on'] }}
container:
image: ${{ matrix.container || '' }}
Expand All @@ -139,7 +139,7 @@ jobs:
token: ${{ steps.mint.outputs.token }}
head-repo: ${{ inputs.from-repo }}
head-sha: ${{ inputs.from-sha }}
name: eckit/build-hpc (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build-hpc (${{ matrix._resolved['job-name'] }})
details-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
phase: start
- name: Announce image
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
token: ${{ steps.mint.outputs.token }}
head-repo: ${{ inputs.from-repo }}
head-sha: ${{ inputs.from-sha }}
name: eckit/build-hpc (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build-hpc (${{ matrix._resolved['job-name'] }})
details-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
phase: finish
conclusion: ${{ job.status }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cross-repo-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
needs:
- resolve
if: contains(fromJSON(inputs.from-jobs), 'ecbuild/build') || contains(fromJSON(inputs.from-jobs), 'stack-deps/build') || inputs.rebuild-request
name: eckit/build (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build (${{ matrix._resolved['job-name'] }})
runs-on: ${{ matrix['runs-on'] }}
container:
image: ${{ matrix.container || '' }}
Expand All @@ -136,7 +136,7 @@ jobs:
token: ${{ steps.mint.outputs.token }}
head-repo: ${{ inputs.from-repo }}
head-sha: ${{ inputs.from-sha }}
name: eckit/build (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build (${{ matrix._resolved['job-name'] }})
details-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
phase: start
- name: Announce image
Expand Down Expand Up @@ -205,7 +205,7 @@ jobs:
token: ${{ steps.mint.outputs.token }}
head-repo: ${{ inputs.from-repo }}
head-sha: ${{ inputs.from-sha }}
name: eckit/build (${{ matrix.platform }}, ${{ matrix['cxx-compiler'] }})
name: eckit/build (${{ matrix._resolved['job-name'] }})
details-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
phase: finish
conclusion: ${{ job.status }}
Expand Down
87 changes: 46 additions & 41 deletions .github/workflows/trigger-downstream-hpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,37 @@ concurrency:
group: trigger-downstream-hpc-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
jobs:
context:
runs-on: ubuntu-slim
permissions:
actions: read
outputs:
head-sha: ${{ steps.ctx.outputs.head-sha }}
head-branch: ${{ steps.ctx.outputs.head-branch }}
ci-conclusion: ${{ steps.ctx.outputs.ci-conclusion }}
ci-url: ${{ steps.ctx.outputs.ci-url }}
ci-summary: ${{ steps.ctx.outputs.ci-summary }}
steps:
- name: Resolve the commit under test
id: ctx
uses: ecmwf/ci-infrastructure/actions/resolve-dispatch-context@main
label-gate:
runs-on: ubuntu-slim
permissions:
pull-requests: read
outputs:
run: ${{ steps.gate.outputs.run }}
steps:
- id: mint
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Check the downstream-CI label
id: gate
uses: ecmwf/ci-infrastructure/actions/check-pr-label@main
with:
label: run-downstream-CI
sha: ${{ github.event.workflow_run.head_sha }}
token: ${{ steps.mint.outputs.token }}
sha: ${{ needs.context.outputs.head-sha }}
needs:
- context
validate:
if: ${{ (github.event.workflow_run.conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
if: ${{ (needs.context.outputs.ci-conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
runs-on: ubuntu-slim
steps:
- id: mint
Expand All @@ -42,88 +53,82 @@ jobs:
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
ref: ${{ needs.context.outputs.head-sha }}
token: ${{ steps.mint.outputs.token }}
allow-unsafe-pr-checkout: true
- uses: ecmwf/ci-infrastructure/actions/validate-generated-workflows@main
with:
token: ${{ steps.mint.outputs.token }}
needs:
- context
- label-gate
report-start:
if: ${{ (github.event.workflow_run.conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
if: ${{ (needs.context.outputs.ci-conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
runs-on: ubuntu-slim
permissions:
statuses: write
steps:
- id: mint
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Post pending downstream status
env:
GH_TOKEN: ${{ steps.mint.outputs.token }}
GH_TOKEN: ${{ github.token }}
run: |
gh api -X POST \
"/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }}" \
"/repos/${{ github.repository }}/statuses/${{ needs.context.outputs.head-sha }}" \
-f state=pending \
-f context='downstream/hpc' \
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
-f description='Downstream HPC tests running'
needs:
- context
- label-gate
report-ci-failure:
if: ${{ (github.event.workflow_run.conclusion != 'success') && needs['label-gate'].outputs.run == 'true' }}
if: ${{ (needs.context.outputs.ci-conclusion != 'success') && needs['label-gate'].outputs.run == 'true' }}
runs-on: ubuntu-slim
permissions:
statuses: write
steps:
- id: mint
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Post downstream failure status
env:
GH_TOKEN: ${{ steps.mint.outputs.token }}
GH_TOKEN: ${{ github.token }}
run: |
gh api -X POST \
"/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }}" \
"/repos/${{ github.repository }}/statuses/${{ needs.context.outputs.head-sha }}" \
-f state=failure \
-f context='downstream/hpc' \
-f target_url="${{ github.event.workflow_run.html_url }}" \
-f description='Upstream CI failed; downstream HPC not run'
-f target_url="${{ needs.context.outputs.ci-url }}" \
-f description="${{ needs.context.outputs.ci-summary }}; downstream HPC not run"
needs:
- context
- label-gate
eccodes:
name: eccodes
needs:
- context
- label-gate
- validate
uses: ecmwf/eccodes/.github/workflows/cross-repo-trigger-hpc.yml@develop
with:
from-repo: ${{ github.repository }}
from-sha: ${{ github.event.workflow_run.head_sha }}
from-sha: ${{ needs.context.outputs.head-sha }}
from-jobs: '["eckit/build-hpc"]'
branch: ${{ github.event.workflow_run.head_branch }}
branch: ${{ needs.context.outputs.head-branch }}
fallback-ref: develop
secrets: inherit
if: ${{ needs['label-gate'].outputs.run == 'true' }}
report-result:
needs:
- context
- label-gate
- validate
- eccodes
if: ${{ (always() && github.event.workflow_run.conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
if: ${{ (always() && needs.context.outputs.ci-conclusion == 'success') && needs['label-gate'].outputs.run == 'true' }}
runs-on: ubuntu-slim
permissions:
statuses: write
steps:
- id: mint
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.CI_PERMISSIONS_APP_CLIENT_ID }}
private-key: ${{ secrets.CI_PERMISSIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Post final downstream status
env:
GH_TOKEN: ${{ steps.mint.outputs.token }}
GH_TOKEN: ${{ github.token }}
run: |
state=success
for r in ${{ needs.validate.result }} ${{ needs.eccodes.result }}; do
Expand All @@ -132,7 +137,7 @@ jobs:
fi
done
gh api -X POST \
"/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }}" \
"/repos/${{ github.repository }}/statuses/${{ needs.context.outputs.head-sha }}" \
-f state="$state" \
-f context='downstream/hpc' \
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
Expand Down
Loading
Loading