Skip to content

Commit 6b239da

Browse files
authored
chore(ci): add a minimal-versions check (#2015)
This adds a minimal-versions check to the tracing project. Adapted from `tokio-rs/tokio`. Adding this avoids breaking downstream dependencies from accidentally under-constraining minimal versions of dependencies when they depend on tracing. I've currently just introduced the check. I will try to and do encourage others to add patches to fix this where possible since it can be a fair bit of work to chase down a version of all dependencies that passes minimal-versions and is msrv. I've also seen some really odd windows-specific issues (which are not being tested for here). This is currently only testing `tracing`, `tracing-core`, and `tracing-subscriber`. Packages such as `tracing-futures` are proving to be a bit harder to deal with due to having features which enable very old dependencies. Steps to test the build minimal versions locally: ```sh cargo install cargo-hack rustup default nightly cargo hack --remove-dev-deps --workspace cargo update -Z minimal-versions cargo hack check --all-features --ignore-private ``` CC: tokio-rs/tokio#4513
1 parent 09632fa commit 6b239da

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.github/workflows/check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,32 @@ jobs:
7777
with:
7878
token: ${{ secrets.GITHUB_TOKEN }}
7979
args: --all --examples --tests --benches -- -D warnings
80+
81+
minimal-versions:
82+
# Check for minimal-versions errors where a dependency is too
83+
# underconstrained to build on the minimal supported version of all
84+
# dependencies in the dependency graph.
85+
name: minimal-versions
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v2
89+
- uses: actions-rs/toolchain@v1
90+
with:
91+
toolchain: nightly
92+
profile: minimal
93+
override: true
94+
- name: Install cargo-hack
95+
run: |
96+
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
97+
- name: "check --all-features -Z minimal-versions"
98+
run: |
99+
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
100+
# from determining minimal versions based on dev-dependencies.
101+
cargo hack --remove-dev-deps --workspace
102+
# Update Cargo.lock to minimal version dependencies.
103+
cargo update -Z minimal-versions
104+
cargo hack check \
105+
--package tracing \
106+
--package tracing-core \
107+
--package tracing-subscriber \
108+
--all-features --ignore-private

tracing-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ std = ["lazy_static", "alloc"]
3535
maintenance = { status = "actively-developed" }
3636

3737
[dependencies]
38-
lazy_static = { version = "1", optional = true }
38+
lazy_static = { version = "1.0.2", optional = true }
3939

4040
[package.metadata.docs.rs]
4141
all-features = true

tracing-subscriber/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ serde = { version = "1.0", optional = true }
5757
tracing-serde = { path = "../tracing-serde", version = "0.2", optional = true }
5858

5959
# opt-in deps
60-
parking_lot = { version = ">= 0.7, <= 0.12", optional = true }
60+
parking_lot = { version = ">= 0.9.0, <= 0.12", optional = true }
6161

6262
# registry
6363
sharded-slab = { version = "0.1.0", optional = true }

0 commit comments

Comments
 (0)