diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2022-10-27 22:00:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 22:00:37 -0400 |
commit | fec56372bb804931dca3c5a8611e7e24f6774c19 (patch) | |
tree | 8f20309ff3109660c2cfdd795c80a2dc10bd9aa1 | |
parent | 51498e12388d2b29fa6d25465ed0175bf02e7dad (diff) |
ci: use one skip check for CI workflow (#855)
Use one single skip check job for CI like other workflows.
-rw-r--r-- | .cirrus.yml | 3 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 54 | ||||
-rw-r--r-- | .github/workflows/coverage.yml | 2 | ||||
-rw-r--r-- | .github/workflows/test-docs.yml | 2 | ||||
-rw-r--r-- | deployment/cirrus/build.py | 6 |
5 files changed, 36 insertions, 31 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index e0a9de61..9e326b6b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 815b69de..96575897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8da840c7..f1f49ffe 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 99ed765d..9ea643ab 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -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: diff --git a/deployment/cirrus/build.py b/deployment/cirrus/build.py index 6cb113af..d1d4bac1 100644 --- a/deployment/cirrus/build.py +++ b/deployment/cirrus/build.py @@ -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 |