diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2021-11-27 06:27:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-27 06:27:51 -0500 |
commit | 5c8757a1fa2d90a1902594706b6e29771703d576 (patch) | |
tree | 1a91e3af83a041ee072b4424023107d9074c389d /.github | |
parent | 363138ababc4e90a021852e0b1fe9c9bef0a7ca0 (diff) |
ci: deal with skipping and matrix (#616)
Due to how matrices work with if/skipping, it seems like this ugly hack is the only way to skip CI based on the files updated without clogging the PR pipeline.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/ci.yml | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67bd633f..4c56ba56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,8 +78,7 @@ jobs: # Run cargo --check on all platforms check: - needs: [pre_job, rustfmt, clippy] - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + needs: [rustfmt, clippy] runs-on: ${{ matrix.triple.os }} continue-on-error: true strategy: @@ -185,9 +184,19 @@ jobs: } steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: "same_content_newer" + skip_after_successful_duplicate: "true" + paths_ignore: '["**/README.md", "**/docs/**", "assets/**", ".cargo-husky/**", ".all-contributorsrc", ".gitignore", ".markdownlint.json", "deployment/**", ".github/ISSUE_TEMPLATE/**", "CHANGELOG.md", "CONTRIBUTING.md"]' + do_not_skip: '["workflow_dispatch"]' + - uses: actions/checkout@v2 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - name: Install toolchain + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} uses: actions-rs/toolchain@v1 with: profile: minimal @@ -196,10 +205,12 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} with: key: ${{ matrix.triple.target }} - name: Check + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} uses: actions-rs/cargo@v1 with: command: check @@ -208,8 +219,7 @@ jobs: # Check without the battery feature enabled on x86-64 for supported operating systems check-without-battery: - needs: [pre_job, rustfmt, clippy] - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + needs: [rustfmt, clippy] runs-on: ${{ matrix.triple.os }} continue-on-error: true strategy: @@ -236,9 +246,19 @@ jobs: } steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: "same_content_newer" + skip_after_successful_duplicate: "true" + paths_ignore: '["**/README.md", "**/docs/**", "assets/**", ".cargo-husky/**", ".all-contributorsrc", ".gitignore", ".markdownlint.json", "deployment/**", ".github/ISSUE_TEMPLATE/**", "CHANGELOG.md", "CONTRIBUTING.md"]' + do_not_skip: '["workflow_dispatch"]' + - uses: actions/checkout@v2 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - name: Install toolchain + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} uses: actions-rs/toolchain@v1 with: profile: minimal @@ -247,10 +267,12 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} with: key: ${{ matrix.triple.target }} - name: Check without battery feature on the main 3 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} uses: actions-rs/cargo@v1 with: command: check @@ -259,8 +281,7 @@ jobs: # Run tests x86-64 for supported operating systems test: - needs: [pre_job, rustfmt, clippy] - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + needs: [rustfmt, clippy] runs-on: ${{ matrix.triple.os }} continue-on-error: true strategy: @@ -287,9 +308,19 @@ jobs: } steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: "same_content_newer" + skip_after_successful_duplicate: "true" + paths_ignore: '["**/README.md", "**/docs/**", "assets/**", ".cargo-husky/**", ".all-contributorsrc", ".gitignore", ".markdownlint.json", "deployment/**", ".github/ISSUE_TEMPLATE/**", "CHANGELOG.md", "CONTRIBUTING.md"]' + do_not_skip: '["workflow_dispatch"]' + - uses: actions/checkout@v2 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - name: Install toolchain + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} uses: actions-rs/toolchain@v1 with: profile: minimal @@ -298,10 +329,12 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} with: key: ${{ matrix.triple.target }} - name: Run tests + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} run: cargo test --no-fail-fast env: CARGO_HUSKY_DONT_INSTALL_HOOKS: true |