@@ -3,19 +3,27 @@ name: build
33permissions :
44 contents : read
55
6- on : [push, pull_request]
6+ on :
7+ pull_request :
8+ push :
9+ branches :
10+ - master
711
812env :
913 RUST_BACKTRACE : 1
1014 CARGO_TERM_COLOR : always
1115 CLICOLOR : 1
1216
17+ concurrency :
18+ group : " ${{ github.workflow }}-${{ github.ref }}"
19+ cancel-in-progress : true
20+
1321jobs :
1422 build :
1523 permissions :
1624 contents : none
1725 name : CI
18- needs : [test, lockfile, rustfmt, clippy]
26+ needs : [test, msrv, lockfile, rustfmt, clippy]
1927 runs-on : ubuntu-latest
2028 if : " always()"
2129 steps :
@@ -30,58 +38,123 @@ jobs:
3038 rust : ["stable"]
3139 continue-on-error : ${{ matrix.rust != 'stable' }}
3240 runs-on : ${{ matrix.os }}
41+ env :
42+ # Reduce amount of data cached
43+ CARGO_PROFILE_DEV_DEBUG : line-tables-only
3344 steps :
3445 - name : Checkout repository
35- uses : actions/checkout@v4
46+ uses : actions/checkout@v6.0.2
47+ with :
48+ persist-credentials : false
3649 - name : Install Rust
3750 uses : dtolnay/rust-toolchain@stable
3851 with :
3952 toolchain : ${{ matrix.rust }}
40- - uses : Swatinem/rust-cache@v2
53+ - name : Initialize cache
54+ uses : Swatinem/rust-cache@v2.9.1
55+ - name : Install cargo-hack
56+ uses : taiki-e/install-action@v2.75.4
57+ with :
58+ tool : cargo-hack
4159 - name : Build
42- run : cargo test --no-run
60+ run : cargo test --workspace -- no-run
4361 - name : Test
44- run : cargo test
62+ run : cargo hack test --each-feature --workspace
63+ msrv :
64+ name : " Check MSRV"
65+ strategy :
66+ matrix :
67+ os : ["ubuntu-latest"]
68+ runs-on : ${{ matrix.os }}
69+ steps :
70+ - name : Checkout repository
71+ uses : actions/checkout@v6.0.2
72+ with :
73+ persist-credentials : false
74+ - name : Install Rust
75+ uses : dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
76+ with :
77+ toolchain : stable
78+ - name : Initialize cache
79+ uses : Swatinem/rust-cache@v2.9.1
80+ - name : Install cargo-hack
81+ uses : taiki-e/install-action@v2.75.4
82+ with :
83+ tool : cargo-hack
84+ - name : Default features
85+ run : cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going
86+ minimal-versions :
87+ name : Minimal versions
88+ strategy :
89+ matrix :
90+ os : ["ubuntu-latest"]
91+ runs-on : ${{ matrix.os }}
92+ steps :
93+ - name : Checkout repository
94+ uses : actions/checkout@v6.0.2
95+ with :
96+ persist-credentials : false
97+ - name : Install stable Rust
98+ uses : dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
99+ with :
100+ toolchain : stable
101+ - name : Install nightly Rust
102+ uses : dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
103+ with :
104+ toolchain : nightly
105+ - name : Downgrade dependencies to minimal versions
106+ run : cargo +nightly generate-lockfile -Z minimal-versions
107+ - name : Compile with minimal versions
108+ run : cargo +stable check --workspace --all-features --locked --keep-going
45109 lockfile :
46110 runs-on : ubuntu-latest
47111 steps :
48112 - name : Checkout repository
49- uses : actions/checkout@v4
113+ uses : actions/checkout@v6.0.2
114+ with :
115+ persist-credentials : false
50116 - name : Install Rust
51117 uses : dtolnay/rust-toolchain@stable
52118 with :
53119 toolchain : stable
54- - uses : Swatinem/rust-cache@v2
120+ - name : Initialize cache
121+ uses : Swatinem/rust-cache@v2.9.1
55122 - name : " Is lockfile updated?"
56123 run : cargo update --workspace --locked
57124 rustfmt :
58125 name : rustfmt
59126 runs-on : ubuntu-latest
60127 steps :
61128 - name : Checkout repository
62- uses : actions/checkout@v4
129+ uses : actions/checkout@v6.0.2
130+ with :
131+ persist-credentials : false
63132 - name : Install Rust
64133 uses : dtolnay/rust-toolchain@stable
65134 with :
66135 toolchain : stable
67136 components : rustfmt
68- - uses : Swatinem/rust-cache@v2
137+ - name : Initialize cache
138+ uses : Swatinem/rust-cache@v2.9.1
69139 - name : Check formatting
70- run : cargo fmt --all -- -- check
140+ run : cargo fmt --check
71141 clippy :
72142 name : clippy
73143 runs-on : ubuntu-latest
74144 permissions :
75145 security-events : write # to upload sarif results
76146 steps :
77147 - name : Checkout repository
78- uses : actions/checkout@v4
148+ uses : actions/checkout@v6.0.2
149+ with :
150+ persist-credentials : false
79151 - name : Install Rust
80152 uses : dtolnay/rust-toolchain@stable
81153 with :
82154 toolchain : stable
83155 components : clippy
84- - uses : Swatinem/rust-cache@v2
156+ - name : Initialize cache
157+ uses : Swatinem/rust-cache@v2.9.1
85158 - name : Install SARIF tools
86159 run : cargo install clippy-sarif --locked
87160 - name : Install SARIF tools
94167 | sarif-fmt
95168 continue-on-error : true
96169 - name : Upload
97- uses : github/codeql-action/upload-sarif@v3
170+ uses : github/codeql-action/upload-sarif@v4.35.1
98171 with :
99172 sarif_file : clippy-results.sarif
100173 wait-for-processing : true
101174 - name : Report status
102- run : cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
175+ run : cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated
0 commit comments