Skip to content

Commit d91af65

Browse files
udoproghawkw
authored andcommitted
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 ce613f8 commit d91af65

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/CI.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,32 @@ jobs:
222222
with:
223223
token: ${{ secrets.GITHUB_TOKEN }}
224224
args: --all --examples --tests --benches -- -D warnings
225+
226+
minimal-versions:
227+
# Check for minimal-versions errors where a dependency is too
228+
# underconstrained to build on the minimal supported version of all
229+
# dependencies in the dependency graph.
230+
name: minimal-versions
231+
runs-on: ubuntu-latest
232+
steps:
233+
- uses: actions/checkout@v2
234+
- uses: actions-rs/toolchain@v1
235+
with:
236+
toolchain: nightly
237+
profile: minimal
238+
override: true
239+
- name: Install cargo-hack
240+
run: |
241+
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
242+
- name: "check --all-features -Z minimal-versions"
243+
run: |
244+
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
245+
# from determining minimal versions based on dev-dependencies.
246+
cargo hack --remove-dev-deps --workspace
247+
# Update Cargo.lock to minimal version dependencies.
248+
cargo update -Z minimal-versions
249+
cargo hack check \
250+
--package tracing \
251+
--package tracing-core \
252+
--package tracing-subscriber \
253+
--all-features --ignore-private

tracing-core/Cargo.toml

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

3636
[dependencies]
37-
lazy_static = { version = "1", optional = true }
37+
lazy_static = { version = "1.0.2", optional = true }
3838

3939
[target.'cfg(tracing_unstable)'.dependencies]
4040
valuable = { version = "0.1.0", optional = true, default_features = false }

0 commit comments

Comments
 (0)