Skip to content

Commit 6b566dd

Browse files
committedJan 22, 2025·
Add a CI workflow
1 parent 8a56bf0 commit 6b566dd

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
 

‎.github/workflows/ci.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches: [ main ]
4+
pull_request:
5+
branches: [ main ]
6+
merge_group:
7+
8+
name: CI
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
CARGO_INCREMENTAL: 0
13+
14+
jobs:
15+
tests:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
include:
20+
- rust: 1.6.0 # MSRV
21+
- rust: stable
22+
- rust: beta
23+
- rust: nightly
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@master
28+
with:
29+
toolchain: ${{ matrix.rust }}
30+
- name: Tests
31+
run: |
32+
cargo build --verbose
33+
cargo test --verbose
34+
35+
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
36+
# protection, rather than having to add each job separately.
37+
success:
38+
name: Success
39+
runs-on: ubuntu-latest
40+
needs: [tests]
41+
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
42+
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
43+
# dependencies fails.
44+
if: always() # make sure this is never "skipped"
45+
steps:
46+
# Manually check the status of all dependencies. `if: failure()` does not work.
47+
- name: check if any dependency failed
48+
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)
Please sign in to comment.