Skip to content

Commit b609235

Browse files
committed
ci: group checks in fast, avg and slow
1 parent d3a1afd commit b609235

File tree

1 file changed

+130
-77
lines changed

1 file changed

+130
-77
lines changed

.github/workflows/rust.yml

+130-77
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,14 @@ on:
88
- cron: "32 4 * * 5"
99

1010
jobs:
11-
Test:
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
15-
rust: [stable, beta]
16-
exclude:
17-
- os: macos-latest
18-
rust: beta
19-
- os: windows-latest
20-
rust: beta
21-
runs-on: ${{ matrix.os }}
22-
steps:
23-
- uses: actions/checkout@v4
24-
- uses: dtolnay/rust-toolchain@master
25-
with:
26-
toolchain: ${{ matrix.rust }}
27-
- uses: taiki-e/install-action@v2
28-
with:
29-
tool: cargo-nextest
30-
- uses: Swatinem/rust-cache@v2
31-
- run: cargo build --all-targets --features full
32-
- run: cargo nextest run --all-targets --no-tests=warn --features full
33-
34-
Package:
35-
strategy:
36-
matrix:
37-
package: [
38-
examples/actix-web-app, fuzzing, rinja, rinja_derive, rinja_derive_standalone,
39-
rinja_parser, testing, testing-alloc, testing-no-std,
40-
]
11+
Step-0:
4112
runs-on: ubuntu-latest
42-
steps:
43-
- uses: actions/checkout@v4
44-
- uses: dtolnay/rust-toolchain@stable
45-
with:
46-
components: clippy
47-
- uses: taiki-e/install-action@v2
48-
with:
49-
tool: cargo-nextest
50-
- uses: Swatinem/rust-cache@v2
51-
- run: cd ${{ matrix.package }} && cargo nextest run --no-tests=warn
52-
- run: cd ${{ matrix.package }} && cargo clippy --all-targets -- -D warnings
5313

54-
Docs:
55-
strategy:
56-
matrix:
57-
package: [rinja, rinja_derive, rinja_parser]
58-
runs-on: ubuntu-latest
59-
steps:
60-
- uses: actions/checkout@v4
61-
- uses: dtolnay/rust-toolchain@nightly
62-
- uses: Swatinem/rust-cache@v2
63-
- run: cd ${{ matrix.package }} && cargo doc --all-features --no-deps
64-
env:
65-
RUSTDOCFLAGS: -Z unstable-options --generate-link-to-definition --cfg=docsrs -D warnings
14+
## STEP 1: FASTEST #################################################################################
6615

6716
Rustfmt:
17+
needs:
18+
- Step-0
6819
runs-on: ubuntu-latest
6920
steps:
7021
# No need to test `rinja_derive_standalone`. It has same the `src` folder as `rinja_derive`.
@@ -85,22 +36,32 @@ jobs:
8536
cd - > /dev/null
8637
done
8738
88-
MSRV:
39+
Docs:
40+
needs:
41+
- Step-0
42+
strategy:
43+
matrix:
44+
package: [rinja, rinja_derive, rinja_parser]
8945
runs-on: ubuntu-latest
9046
steps:
9147
- uses: actions/checkout@v4
92-
- uses: dtolnay/rust-toolchain@master
93-
with:
94-
toolchain: "1.81.0"
95-
- run: cargo check --lib -p rinja --all-features
48+
- uses: dtolnay/rust-toolchain@nightly
49+
- uses: Swatinem/rust-cache@v2
50+
- run: cd ${{ matrix.package }} && cargo doc --all-features --no-deps
51+
env:
52+
RUSTDOCFLAGS: -Z unstable-options --generate-link-to-definition --cfg=docsrs -D warnings
9653

9754
Audit:
55+
needs:
56+
- Step-0
9857
runs-on: ubuntu-latest
9958
steps:
10059
- uses: actions/checkout@v4
10160
- uses: EmbarkStudios/cargo-deny-action@v2
10261

10362
Book:
63+
needs:
64+
- Step-0
10465
runs-on: ubuntu-latest
10566
steps:
10667
- uses: actions/checkout@v4
@@ -115,7 +76,29 @@ jobs:
11576
run: $HOME/bin/mdbook build
11677
working-directory: book
11778

79+
Typos:
80+
needs:
81+
- Step-0
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
- uses: crate-ci/typos@master
86+
87+
Jinja2-Assumptions:
88+
needs:
89+
- Step-0
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
- uses: actions/setup-python@v5
94+
with:
95+
python-version: '3.13'
96+
- uses: astral-sh/setup-uv@v5
97+
- run: testing/jinja2-assumptions/test.sh
98+
11899
DevSkim:
100+
needs:
101+
- Step-0
119102
name: DevSkim
120103
runs-on: ubuntu-latest
121104
permissions:
@@ -134,6 +117,8 @@ jobs:
134117
sarif_file: devskim-results.sarif
135118

136119
CargoSort:
120+
needs:
121+
- Step-0
137122
name: Check order in Cargo.toml
138123
runs-on: ubuntu-latest
139124
steps:
@@ -151,7 +136,90 @@ jobs:
151136
cd - > /dev/null
152137
done
153138
139+
Step-1:
140+
runs-on: ubuntu-latest
141+
needs:
142+
- Rustfmt
143+
- Docs
144+
- Audit
145+
- Book
146+
- Typos
147+
- Jinja2-Assumptions
148+
- DevSkim
149+
- CargoSort
150+
151+
## STEP 2: INTERMEDIATE ############################################################################
152+
153+
Test:
154+
needs:
155+
- Step-1
156+
strategy:
157+
matrix:
158+
os: [ubuntu-latest, macos-latest, windows-latest]
159+
rust: [stable, beta]
160+
exclude:
161+
- os: macos-latest
162+
rust: beta
163+
- os: windows-latest
164+
rust: beta
165+
runs-on: ${{ matrix.os }}
166+
steps:
167+
- uses: actions/checkout@v4
168+
- uses: dtolnay/rust-toolchain@master
169+
with:
170+
toolchain: ${{ matrix.rust }}
171+
- uses: taiki-e/install-action@v2
172+
with:
173+
tool: cargo-nextest
174+
- uses: Swatinem/rust-cache@v2
175+
- run: cargo build --all-targets --features full
176+
- run: cargo nextest run --all-targets --no-tests=warn --features full
177+
178+
Package:
179+
needs:
180+
- Step-1
181+
strategy:
182+
matrix:
183+
package: [
184+
examples/actix-web-app, fuzzing, rinja, rinja_derive, rinja_derive_standalone,
185+
rinja_parser, testing, testing-alloc, testing-no-std,
186+
]
187+
runs-on: ubuntu-latest
188+
steps:
189+
- uses: actions/checkout@v4
190+
- uses: dtolnay/rust-toolchain@stable
191+
with:
192+
components: clippy
193+
- uses: taiki-e/install-action@v2
194+
with:
195+
tool: cargo-nextest
196+
- uses: Swatinem/rust-cache@v2
197+
- run: cd ${{ matrix.package }} && cargo nextest run --no-tests=warn
198+
- run: cd ${{ matrix.package }} && cargo clippy --all-targets -- -D warnings
199+
200+
MSRV:
201+
needs:
202+
- Step-1
203+
runs-on: ubuntu-latest
204+
steps:
205+
- uses: actions/checkout@v4
206+
- uses: dtolnay/rust-toolchain@master
207+
with:
208+
toolchain: "1.81.0"
209+
- run: cargo check --lib -p rinja --all-features
210+
211+
Step-2:
212+
runs-on: ubuntu-latest
213+
needs:
214+
- Test
215+
- Package
216+
- MSRV
217+
218+
## STEP 3: SLOW ####################################################################################
219+
154220
Fuzz:
221+
needs:
222+
- Step-2
155223
strategy:
156224
matrix:
157225
fuzz_target:
@@ -162,20 +230,21 @@ jobs:
162230
runs-on: ubuntu-latest
163231
steps:
164232
- uses: actions/checkout@v4
165-
with:
166-
submodules: recursive
233+
- run: git submodule update --remote
167234
- uses: dtolnay/rust-toolchain@master
168235
with:
169236
toolchain: nightly
170237
components: rust-src
171238
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cargo-fuzz-0.12.0/cargo-fuzz-0.12.0-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
172239
- uses: Swatinem/rust-cache@v2
173-
- run: cargo fuzz run ${{ matrix.fuzz_target }} --jobs 4 -- -max_total_time=120
240+
- run: cargo fuzz run ${{ matrix.fuzz_target }} --jobs 4 -- -max_total_time=240
174241
working-directory: fuzzing
175242
env:
176243
RUSTFLAGS: '-Ctarget-feature=-crt-static'
177244

178245
Cluster-Fuzz:
246+
needs:
247+
- Step-2
179248
runs-on: ubuntu-latest
180249
permissions:
181250
security-events: write
@@ -205,19 +274,3 @@ jobs:
205274
with:
206275
sarif_file: cifuzz-sarif/results.sarif
207276
checkout_path: cifuzz-sarif
208-
209-
Typos:
210-
runs-on: ubuntu-latest
211-
steps:
212-
- uses: actions/checkout@v4
213-
- uses: crate-ci/typos@master
214-
215-
Jinja2-Assumptions:
216-
runs-on: ubuntu-latest
217-
steps:
218-
- uses: actions/checkout@v4
219-
- uses: actions/setup-python@v5
220-
with:
221-
python-version: '3.13'
222-
- uses: astral-sh/setup-uv@v5
223-
- run: testing/jinja2-assumptions/test.sh

0 commit comments

Comments
 (0)