Skip to content

Commit 6824022

Browse files
committed
Refactor CI msrv & minver checks
1 parent dd17f75 commit 6824022

File tree

1 file changed

+35
-133
lines changed

1 file changed

+35
-133
lines changed

.github/workflows/CI.yml

Lines changed: 35 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,9 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- uses: actions/checkout@v3
42-
- uses: actions-rs/toolchain@v1
43-
with:
44-
toolchain: stable
45-
profile: minimal
46-
override: true
42+
- uses: dtolnay/rust-toolchain@stable
4743
- name: Check
48-
uses: actions-rs/cargo@v1
49-
with:
50-
command: check
51-
args: --all --tests --benches
44+
run: cargo check --all --tests --benches
5245

5346
style:
5447
# Check style.
@@ -57,64 +50,27 @@ jobs:
5750
runs-on: ubuntu-latest
5851
steps:
5952
- uses: actions/checkout@v3
60-
- uses: actions-rs/toolchain@v1
53+
- uses: dtolnay/rust-toolchain@stable
6154
with:
62-
toolchain: stable
6355
components: rustfmt
64-
profile: minimal
65-
override: true
6656
- name: rustfmt
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: fmt
70-
args: --all -- --check
57+
run: cargo fmt --all -- --check
7158

7259
warnings:
7360
# Check for any warnings. This is informational and thus is allowed to fail.
7461
runs-on: ubuntu-latest
7562
needs: check
7663
steps:
7764
- uses: actions/checkout@v3
78-
- uses: actions-rs/toolchain@v1
65+
- uses: dtolnay/rust-toolchain@stable
7966
with:
80-
toolchain: stable
8167
components: clippy
82-
profile: minimal
8368
- name: Clippy
8469
uses: actions-rs/clippy-check@v1
8570
with:
8671
token: ${{ secrets.GITHUB_TOKEN }}
8772
args: --all --examples --tests --benches -- -D warnings
8873

89-
minimal-versions:
90-
# Check for minimal-versions errors where a dependency is too
91-
# underconstrained to build on the minimal supported version of all
92-
# dependencies in the dependency graph.
93-
name: cargo check (-Zminimal-versions)
94-
needs: check
95-
runs-on: ubuntu-latest
96-
steps:
97-
- uses: actions/checkout@v3
98-
- uses: actions-rs/toolchain@v1
99-
with:
100-
toolchain: nightly
101-
profile: minimal
102-
override: true
103-
- name: install cargo-hack
104-
uses: taiki-e/install-action@cargo-hack
105-
- name: "check --all-features -Z minimal-versions"
106-
run: |
107-
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
108-
# from determining minimal versions based on dev-dependencies.
109-
cargo hack --remove-dev-deps --workspace
110-
# Update Cargo.lock to minimal version dependencies.
111-
cargo update -Z minimal-versions
112-
cargo hack check \
113-
--package tracing \
114-
--package tracing-core \
115-
--package tracing-subscriber \
116-
--all-features --ignore-private
117-
11874
cargo-hack:
11975
needs: check
12076
name: cargo check (feature combinations)
@@ -137,11 +93,7 @@ jobs:
13793
- tracing-subscriber
13894
steps:
13995
- uses: actions/checkout@v3
140-
- uses: actions-rs/toolchain@v1
141-
with:
142-
toolchain: stable
143-
profile: minimal
144-
override: true
96+
- uses: dtolnay/rust-toolchain@stable
14597

14698
- name: install cargo-hack
14799
uses: taiki-e/install-action@cargo-hack
@@ -175,76 +127,40 @@ jobs:
175127

176128
check-msrv:
177129
# Run `cargo check` on our minimum supported Rust version (1.49.0).
178-
name: "cargo check (MSRV on ubuntu-latest)"
130+
name: "cargo check (+MSRV -Zminimal-versions) (ubuntu-latest)"
179131
needs: check
180132
runs-on: ubuntu-latest
181133
steps:
182134
- uses: actions/checkout@v3
135+
- name: install rust nightly
136+
uses: dtolnay/rust-toolchain@nightly
183137
- name: "install Rust ${{ env.MSRV }}"
184-
uses: actions-rs/toolchain@v1
185-
with:
186-
toolchain: ${{ env.MSRV }}
187-
profile: minimal
188-
- name: "install Rust nightly"
189-
uses: actions-rs/toolchain@v1
190-
with:
191-
toolchain: nightly
192-
profile: minimal
193-
- name: Select minimal versions
194-
uses: actions-rs/cargo@v1
138+
uses: dtolnay/rust-toolchain@master
195139
with:
196-
command: update
197-
args: -Z minimal-versions
198-
toolchain: nightly
199-
- name: Check
200-
uses: actions-rs/cargo@v1
201-
with:
202-
command: check
203-
# skip the following crates:
204-
# - tracing-appender, as it has its own MSRV.
205-
# TODO(eliza): remove this when appender is on the same MSRV as
206-
# everything else
207-
# - the examples, as they are not published & we don't care about
208-
# MSRV support for them.
209-
# - tracing-futures, as it depends on ancient tokio versions.
210-
# TODO(eliza): remove this when the ancient tokio deps are dropped
211-
args: >-
212-
--workspace --all-features --locked
213-
--exclude=tracing-appender
214-
--exclude=tracing-examples
215-
--exclude=tracing-futures
216140
toolchain: ${{ env.MSRV }}
217-
218-
# TODO: remove this once tracing's MSRV is bumped.
219-
check-msrv-appender:
220-
# Run `cargo check` on our minimum supported Rust version (1.53.0).
221-
name: "cargo check (tracing-appender MSRV)"
222-
needs: check
223-
runs-on: ubuntu-latest
224-
steps:
225-
- uses: actions/checkout@v3
226141
- name: "install Rust ${{ env.APPENDER_MSRV }}"
227-
uses: actions-rs/toolchain@v1
142+
uses: dtolnay/rust-toolchain@master
228143
with:
229144
toolchain: ${{ env.APPENDER_MSRV }}
230-
profile: minimal
231-
- name: "install Rust nightly"
232-
uses: actions-rs/toolchain@v1
233-
with:
234-
toolchain: nightly
235-
profile: minimal
236-
- name: Select minimal versions
237-
uses: actions-rs/cargo@v1
238-
with:
239-
command: update
240-
args: -Z minimal-versions
241-
toolchain: nightly
145+
- name: install cargo-hack
146+
uses: taiki-e/install-action@cargo-hack
147+
- name: install cargo-minimal-versions
148+
uses: taiki-e/install-action@cargo-minimal-versions
242149
- name: Check
243-
uses: actions-rs/cargo@v1
244-
with:
245-
command: check
246-
args: --all-features --locked -p tracing-appender
247-
toolchain: ${{ env.APPENDER_MSRV }}
150+
# the following crates are handled specially:
151+
# - unpublished crates (examples, mock); we don't care about their MSRV
152+
# - tracing-appender; it has its own MSRV.
153+
# TODO(eliza): remove this when appender is on the same MSRV.
154+
# - tracing-futures; it depends on ancient tokio versions.
155+
# TODO(eliza): remove this when the ancient tokio deps are dropped
156+
run: >-
157+
cargo +${{ env.MSRV }} hack --workspace --ignore-private
158+
--exclude tracing-appender --exclude tracing-futures
159+
minimal-versions check --all-features &&
160+
cargo +${{ env.APPENDER_MSRV }} hack --package tracing-appender
161+
minimal-versions check --all-features &&
162+
cargo +{{ env.MSRV }} hack --package tracing-futures
163+
minimal-versions check --features futures-03
248164
249165
### test jobs #############################################################
250166

@@ -268,11 +184,10 @@ jobs:
268184
runs-on: ${{ matrix.os }}
269185
steps:
270186
- uses: actions/checkout@v3
271-
- uses: actions-rs/toolchain@v1
187+
- name: "install Rust ${{ matrix.rust }}"
188+
uses: dtolnay/rust-toolchain@master
272189
with:
273190
toolchain: ${{ matrix.rust }}
274-
profile: minimal
275-
override: true
276191
- name: install cargo-nextest
277192
uses: taiki-e/install-action@nextest
278193
- name: Run tests
@@ -312,16 +227,11 @@ jobs:
312227
fail-fast: false
313228
steps:
314229
- uses: actions/checkout@v3
315-
- uses: actions-rs/toolchain@v1
230+
- uses: dtolnay/rust-toolchain@stable
316231
with:
317232
target: wasm32-unknown-unknown
318-
toolchain: stable
319-
override: true
320233
- name: build all tests
321-
uses: actions-rs/cargo@v1
322-
with:
323-
command: test
324-
args: --no-run -p ${{ matrix.subcrate }}
234+
run: cargo test --no-run -p ${{ matrix.subcrate }}
325235

326236
test-wasm:
327237
name: cargo test (wasm)
@@ -333,11 +243,9 @@ jobs:
333243
- tracing
334244
steps:
335245
- uses: actions/checkout@v3
336-
- uses: actions-rs/toolchain@v1
246+
- uses: dtolnay/rust-toolchain@stable
337247
with:
338248
target: wasm32-unknown-unknown
339-
toolchain: stable
340-
override: true
341249
- name: install test runner for wasm
342250
uses: taiki-e/install-action@wasm-pack
343251
- name: run wasm tests
@@ -353,11 +261,7 @@ jobs:
353261
runs-on: ubuntu-latest
354262
steps:
355263
- uses: actions/checkout@v3
356-
- uses: actions-rs/toolchain@v1
357-
with:
358-
toolchain: stable
359-
profile: minimal
360-
override: true
264+
- uses: dtolnay/rust-toolchain@stable
361265
- name: "Test log support"
362266
run: cargo test
363267
working-directory: "tracing/test-log-support"
@@ -386,10 +290,8 @@ jobs:
386290
runs-on: ubuntu-latest
387291
needs:
388292
- style
389-
- minimal-versions
390293
- cargo-hack
391294
- check-msrv
392-
- check-msrv-appender
393295
- test-build-wasm
394296
- test-wasm
395297
- test-features-stable

0 commit comments

Comments
 (0)