Skip to content

Commit 2a12e56

Browse files
committed
chore: backport CI improvements (#2238)
1 parent 24f4d1f commit 2a12e56

File tree

1 file changed

+53
-99
lines changed

1 file changed

+53
-99
lines changed

.github/workflows/CI.yml

Lines changed: 53 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
- "v0.1.x"
87
pull_request: {}
98

109
env:
@@ -27,9 +26,6 @@ env:
2726
RUSTUP_MAX_RETRIES: 10
2827
# Don't emit giant backtraces in the CI logs.
2928
RUST_BACKTRACE: short
30-
MSRV: 1.63.0
31-
# TODO: remove this once tracing's MSRV is bumped.
32-
APPENDER_MSRV: 1.63.0
3329

3430
jobs:
3531
### check jobs ###
@@ -40,16 +36,9 @@ jobs:
4036
runs-on: ubuntu-latest
4137
steps:
4238
- uses: actions/checkout@v3
43-
- uses: actions-rs/toolchain@v1
44-
with:
45-
toolchain: stable
46-
profile: minimal
47-
override: true
39+
- uses: dtolnay/rust-toolchain@stable
4840
- name: Check
49-
uses: actions-rs/cargo@v1
50-
with:
51-
command: check
52-
args: --all --tests --benches
41+
run: cargo check --all --tests --benches
5342

5443
style:
5544
# Check style.
@@ -58,64 +47,27 @@ jobs:
5847
runs-on: ubuntu-latest
5948
steps:
6049
- uses: actions/checkout@v3
61-
- uses: actions-rs/toolchain@v1
50+
- uses: dtolnay/rust-toolchain@stable
6251
with:
63-
toolchain: stable
6452
components: rustfmt
65-
profile: minimal
66-
override: true
6753
- name: rustfmt
68-
uses: actions-rs/cargo@v1
69-
with:
70-
command: fmt
71-
args: --all -- --check
54+
run: cargo fmt --all -- --check
7255

7356
warnings:
7457
# Check for any warnings. This is informational and thus is allowed to fail.
7558
runs-on: ubuntu-latest
7659
needs: check
7760
steps:
7861
- uses: actions/checkout@v3
79-
- uses: actions-rs/toolchain@v1
62+
- uses: dtolnay/rust-toolchain@stable
8063
with:
81-
toolchain: stable
8264
components: clippy
83-
profile: minimal
8465
- name: Clippy
8566
uses: actions-rs/clippy-check@v1
8667
with:
8768
token: ${{ secrets.GITHUB_TOKEN }}
8869
args: --all --examples --tests --benches -- -D warnings
8970

90-
minimal-versions:
91-
# Check for minimal-versions errors where a dependency is too
92-
# underconstrained to build on the minimal supported version of all
93-
# dependencies in the dependency graph.
94-
name: cargo check (-Zminimal-versions)
95-
needs: check
96-
runs-on: ubuntu-latest
97-
steps:
98-
- uses: actions/checkout@v3
99-
- uses: actions-rs/toolchain@v1
100-
with:
101-
toolchain: nightly
102-
profile: minimal
103-
override: true
104-
- name: install cargo-hack
105-
uses: taiki-e/install-action@cargo-hack
106-
- name: "check --all-features -Z minimal-versions"
107-
run: |
108-
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
109-
# from determining minimal versions based on dev-dependencies.
110-
cargo hack --remove-dev-deps --workspace
111-
# Update Cargo.lock to minimal version dependencies.
112-
cargo update -Z minimal-versions
113-
cargo hack check \
114-
--package tracing \
115-
--package tracing-core \
116-
--package tracing-subscriber \
117-
--all-features --ignore-private
118-
11971
cargo-hack:
12072
needs: check
12173
name: cargo check (feature combinations)
@@ -195,28 +147,47 @@ jobs:
195147
- stable
196148
steps:
197149
- uses: actions/checkout@v3
198-
- name: "install Rust ${{ env.APPENDER_MSRV }}"
199-
uses: actions-rs/toolchain@v1
200-
with:
201-
toolchain: ${{ env.APPENDER_MSRV }}
202-
profile: minimal
203-
- name: "install Rust nightly"
204-
uses: actions-rs/toolchain@v1
150+
- name: install Rust nightly
151+
uses: dtolnay/rust-toolchain@nightly
152+
- name: "install Rust ${{ matrix.toolchain }}"
153+
uses: dtolnay/rust-toolchain@master
205154
with:
206-
toolchain: nightly
207-
profile: minimal
208-
- name: Select minimal versions
209-
uses: actions-rs/cargo@v1
210-
with:
211-
command: update
212-
args: -Z minimal-versions
213-
toolchain: nightly
214-
- name: Check
215-
uses: actions-rs/cargo@v1
216-
with:
217-
command: check
218-
args: --all-features --locked -p tracing-appender
219-
toolchain: ${{ env.APPENDER_MSRV }}
155+
toolchain: ${{ matrix.toolchain }}
156+
- name: install cargo-hack
157+
uses: taiki-e/install-action@cargo-hack
158+
- name: install cargo-minimal-versions
159+
uses: taiki-e/install-action@cargo-minimal-versions
160+
- name: cargo minimal-versions check
161+
working-directory: ${{ matrix.subcrate }}
162+
# tracing and tracing-subscriber have too many features to be checked by
163+
# cargo-hack --feature-powerset with all features in the powerset, so
164+
# exclude some
165+
run: |
166+
CARGO_MINVER=(cargo minimal-versions check --feature-powerset --no-dev-deps)
167+
case "${{ matrix.subcrate }}" in
168+
tracing)
169+
EXCLUDE_FEATURES=(
170+
max_level_off max_level_error max_level_warn max_level_info
171+
max_level_debug max_level_trace release_max_level_off
172+
release_max_level_error release_max_level_warn
173+
release_max_level_info release_max_level_debug
174+
release_max_level_trace
175+
)
176+
${CARGO_MINVER[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
177+
;;
178+
tracing-subscriber)
179+
INCLUDE_FEATURES=(fmt ansi json registry env-filter)
180+
${CARGO_MINVER[@]} --include-features "${INCLUDE_FEATURES[*]}"
181+
;;
182+
tracing-futures)
183+
EXCLUDE_FEATURES=(futures-01 futures_01 tokio tokio_01)
184+
${CARGO_MINVER[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
185+
;;
186+
*)
187+
${CARGO_MINVER[@]}
188+
;;
189+
esac
190+
shell: bash
220191

221192
### test jobs #############################################################
222193

@@ -240,11 +211,10 @@ jobs:
240211
runs-on: ${{ matrix.os }}
241212
steps:
242213
- uses: actions/checkout@v3
243-
- uses: actions-rs/toolchain@v1
214+
- name: "install Rust ${{ matrix.rust }}"
215+
uses: dtolnay/rust-toolchain@master
244216
with:
245217
toolchain: ${{ matrix.rust }}
246-
profile: minimal
247-
override: true
248218
- name: install cargo-nextest
249219
uses: taiki-e/install-action@nextest
250220
- name: Run tests
@@ -283,16 +253,11 @@ jobs:
283253
fail-fast: false
284254
steps:
285255
- uses: actions/checkout@v3
286-
- uses: actions-rs/toolchain@v1
256+
- uses: dtolnay/rust-toolchain@stable
287257
with:
288258
target: wasm32-unknown-unknown
289-
toolchain: stable
290-
override: true
291259
- name: build all tests
292-
uses: actions-rs/cargo@v1
293-
with:
294-
command: test
295-
args: --no-run -p ${{ matrix.subcrate }}
260+
run: cargo test --no-run -p ${{ matrix.subcrate }}
296261

297262
test-wasm:
298263
name: cargo test (wasm)
@@ -304,11 +269,9 @@ jobs:
304269
- tracing
305270
steps:
306271
- uses: actions/checkout@v3
307-
- uses: actions-rs/toolchain@v1
272+
- uses: dtolnay/rust-toolchain@stable
308273
with:
309274
target: wasm32-unknown-unknown
310-
toolchain: stable
311-
override: true
312275
- name: install test runner for wasm
313276
uses: taiki-e/install-action@wasm-pack
314277
- name: run wasm tests
@@ -321,11 +284,7 @@ jobs:
321284
runs-on: ubuntu-latest
322285
steps:
323286
- uses: actions/checkout@v3
324-
- uses: actions-rs/toolchain@v1
325-
with:
326-
toolchain: stable
327-
profile: minimal
328-
override: true
287+
- uses: dtolnay/rust-toolchain@stable
329288
- name: "Test log support"
330289
run: cargo test
331290
- name: "Test static max level"
@@ -338,12 +297,8 @@ jobs:
338297
run: cargo test --no-default-features
339298
# this skips running doctests under the `--no-default-features` flag,
340299
# as rustdoc isn't aware of cargo's feature flags.
341-
- name: "Test tracing-subscriber no-std support"
300+
- name: "Test tracing-subscriber with all features disabled"
342301
run: cargo test --lib --tests --no-default-features
343-
- name: "Test tracing-subscriber with liballoc only"
344-
run: cargo test --lib --tests --no-default-features --features "alloc"
345-
- name: "Test tracing-subscriber with no default features"
346-
run: cargo test --lib --tests --no-default-features --features "std"
347302

348303
# all required checks except for the main test run (which we only require
349304
# specific matrix combinations from)
@@ -352,11 +307,10 @@ jobs:
352307
runs-on: ubuntu-latest
353308
needs:
354309
- style
355-
- minimal-versions
356310
- cargo-hack
357311
- check-msrv
358312
- test-build-wasm
359313
- test-wasm
360314
- test-features-stable
361315
steps:
362-
- run: exit 0
316+
- run: exit 0

0 commit comments

Comments
 (0)