ci: test cancelling stale actions (#851)

Use Github Action's concurrency settings to cancel old actions in favour of newer ones.
This commit is contained in:
Clement Tsang 2022-10-25 01:24:08 -04:00 committed by GitHub
parent 97ba34e3f4
commit 4240a38ced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 6 deletions

View File

@ -1,11 +1,11 @@
# Main CI pipeline to validate PRs. # Main CI workflow to validate PRs.
# #
# CI pipeline based on: # CI workflow based on:
# - https://github.com/heim-rs/heim/blob/master/.github/workflows/ci.yml # - https://github.com/heim-rs/heim/blob/master/.github/workflows/ci.yml
# - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml # - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml
# - https://www.reillywood.com/blog/rust-faster-ci/ # - https://www.reillywood.com/blog/rust-faster-ci/
# #
# CI pipeline should do: # It should do the following:
# - cargo fmt on supported platforms # - cargo fmt on supported platforms
# - cargo test on supported platforms, cargo check on unsupported # - cargo test on supported platforms, cargo check on unsupported
# - cargo clippy after (apparently faster) on supported platforms # - cargo clippy after (apparently faster) on supported platforms
@ -24,6 +24,10 @@ env:
CARGO_PROFILE_DEV_DEBUG: 0 CARGO_PROFILE_DEV_DEBUG: 0
CARGO_HUSKY_DONT_INSTALL_HOOKS: true CARGO_HUSKY_DONT_INSTALL_HOOKS: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
# Runs rustfmt + tests + clippy on the main supported platforms. # Runs rustfmt + tests + clippy on the main supported platforms.
supported: supported:
@ -54,7 +58,6 @@ jobs:
id: skip_check id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0 uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with: with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true" skip_after_successful_duplicate: "true"
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]' paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]'
do_not_skip: '["workflow_dispatch", "push"]' do_not_skip: '["workflow_dispatch", "push"]'
@ -209,7 +212,6 @@ jobs:
id: skip_check id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0 uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with: with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true" skip_after_successful_duplicate: "true"
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]' paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]'
do_not_skip: '["workflow_dispatch", "push"]' do_not_skip: '["workflow_dispatch", "push"]'

View File

@ -12,6 +12,10 @@ on:
env: env:
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
pre_job: pre_job:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -21,7 +25,6 @@ jobs:
- id: skip_check - id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0 uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with: with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "false" skip_after_successful_duplicate: "false"
paths: '["tests/**", "src/**", ".github/workflows/coverage.yml", ".cargo/**", "Cargo.toml", "Cargo.lock", "build.rs"]' paths: '["tests/**", "src/**", ".github/workflows/coverage.yml", ".cargo/**", "Cargo.toml", "Cargo.lock", "build.rs"]'
do_not_skip: '["workflow_dispatch", "push"]' do_not_skip: '["workflow_dispatch", "push"]'

View File

@ -1,3 +1,5 @@
# Workflow to deploy mkdocs documentation.
name: docs name: docs
on: on:
workflow_dispatch: workflow_dispatch:

View File

@ -1,4 +1,5 @@
# Actions to run after releasing a version, like generating documentation via mkdocs or notifying packaging repos. # Actions to run after releasing a version, like generating documentation via mkdocs or notifying packaging repos.
name: post-release name: post-release
on: on:

View File

@ -1,8 +1,14 @@
# Small CI workflow to test if mkdocs documentation can be successfully built.
name: test-docs name: test-docs
on: on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
pre_job: pre_job:
runs-on: ubuntu-latest runs-on: ubuntu-latest