Skip to content

Commit 708cf3a

Browse files
committed
chore(ci): reformat rust.yml
1 parent 12c195b commit 708cf3a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/rust.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
name: Rust CI
2+
23
on:
34
push:
45
pull_request:
56
schedule:
67
- cron: "0 0 * * *"
8+
79
env:
810
CARGO_TERM_COLOR: always
911
CARGO_INCREMENTAL: 0
1012
# Required by cargo-insta: https://insta.rs/docs/quickstart/#continuous-integration
1113
CI: true
1214
SCCACHE_GHA_ENABLED: true
1315
RUSTC_WRAPPER: sccache
16+
1417
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
1518
# This will ensure that only one commit will be running tests at a time on each PR.
1619
concurrency:
1720
group: ${{ github.ref }}-${{ github.workflow }}
1821
cancel-in-progress: true
22+
1923
jobs:
2024
build:
2125
# Run on external PRs and pushes to branches on the repo
@@ -25,70 +29,89 @@ jobs:
2529
matrix:
2630
rust: [stable, nightly, "1.85"] # 1.85 is the MSRV
2731
os: [ubuntu-latest, macos-latest, windows-latest]
32+
2833
name: Build & test
2934
runs-on: ${{ matrix.os }}
3035
steps:
3136
- name: Checkout source
3237
uses: actions/checkout@v4
38+
3339
- name: Install Rust toolchain
3440
uses: dtolnay/rust-toolchain@master
3541
with:
3642
toolchain: ${{ matrix.rust }}
43+
3744
- name: Cache Cargo registry
3845
uses: Swatinem/rust-cache@v2
3946
with:
4047
shared-key: 'rust-ci'
4148
cache-bin: 'false'
49+
4250
- name: Run sccache-cache
4351
uses: mozilla-actions/sccache-action@v0.0.9
52+
4453
- name: Install cargo-nextest
4554
uses: taiki-e/install-action@v2
4655
with:
4756
tool: nextest
57+
4858
- name: Fetch dependencies
4959
run: cargo +${{ matrix.rust }} fetch --locked
60+
5061
- name: Build
5162
run: cargo +${{ matrix.rust }} build --all-features --tests
63+
5264
- name: Test
5365
run: cargo +${{ matrix.rust }} nextest run --all-features
66+
5467
# Nextest does not support doc tests as in stable Rust
5568
# they are not exposed in the same way as normal tests.
5669
# https://github.com/nextest-rs/nextest/issues/16
5770
- name: Test docs
5871
run: cargo +${{ matrix.rust }} test --all-features --doc
72+
5973
clippy:
6074
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
75+
6176
name: Clippy lint checks
6277
runs-on: ubuntu-latest
6378
needs: ["build"]
6479
steps:
6580
- name: Checkout source
6681
uses: actions/checkout@v4
82+
6783
- name: Install Rust toolchain
6884
uses: dtolnay/rust-toolchain@master
6985
with:
7086
toolchain: stable
7187
components: clippy
88+
7289
- name: Cache Cargo registry
7390
uses: Swatinem/rust-cache@v2
7491
with:
7592
shared-key: 'rust-ci'
7693
cache-bin: 'false'
7794
save-if: 'false'
95+
7896
- name: Run sccache-cache
7997
uses: mozilla-actions/sccache-action@v0.0.9
98+
8099
- name: Run clippy
81100
run: cargo clippy --no-deps --all-targets -- -D warnings
101+
82102
coverage:
83103
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
104+
84105
name: Test coverage checks
85106
runs-on: ubuntu-latest
86107
needs: ["build"]
87108
steps:
88109
- name: Checkout source
89110
uses: actions/checkout@v4
111+
90112
- name: Install LLVM
91113
run: sudo apt-get install -y llvm
114+
92115
- name: Install Rust toolchain
93116
uses: dtolnay/rust-toolchain@master
94117
with:
@@ -100,86 +123,109 @@ jobs:
100123
shared-key: 'rust-ci'
101124
cache-bin: 'false'
102125
save-if: 'false'
126+
103127
- name: Run sccache-cache
104128
uses: mozilla-actions/sccache-action@v0.0.9
129+
105130
- name: Install cargo-llvm-cov
106131
uses: taiki-e/install-action@cargo-llvm-cov
132+
107133
- name: Generate code coverage
108134
run: cargo llvm-cov --all-features --workspace --branch --doctests --codecov --output-path codecov.json
135+
109136
- uses: codecov/codecov-action@v5
110137
with:
111138
files: coverage.json
112139
flags: rust
113140
fail_ci_if_error: true
114141
env:
115142
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
143+
116144
rustfmt:
117145
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
146+
118147
name: Code formatting checks
119148
runs-on: ubuntu-latest
120149
needs: ["build"]
121150
steps:
122151
- name: Checkout source
123152
uses: actions/checkout@v4
153+
124154
- name: Install Rust toolchain
125155
uses: dtolnay/rust-toolchain@master
126156
with:
127157
toolchain: nightly
128158
components: rustfmt
159+
129160
- name: Cache Cargo registry
130161
uses: Swatinem/rust-cache@v2
131162
with:
132163
shared-key: 'rust-ci'
133164
cache-bin: 'false'
134165
save-if: 'false'
166+
135167
- name: Run sccache-cache
136168
uses: mozilla-actions/sccache-action@v0.0.9
169+
137170
- name: Run fmt
138171
run: cargo fmt --all -- --check
172+
139173
machete:
140174
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
175+
141176
name: Machete dependencies checks
142177
runs-on: ubuntu-latest
143178
needs: ["build"]
144179
steps:
145180
- name: Checkout source
146181
uses: actions/checkout@v4
182+
147183
- name: Install Rust toolchain
148184
uses: dtolnay/rust-toolchain@master
149185
with:
150186
toolchain: stable
187+
151188
- name: Cache Cargo registry
152189
uses: Swatinem/rust-cache@v2
153190
with:
154191
shared-key: 'rust-ci'
155192
cache-bin: 'false'
156193
save-if: 'false'
194+
157195
- name: Run sccache-cache
158196
uses: mozilla-actions/sccache-action@v0.0.9
197+
159198
- name: Run cargo-machete
160199
uses: bnjbvr/cargo-machete@v0.8.0
200+
161201
minimal-versions:
162202
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
203+
163204
name: Minimal dependency versions build
164205
runs-on: ubuntu-latest
165206
needs: ["build"]
166207
steps:
167208
- name: Checkout source
168209
uses: actions/checkout@v4
210+
169211
- name: Install Rust toolchain
170212
uses: dtolnay/rust-toolchain@master
171213
with:
172214
toolchain: nightly
215+
173216
- name: Cache Cargo registry
174217
uses: Swatinem/rust-cache@v2
175218
with:
176219
shared-key: 'rust-ci'
177220
cache-bin: 'false'
178221
save-if: 'false'
222+
179223
- name: Install cargo-hack
180224
uses: taiki-e/install-action@cargo-hack
225+
181226
- name: Run sccache-cache
182227
uses: mozilla-actions/sccache-action@v0.0.9
228+
183229
- name: Run cargo check with minimal versions
184230
run: |
185231
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`

0 commit comments

Comments
 (0)