From 1aab14ca7060e03bdaf92a9693bee2adaaa5b4f4 Mon Sep 17 00:00:00 2001 From: Steven Gu Date: Mon, 13 Feb 2023 14:23:51 +0800 Subject: [PATCH] Integrate `skip-duplicate-actions` to CI. --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++---- .github/workflows/lints.yml | 17 ++++++++++++++++- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be08590240..eeb1747ec9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,24 @@ concurrency: ## `rust-toolchain` is always used and the only source of truth. jobs: + skip_check: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + cancel_others: 'true' + concurrent_skipping: 'same_content_newer' + paths_ignore: '["**/README.md"]' + test: + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') + name: Test runs-on: ["${{github.run_id}}", self-hosted, c5.9xlarge] @@ -60,7 +77,10 @@ jobs: args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored --test-threads 1 build: - if: github.event.pull_request.draft == false + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') name: Build target ${{ matrix.target }} runs-on: ubuntu-latest @@ -110,7 +130,10 @@ jobs: args: --verbose --release --all-features -p circuit-benchmarks --no-run bitrot: - if: github.event.pull_request.draft == false + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') name: Bitrot check runs-on: ubuntu-latest @@ -148,7 +171,10 @@ jobs: args: --benches --examples --all-features doc-links: - if: github.event.pull_request.draft == false + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') name: Intra-doc links runs-on: ubuntu-latest @@ -192,7 +218,10 @@ jobs: args: --no-deps --all --document-private-items fmt: - if: github.event.pull_request.draft == false + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') name: Rustfmt timeout-minutes: 30 diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 3a5b079915..452b443429 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -9,8 +9,23 @@ on: - main jobs: + skip_check: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + cancel_others: 'true' + concurrent_skipping: 'same_content_newer' + paths_ignore: '["**/README.md"]' + clippy: - if: github.event.pull_request.draft == false + needs: [skip_check] + if: | + github.event.pull_request.draft == false && + (github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true') name: Clippy timeout-minutes: 30