ci: use one skip check for CI workflow (#855)

Use one single skip check job for CI like other workflows.
This commit is contained in:
Clement Tsang 2022-10-27 22:00:37 -04:00 committed by GitHub
parent 51498e1238
commit fec56372bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 31 deletions

View File

@ -2,6 +2,9 @@
---
# Configuration for CirrusCI. This is primarily used for
# FreeBSD and macOS M1 tests and builds.
#
# We set the YAML directive above to prevent some linting errors around the
# templates.
setup_template: &SETUP_TEMPLATE
setup_script:

View File

@ -29,8 +29,23 @@ concurrency:
cancel-in-progress: true
jobs:
# Check if things should be skipped.
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with:
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"]'
do_not_skip: '["workflow_dispatch", "push"]'
# Runs rustfmt + tests + clippy on the main supported platforms.
supported:
needs: pre_job
runs-on: ${{ matrix.info.os }}
strategy:
fail-fast: false
@ -54,20 +69,12 @@ jobs:
}
features: ["--all-features", "--no-default-features"]
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with:
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"]'
do_not_skip: '["workflow_dispatch", "push"]'
- name: Checkout repository
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/checkout@v3
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
- name: Set up Rust toolchain
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: dtolnay/rust-toolchain@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
with:
toolchain: stable
@ -75,15 +82,15 @@ jobs:
target: ${{ matrix.info.target }}
- name: Enable Rust cache
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
- name: Check cargo fmt
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: cargo fmt --all -- --check
- name: Build tests
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: ClementTsang/cargo-action@v0.0.3
with:
command: test
@ -94,7 +101,7 @@ jobs:
RUST_BACKTRACE: full
- name: Run tests
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: ClementTsang/cargo-action@v0.0.3
with:
command: test
@ -105,7 +112,7 @@ jobs:
RUST_BACKTRACE: full
- name: Run clippy
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: ClementTsang/cargo-action@v0.0.3
with:
command: clippy
@ -117,6 +124,7 @@ jobs:
# Run cargo check on all other platforms
other_check:
needs: pre_job
runs-on: ${{ matrix.info.os }}
continue-on-error: true
strategy:
@ -208,33 +216,25 @@ jobs:
}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with:
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"]'
do_not_skip: '["workflow_dispatch", "push"]'
- name: Checkout repository
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/checkout@v3
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
- name: Set up Rust toolchain
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: dtolnay/rust-toolchain@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
with:
toolchain: ${{ matrix.info.rust }}
target: ${{ matrix.info.target }}
- name: Enable Rust cache
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
key: ${{ matrix.info.target }}
- name: Check
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: ClementTsang/cargo-action@v0.0.3
with:
command: check

View File

@ -1,4 +1,4 @@
# Code coverage generation via cargo-llvm-cov, and uploaded to codecov.
# Code coverage generation via cargo-llvm-cov, which is then uploaded to codecov.
name: codecov

View File

@ -19,7 +19,7 @@ jobs:
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4 # v5.2.0
with:
skip_after_successful_duplicate: "true"
paths: '["docs/**", ".github/workflows/docs.yml"]'
paths: '["docs/**", ".github/workflows/docs.yml", ".github/workflows/test-docs.yml"]'
do_not_skip: '["workflow_dispatch"]'
test-build-documentation:

View File

@ -1,7 +1,9 @@
#!/bin/python3
# A simple script to trigger Cirrus CI builds and get the release artifacts through Cirrus CI's GraphQL interface.
# Expects the API key to be set in CIRRUS_KEY.
# A simple script to trigger Cirrus CI builds and download the release artifacts
# through Cirrus CI's GraphQL interface.
#
# Expects the Cirrus CI API key to be set in the CIRRUS_KEY environment variable.
import os
import json