Skip to content

Commit 65f6877

Browse files
committed
ci: cancel parallel jobs if test fails
Signed-off-by: Prajwal S N <[email protected]>
1 parent afc367b commit 65f6877

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/ci.yaml

+16-4
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,31 @@ jobs:
101101
# . -> target
102102
# ./crates/proc-macro-srv/proc-macro-test/imp -> target
103103

104-
- uses: taiki-e/install-action@nextest
104+
- name: Install nextest
105+
uses: taiki-e/install-action@nextest
105106

106107
- name: Codegen checks (rust-analyzer)
107108
if: matrix.os == 'ubuntu-latest'
108109
run: cargo codegen --check
109110

110-
- name: Compile (tests)
111+
- name: Compile tests
111112
run: cargo test --no-run
112113

113-
- name: Test
114+
- name: Run tests
114115
run: cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail
115116

116-
- name: clippy
117+
- name: Cancel parallel jobs
118+
if: failure()
119+
run: |
120+
# https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run
121+
curl -L \
122+
-X POST \
123+
-H "Accept: application/vnd.github.v3+json" \
124+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
125+
-H "X-GitHub-Api-Version: 2022-11-28" \
126+
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
127+
128+
- name: Run Clippy
117129
if: matrix.os == 'macos-latest'
118130
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
119131

0 commit comments

Comments
 (0)