Skip to content

Commit 0a43e0e

Browse files
authored
ci: only run the weekly integration schedule in this repository (#11358)
2 parents 860121b + 7dcce0b commit 0a43e0e

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/zfnd-ci-integration-tests-gcp.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ on:
1919
# This is limited to the Zebra and lightwalletd Full Sync jobs
2020
- cron: 0 12 * * 5
2121

22+
#! Only this repository runs the weekly `schedule`. A copy of this workflow in any other
23+
#! repository is scheduled independently by GitHub and would deploy into the same GCP
24+
#! project, colliding on instance and disk names.
25+
#!
26+
#! The schedule guard means: "Run unless this is a scheduled event in the wrong repository."
27+
#!
28+
#! | Event | Repository | Guard |
29+
#! |-----------------|--------------------------|-------|
30+
#! | `schedule` | `ZcashFoundation/zebra` | true |
31+
#! | `schedule` | any clone | false |
32+
#! | anything else | any repository | true |
33+
#!
34+
#! The guard is on the three jobs that have no `needs:` — `build`, `get-available-disks`
35+
#! and `get-available-disks-testnet` — so everything downstream skips with them, plus
36+
#! `integration-tests-success` because it is `always()` and does not allow `build` to skip.
37+
#! Guard any new job without `needs:`, and any downstream job whose `if:` can still be true
38+
#! when its guarded dependencies are skipped, such as a job using `always()`.
39+
#!
40+
#! `workflow_dispatch`, `push` and `pull_request` are deliberately unaffected everywhere.
41+
2242
workflow_dispatch:
2343
inputs:
2444
network:
@@ -126,7 +146,7 @@ jobs:
126146
build:
127147
name: Build CI Docker
128148
# Skip PRs from external repositories, let them pass, and then GitHub's Merge Queue will check them
129-
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) }}
149+
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) && (github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra') }}
130150
permissions:
131151
contents: read
132152
id-token: write
@@ -157,7 +177,7 @@ jobs:
157177
get-available-disks:
158178
name: Check if cached state disks exist for ${{ inputs.network || vars.ZCASH_NETWORK }}
159179
# Skip PRs from external repositories, let them pass, and then GitHub's Merge Queue will check them
160-
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) }}
180+
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) && (github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra') }}
161181
permissions:
162182
contents: read
163183
id-token: write
@@ -171,7 +191,7 @@ jobs:
171191
# Some outputs are ignored, because we don't run those jobs on testnet.
172192
get-available-disks-testnet:
173193
name: Check if cached state disks exist for testnet
174-
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) }}
194+
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) && (github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra') }}
175195
permissions:
176196
contents: read
177197
id-token: write
@@ -258,7 +278,7 @@ jobs:
258278
contents: read
259279
id-token: write
260280
uses: ./.github/workflows/zfnd-deploy-integration-tests-gcp.yml
261-
if: ${{ github.event_name == 'schedule' || (needs.get-available-disks.result == 'success' && !fromJSON(needs.get-available-disks.outputs.zebra_tip_disk)) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Mainnet') }}
281+
if: ${{ (github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra') && (github.event_name == 'schedule' || (needs.get-available-disks.result == 'success' && !fromJSON(needs.get-available-disks.outputs.zebra_tip_disk)) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Mainnet')) }}
262282
concurrency:
263283
group: ${{ github.event_name == 'workflow_dispatch' && format('manual-{0}-sync-full-mainnet', github.run_id) || 'sync-full-mainnet' }}
264284
cancel-in-progress: false
@@ -362,7 +382,7 @@ jobs:
362382
contents: read
363383
id-token: write
364384
uses: ./.github/workflows/zfnd-deploy-integration-tests-gcp.yml
365-
if: ${{ github.event_name == 'schedule' || (needs.get-available-disks-testnet.result == 'success' && !fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk)) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Testnet') }}
385+
if: ${{ (github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra') && (github.event_name == 'schedule' || (needs.get-available-disks-testnet.result == 'success' && !fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk)) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Testnet')) }}
366386
concurrency:
367387
group: ${{ github.event_name == 'workflow_dispatch' && format('manual-{0}-sync-full-testnet', github.run_id) || 'sync-full-testnet' }}
368388
cancel-in-progress: false
@@ -615,7 +635,8 @@ jobs:
615635
${{
616636
always() &&
617637
(!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) &&
618-
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests'))
638+
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-stateful-tests')) &&
639+
(github.event_name != 'schedule' || github.repository == 'ZcashFoundation/zebra')
619640
}}
620641
needs:
621642
- build

0 commit comments

Comments
 (0)