ci(concurrency)!: run a single CI workflow as required (#4981)

* ci(concurrency)!: run a single CI workflow as required

Previous behavior:
Multiple Mainnet full syncs were able to run on the main branch at the
same time, and pushing multiple commits to the same branch would run
multiple CI workflows, when only the run from last commit was relevant

Expected behavior:
Ensure that only a single CI workflow runs at the same time in PRs.
The latest commit should cancel any previous running workflows from the
same PR.

Solution:
Use GitHub actions concurrency feature https://docs.github.com/en/actions/using-jobs/using-concurrency

Fixes https://github.com/ZcashFoundation/zebra/issues/4977
Fixes https://github.com/ZcashFoundation/zebra/issues/4857

* docs: typo

* ci(concurrency): do not cancel running full syncs

Co-authored-by: teor <teor@riseup.net>

* fix(concurrency): explain the behavior better & add new ones

Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
Gustavo Valverde 2022-08-29 20:11:05 -04:00 committed by GitHub
parent e5c0e10887
commit c85e482fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 0 deletions

View File

@ -1,5 +1,12 @@
name: Build crates individually
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
push:

View File

@ -1,5 +1,12 @@
name: CD
# Ensures that only one workflow task will run at a time. Previous deployments, if
# already in process, won't get cancelled. Instead, we let the first to complete
# then queue the latest pending workflow, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
on:
workflow_dispatch:
inputs:

View File

@ -1,5 +1,12 @@
name: CI Docker
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
@ -312,6 +319,14 @@ jobs:
saves_to_disk: true
disk_suffix: tip
height_grep_text: 'current_height.*=.*Height'
# We don't want to cancel running full syncs on `main` if a new PR gets merged,
# because we might never finish a full sync during busy weeks. Instead, we let the
# first sync complete, then queue the latest pending sync, cancelling any syncs in between.
# (As the general workflow concurrency group just gets matched in Pull Requests,
# it has no impact on this job.)
concurrency:
group: github.workflow{{ github.ref }}
cancel-in-progress: false
# Test that Zebra can sync to the chain tip, using a cached Zebra tip state,
# without launching `lightwalletd`.

View File

@ -1,5 +1,12 @@
name: CI OSes
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
# we build Rust and Zcash parameter caches on main,

View File

@ -1,5 +1,12 @@
name: Coverage
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
push:

View File

@ -1,5 +1,12 @@
name: Docs
# Ensures that only one workflow task will run at a time. Previous deployments, if
# already in process, won't get cancelled. Instead, we let the first to complete
# then queue the latest pending workflow, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
on:
workflow_dispatch:
push:

View File

@ -1,5 +1,12 @@
name: Lint
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
# we build Rust caches on main, so they can be shared by all branches:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache

View File

@ -1,5 +1,12 @@
name: zcash-params
# Ensures that only one workflow task will run at a time. Previous deployments, if
# already in process, won't get cancelled. Instead, we let the first to complete
# then queue the latest pending workflow, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
on:
workflow_dispatch:
push: