Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CI msrv & minver checks #2238

Merged
merged 7 commits into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 81 additions & 143 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ env:
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
MSRV: 1.49.0
# TODO: remove this once tracing's MSRV is bumped.
APPENDER_MSRV: 1.53.0

jobs:
### check jobs ###
Expand All @@ -39,16 +36,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: dtolnay/rust-toolchain@stable
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --tests --benches
run: cargo check --all --tests --benches

style:
# Check style.
Expand All @@ -57,64 +47,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
profile: minimal
override: true
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

warnings:
# Check for any warnings. This is informational and thus is allowed to fail.
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
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: cargo check (-Zminimal-versions)
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: install cargo-hack
uses: taiki-e/install-action@cargo-hack
- 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

cargo-hack:
needs: check
name: cargo check (feature combinations)
Expand All @@ -137,11 +90,7 @@ jobs:
- tracing-subscriber
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: dtolnay/rust-toolchain@stable

- name: install cargo-hack
uses: taiki-e/install-action@cargo-hack
Expand Down Expand Up @@ -174,77 +123,80 @@ jobs:
shell: bash

check-msrv:
# Run `cargo check` on our minimum supported Rust version (1.49.0).
name: "cargo check (MSRV on ubuntu-latest)"
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "install Rust ${{ env.MSRV }}"
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.MSRV }}
profile: minimal
- name: "install Rust nightly"
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
- name: Select minimal versions
uses: actions-rs/cargo@v1
with:
command: update
args: -Z minimal-versions
toolchain: nightly
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
# skip the following crates:
# - tracing-appender, as it has its own MSRV.
# TODO(eliza): remove this when appender is on the same MSRV as
# everything else
# - the examples, as they are not published & we don't care about
# MSRV support for them.
# - tracing-futures, as it depends on ancient tokio versions.
# TODO(eliza): remove this when the ancient tokio deps are dropped
args: >-
--workspace --all-features --locked
--exclude=tracing-appender
--exclude=tracing-examples
--exclude=tracing-futures
toolchain: ${{ env.MSRV }}

# TODO: remove this once tracing's MSRV is bumped.
check-msrv-appender:
# Run `cargo check` on our minimum supported Rust version (1.53.0).
name: "cargo check (tracing-appender MSRV)"
# Run `cargo check` on our minimum supported Rust version (1.49.0). This
# checks with minimal versions; maximal versions are checked above.
name: "cargo check (+MSRV -Zminimal-versions)"
needs: check
runs-on: ubuntu-latest
strategy:
matrix:
# cargo hack --feature-powerset will have a significant permutation
# number, we can't just use --all as it increases the runtime
# further than what we would like to
subcrate:
- tracing-attributes
- tracing-core
- tracing-futures
- tracing-log
- tracing-macros
- tracing-serde
- tracing-tower
- tracing-opentelemetry
- tracing
- tracing-subscriber
toolchain:
- 1.49.0
- stable
# TODO(eliza): remove this when appender is on the same MSRV.
exclude:
- subcrate: tracing-appender
toolchain: 1.49.0
include:
- subcrate: tracing-appender
toolchain: 1.53.0
steps:
- uses: actions/checkout@v3
- name: "install Rust ${{ env.APPENDER_MSRV }}"
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.APPENDER_MSRV }}
profile: minimal
- name: "install Rust nightly"
uses: actions-rs/toolchain@v1
- name: install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: "install Rust ${{ matrix.toolchain }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
profile: minimal
- name: Select minimal versions
uses: actions-rs/cargo@v1
with:
command: update
args: -Z minimal-versions
toolchain: nightly
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --locked -p tracing-appender
toolchain: ${{ env.APPENDER_MSRV }}
toolchain: ${{ matrix.toolchain }}
- name: install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: install cargo-minimal-versions
uses: taiki-e/install-action@cargo-minimal-versions
- name: cargo minimal-versions check
working-directory: ${{ matrix.subcrate }}
# tracing and tracing-subscriber have too many features to be checked by
# cargo-hack --feature-powerset with all features in the powerset, so
# exclude some
run: |
CARGO_MINVER=(cargo minimal-versions check --feature-powerset --no-dev-deps)
case "${{ matrix.subcrate }}" in
tracing)
EXCLUDE_FEATURES=(
max_level_off max_level_error max_level_warn max_level_info
max_level_debug max_level_trace release_max_level_off
release_max_level_error release_max_level_warn
release_max_level_info release_max_level_debug
release_max_level_trace
)
${CARGO_MINVER[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
;;
tracing-subscriber)
INCLUDE_FEATURES=(fmt ansi json registry env-filter)
${CARGO_MINVER[@]} --include-features "${INCLUDE_FEATURES[*]}"
;;
tracing-futures)
EXCLUDE_FEATURES=(futures-01 futures_01 tokio tokio_01)
${CARGO_MINVER[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
;;
*)
${CARGO_MINVER[@]}
;;
esac
shell: bash

### test jobs #############################################################

Expand All @@ -268,11 +220,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- name: "install Rust ${{ matrix.rust }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run tests
Expand Down Expand Up @@ -312,16 +263,11 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
toolchain: stable
override: true
- name: build all tests
uses: actions-rs/cargo@v1
with:
command: test
args: --no-run -p ${{ matrix.subcrate }}
run: cargo test --no-run -p ${{ matrix.subcrate }}

test-wasm:
name: cargo test (wasm)
Expand All @@ -333,11 +279,9 @@ jobs:
- tracing
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
toolchain: stable
override: true
- name: install test runner for wasm
uses: taiki-e/install-action@wasm-pack
- name: run wasm tests
Expand All @@ -353,11 +297,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: dtolnay/rust-toolchain@stable
- name: "Test log support"
run: cargo test
working-directory: "tracing/test-log-support"
Expand Down Expand Up @@ -386,10 +326,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- style
- minimal-versions
- cargo-hack
- check-msrv
- check-msrv-appender
- test-build-wasm
- test-wasm
- test-features-stable
Expand Down