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

chore: backport changes since October 1st, 2023 #2794

Merged
merged 9 commits into from
Nov 7, 2023
167 changes: 56 additions & 111 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on:
push:
branches:
- master
- "v0.1.x"
pull_request: {}

Expand All @@ -27,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 @@ -40,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 @@ -58,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 Down Expand Up @@ -169,7 +121,7 @@ jobs:
shell: bash

check-msrv:
# Run `cargo check` on our minimum supported Rust version (1.56.0). This
# Run `cargo check` on our minimum supported Rust version (1.63.0). This
# checks with minimal versions; maximal versions are checked above.
name: "cargo check (+MSRV -Zminimal-versions)"
needs: check
Expand All @@ -191,32 +143,51 @@ jobs:
- tracing-tower
- tracing
toolchain:
- 1.56.0
- 1.63.0
- stable
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
with:
toolchain: nightly
profile: minimal
- name: Select minimal versions
uses: actions-rs/cargo@v1
- name: install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: "install Rust ${{ matrix.toolchain }}"
uses: dtolnay/rust-toolchain@master
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 @@ -240,11 +211,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 @@ -283,16 +253,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 @@ -304,34 +269,24 @@ 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
run: cd ${{ matrix.subcrate }} && wasm-pack test --node

test-features-stable:
# Feature flag tests that run on stable Rust.
# TODO(david): once tracing's MSRV goes up to Rust 1.51, we should be able to switch to
# using cargo's V2 feature resolver (https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions)
# and avoid cd'ing into each crate's directory.
name: cargo test (feature-specific)
needs: check
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"
- name: "Test static max level"
run: cargo test
working-directory: "tracing/test_static_max_level_features"
Expand All @@ -340,21 +295,12 @@ jobs:
working-directory: "tracing/test_static_max_level_features"
- name: "Test tracing-core no-std support"
run: cargo test --no-default-features
working-directory: tracing-core
- name: "Test tracing no-std support"
run: cargo test --lib --no-default-features
working-directory: tracing
run: cargo test --no-default-features
# this skips running doctests under the `--no-default-features` flag,
# as rustdoc isn't aware of cargo's feature flags.
- name: "Test tracing-subscriber no-std support"
- name: "Test tracing-subscriber with all features disabled"
run: cargo test --lib --tests --no-default-features
working-directory: tracing-subscriber
- name: "Test tracing-subscriber with liballoc only"
run: cargo test --lib --tests --no-default-features --features "alloc"
working-directory: tracing-subscriber
- name: "Test tracing-subscriber with no default features"
run: cargo test --lib --tests --no-default-features --features "std"
working-directory: tracing-subscriber

# all required checks except for the main test run (which we only require
# specific matrix combinations from)
Expand All @@ -363,11 +309,10 @@ jobs:
runs-on: ubuntu-latest
needs:
- style
- minimal-versions
- cargo-hack
- check-msrv
- test-build-wasm
- test-wasm
- test-features-stable
steps:
- run: exit 0
- run: exit 0
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]

resolver = "2"
members = [
"tracing",
"tracing-core",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ attachment that `Future::instrument` does.
## Supported Rust Versions

Tracing is built against the latest stable release. The minimum supported
version is 1.56. The current Tracing version is not guaranteed to build on Rust
version is 1.63. The current Tracing version is not guaranteed to build on Rust
versions earlier than the minimum supported version.

Tracing follows the same compiler support policies as the rest of the Tokio
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tracing-examples"
version = "0.0.0"
publish = false
edition = "2018"
rust-version = "1.56.0"
rust-version = "1.63.0"

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion tracing-appender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ categories = [
]
keywords = ["logging", "tracing", "file-appender", "non-blocking-writer"]
edition = "2018"
rust-version = "1.53.0"
rust-version = "1.63.0"

[dependencies]
crossbeam-channel = "0.5.6"
Expand Down
4 changes: 2 additions & 2 deletions tracing-appender/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ allows events and spans to be recorded in a non-blocking manner through a
dedicated logging thread. It also provides a [`RollingFileAppender`][file_appender]
that can be used with _or_ without the non-blocking writer.

*Compiler support: [requires `rustc` 1.53+][msrv]*
*Compiler support: [requires `rustc` 1.63+][msrv]*

[msrv]: #supported-rust-versions

Expand Down Expand Up @@ -146,7 +146,7 @@ fn main() {
## Supported Rust Versions

`tracing-appender` is built against the latest stable release. The minimum supported
version is 1.53. The current `tracing-appender` version is not guaranteed to build on
version is 1.63. The current `tracing-appender` version is not guaranteed to build on
Rust versions earlier than the minimum supported version.

Tracing follows the same compiler support policies as the rest of the Tokio
Expand Down
6 changes: 3 additions & 3 deletions tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! a dedicated logging thread. It also provides a [`RollingFileAppender`][file_appender] that can
//! be used with _or_ without the non-blocking writer.
//!
//! *Compiler support: [requires `rustc` 1.53+][msrv]*
//! *Compiler support: [requires `rustc` 1.63+][msrv]*
//!
//! [msrv]: #supported-rust-versions
//! [file_appender]: rolling::RollingFileAppender
Expand Down Expand Up @@ -124,7 +124,7 @@
//! ## Supported Rust Versions
//!
//! `tracing-appender` is built against the latest stable release. The minimum supported
//! version is 1.53. The current `tracing-appender` version is not guaranteed to build on
//! version is 1.63. The current `tracing-appender` version is not guaranteed to build on
//! Rust versions earlier than the minimum supported version.
//!
//! Tracing follows the same compiler support policies as the rest of the Tokio
Expand Down Expand Up @@ -190,7 +190,7 @@ pub(crate) mod sync;
/// });
/// # }
/// ```
pub fn non_blocking<T: Write + Send + Sync + 'static>(writer: T) -> (NonBlocking, WorkerGuard) {
pub fn non_blocking<T: Write + Send + 'static>(writer: T) -> (NonBlocking, WorkerGuard) {
NonBlocking::new(writer)
}

Expand Down
6 changes: 3 additions & 3 deletions tracing-appender/src/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ impl NonBlocking {
///
/// [default]: NonBlockingBuilder::default
/// [builder]: NonBlockingBuilder
pub fn new<T: Write + Send + Sync + 'static>(writer: T) -> (NonBlocking, WorkerGuard) {
pub fn new<T: Write + Send + 'static>(writer: T) -> (NonBlocking, WorkerGuard) {
NonBlockingBuilder::default().finish(writer)
}

fn create<T: Write + Send + Sync + 'static>(
fn create<T: Write + Send + 'static>(
writer: T,
buffered_lines_limit: usize,
is_lossy: bool,
Expand Down Expand Up @@ -221,7 +221,7 @@ impl NonBlockingBuilder {
}

/// Completes the builder, returning the configured `NonBlocking`.
pub fn finish<T: Write + Send + Sync + 'static>(self, writer: T) -> (NonBlocking, WorkerGuard) {
pub fn finish<T: Write + Send + 'static>(self, writer: T) -> (NonBlocking, WorkerGuard) {
NonBlocking::create(
writer,
self.buffered_lines_limit,
Expand Down
Loading
Loading