mirror of
https://github.com/tokio-rs/tracing.git
synced 2026-01-25 04:16:18 +00:00
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
109 lines
3.4 KiB
YAML
109 lines
3.4 KiB
YAML
name: Checks
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request: {}
|
|
|
|
env:
|
|
# Disable incremental compilation.
|
|
#
|
|
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
|
|
# as it lets the compiler avoid recompiling code that hasn't changed. However,
|
|
# on CI, we're not making small edits; we're almost always building the entire
|
|
# project from scratch. Thus, incremental compilation on CI actually
|
|
# introduces *additional* overhead to support making future builds
|
|
# faster...but no future builds will ever occur in any given CI environment.
|
|
#
|
|
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
|
|
# for details.
|
|
CARGO_INCREMENTAL: 0
|
|
# Allow more retries for network requests in cargo (downloading crates) and
|
|
# rustup (installing toolchains). This should help to reduce flaky CI failures
|
|
# from transient network timeouts or other issues.
|
|
CARGO_NET_RETRY: 10
|
|
RUSTUP_MAX_RETRIES: 10
|
|
# Don't emit giant backtraces in the CI logs.
|
|
RUST_BACKTRACE: short
|
|
|
|
jobs:
|
|
check:
|
|
# Run `cargo check` first to ensure that the pushed code at least compiles.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
override: true
|
|
- name: Check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --all --tests --benches
|
|
|
|
style:
|
|
# Check style.
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt
|
|
profile: minimal
|
|
override: true
|
|
- name: rustfmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
warnings:
|
|
# Check for any warnings. This is informational and thus is allowed to fail.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: clippy
|
|
profile: minimal
|
|
- name: Clippy
|
|
uses: actions-rs/clippy-check@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
args: --all --examples --tests --benches -- -D warnings
|
|
|
|
minimal-versions:
|
|
# Check for minimal-versions errors where a dependency is too
|
|
# underconstrained to build on the minimal supported version of all
|
|
# dependencies in the dependency graph.
|
|
name: minimal-versions
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
override: true
|
|
- name: Install cargo-hack
|
|
run: |
|
|
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
|
|
- name: "check --all-features -Z minimal-versions"
|
|
run: |
|
|
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
|
|
# from determining minimal versions based on dev-dependencies.
|
|
cargo hack --remove-dev-deps --workspace
|
|
# Update Cargo.lock to minimal version dependencies.
|
|
cargo update -Z minimal-versions
|
|
cargo hack check \
|
|
--package tracing \
|
|
--package tracing-core \
|
|
--package tracing-subscriber \
|
|
--all-features --ignore-private
|