Skip to content

Commit 0a2cbc4

Browse files
authored
Merge pull request #675 from control-toolbox/chore/149-label-dispatch
ci: label dispatch, a label starts its own workflow (CTActions#149)
2 parents f749295 + 1b402dc commit 0a2cbc4

4 files changed

Lines changed: 61 additions & 48 deletions

File tree

‎.github/workflows/Breakage.yml‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
name: Breakage
2+
run-name: "Breakage${{ inputs.pr && format(' #{0}', inputs.pr) || '' }}"
3+
4+
# On a pull request, a label starts its own run through Labels.yml
5+
# (CTActions docs/workflows/label-dispatch.md).
26

37
# The packages that depend on CTDirect, derived from the Project.toml files of the
48
# organization, tested against it; one report per run. On push to main and by hand, the
59
# run is the baseline the next release PR compares with (REL1); see
610
# CTActions docs/workflows/breakage-suite.md.
711

812
on:
9-
pull_request:
10-
types: [labeled, synchronize, reopened]
1113
push:
1214
branches: [main]
1315
workflow_dispatch:
16+
inputs:
17+
pr:
18+
description: 'Pull request number, set by label-dispatch.yml; empty by hand: the baseline run'
19+
required: false
20+
default: ''
21+
target:
22+
description: 'packages or applications'
23+
required: false
24+
default: ''
1425

1526
jobs:
1627
call:
17-
# A 'labeled' event fires once per label added, and re-evaluates against the PR's
18-
# *current* full label set — so adding several labels in a row would otherwise
19-
# re-run this job on every subsequent label add. Only react to 'labeled' when it's
20-
# this specific label; for other trigger types (synchronize/reopened), fall back to
21-
# checking the current label set as before. On push to main and by hand, always.
22-
if: >
23-
github.event_name != 'pull_request' ||
24-
(github.event.action == 'labeled' && github.event.label.name == 'run breakage') ||
25-
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run breakage'))
28+
if: inputs.pr == '' || inputs.target == 'packages'
2629
uses: control-toolbox/CTActions/.github/workflows/breakage-suite.yml@main
2730
with:
2831
use_ct_registry: true

‎.github/workflows/CI.yml‎

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
name: CI
2+
run-name: "CI ${{ inputs.target }}${{ inputs.pr && format(' #{0}', inputs.pr) || '' }}"
3+
4+
# On a pull request, a label starts its own run through Labels.yml
5+
# (CTActions docs/workflows/label-dispatch.md).
26

37
on:
48
push:
59
branches:
610
- main
711
tags: '*'
8-
pull_request:
9-
types: [labeled, synchronize, reopened]
12+
workflow_dispatch:
13+
inputs:
14+
pr:
15+
description: 'Pull request number, set by label-dispatch.yml'
16+
required: false
17+
default: ''
18+
target:
19+
description: 'github, occidata or kkt'
20+
required: false
21+
default: ''
1022

1123
jobs:
1224
# Job for GitHub-hosted runners (ubuntu, macos, windows)
1325
test-cpu-github:
14-
# A 'labeled' event fires once per label added, and re-evaluates against the PR's
15-
# *current* full label set — so adding several labels in a row would otherwise
16-
# re-run this job on every subsequent label add. Only react to 'labeled' when it's
17-
# this specific label; for other trigger types (synchronize/reopened), fall back to
18-
# checking the current label set as before.
19-
if: >
20-
github.event_name != 'pull_request' ||
21-
(github.event.action == 'labeled' && github.event.label.name == 'run ci github-runner') ||
22-
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run ci github-runner'))
26+
if: github.event_name == 'push' || inputs.target == 'github'
2327
uses: control-toolbox/CTActions/.github/workflows/ci.yml@main
2428
with:
2529
runs_on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
@@ -33,11 +37,7 @@ jobs:
3337
# the plain suite: replaces the former dedicated GPU.yml workflow. Replaces the retired
3438
# kkt runner (cf. CTParser.jl, CTFlows.jl).
3539
test-gpu-occidata:
36-
# See the comment on test-cpu-github above.
37-
if: >
38-
github.event_name == 'pull_request' &&
39-
((github.event.action == 'labeled' && github.event.label.name == 'run ci occidata-runner') ||
40-
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run ci occidata-runner')))
40+
if: inputs.target == 'occidata'
4141
uses: control-toolbox/CTActions/.github/workflows/ci.yml@main
4242
with:
4343
versions: '["1"]'
@@ -51,11 +51,7 @@ jobs:
5151
# Job for the self-hosted kkt runner (GPU/CUDA), on its label only (a pull request can
5252
# always ask for either GPU runner; a push picks one, see test-gpu-main).
5353
test-gpu-kkt:
54-
# See the comment on test-cpu-github above.
55-
if: >
56-
github.event_name == 'pull_request' &&
57-
((github.event.action == 'labeled' && github.event.label.name == 'run ci kkt-runner') ||
58-
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run ci kkt-runner')))
54+
if: inputs.target == 'kkt'
5955
uses: control-toolbox/CTActions/.github/workflows/ci.yml@main
6056
with:
6157
runs_on: '[["kkt"]]'
@@ -68,7 +64,7 @@ jobs:
6864
# On a push (main, tags): a single GPU run, on kkt unless it is offline, else occidata
6965
# (CTActions ci-gpu.yml). A busy kkt is waited for.
7066
test-gpu-main:
71-
if: github.event_name != 'pull_request'
67+
if: github.event_name == 'push'
7268
uses: control-toolbox/CTActions/.github/workflows/ci-gpu.yml@main
7369
with:
7470
use_ct_registry: true

‎.github/workflows/Documentation.yml‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
name: Documentation
2+
run-name: "Documentation${{ inputs.pr && format(' #{0}', inputs.pr) || '' }}"
3+
4+
# On a pull request, a label starts its own run through Labels.yml
5+
# (CTActions docs/workflows/label-dispatch.md).
26

37
on:
48
push:
59
branches:
610
- main
711
tags: '*'
8-
pull_request:
9-
types: [labeled, synchronize, reopened]
1012
# run on a tag by ReleaseTag.yml: a tag it creates triggers no push event
1113
workflow_dispatch:
14+
inputs:
15+
pr:
16+
description: 'Pull request number, set by label-dispatch.yml'
17+
required: false
18+
default: ''
19+
preview:
20+
description: 'Deploy the preview of the pull request (label documentation push preview)'
21+
required: false
22+
default: 'false'
1223

1324
jobs:
1425
call:
15-
# A 'labeled' event fires once per label added, and re-evaluates against the PR's
16-
# *current* full label set — so adding several labels in a row would otherwise
17-
# re-run this job on every subsequent label add. Only react to 'labeled' when it's
18-
# this specific label; for other trigger types (synchronize/reopened), fall back to
19-
# checking the current label set as before.
20-
# On a PR, `run documentation` is the only trigger. `documentation push preview` is a
21-
# modifier: with `run documentation` present, the build also deploys its preview.
22-
if: >
23-
github.event_name != 'pull_request' ||
24-
(contains(github.event.pull_request.labels.*.name, 'run documentation') &&
25-
(github.event.action != 'labeled' ||
26-
github.event.label.name == 'run documentation' ||
27-
github.event.label.name == 'documentation push preview'))
2826
uses: control-toolbox/CTActions/.github/workflows/documentation.yml@main
2927
with:
3028
use_ct_registry: true

‎.github/workflows/Labels.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Labels
2+
3+
# A label added to a pull request starts the workflow of that label, and only that one
4+
# (CTActions docs/workflows/label-dispatch.md): CI, Documentation and Breakage are
5+
# dispatched, they no longer listen to pull_request.
6+
7+
on:
8+
pull_request:
9+
types: [labeled, synchronize, reopened]
10+
11+
jobs:
12+
call:
13+
permissions:
14+
contents: read
15+
actions: write
16+
uses: control-toolbox/CTActions/.github/workflows/label-dispatch.yml@main

0 commit comments

Comments
 (0)