mirror of
https://github.com/tokio-rs/tracing.git
synced 2026-01-25 04:16:18 +00:00
chore(ci): test workflow embetterments (#2176)
This branch makes the following changes to the CI test workflows: - Consolidate all tests into a single workflow again. We had previously broken things out to allow restarting only some failed checks, but now GitHub Actions allows restarting individual jobs, which is much nicer, and we can combine everything into one workflow. - Gate starting any tests/checks on an initial `cargo check` run. This should mean that if code doesn't compile, we don't spin up a huge number of test jobs that all end up failing, and delaying other PRs' CI runs. - Use `cargo nextest` for running tests. This should make test runs a bit quicker, and also get us other nice features like retries for flaky tests. - Switch to `taiki-e/install-action` for installing stuff like `cargo-hack`, `nextest`, and `wasm-pack`. This is a bit nicer than just `curl`ing stuff. - Use a matrix for testing across toolchains/OSes, instead of having separate jobs. This reduces the complexity of the CI workflow a bit. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
12
.config/nextest.toml
Normal file
12
.config/nextest.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
# recommended nextest profile for CI jobs (from
|
||||
# https://nexte.st/book/configuration.html#profiles)
|
||||
[profile.ci]
|
||||
# Print out output for failing tests as soon as they fail, and also at the end
|
||||
# of the run (for easy scrollability).
|
||||
failure-output = "immediate-final"
|
||||
# Do not cancel the test run on the first failure.
|
||||
fail-fast = false
|
||||
|
||||
# TODO(eliza): uncomment this when we can get nicer JUnit output from nextest...
|
||||
# [profile.ci.junit]
|
||||
# path = "junit.xml"
|
||||
397
.github/workflows/CI.yml
vendored
Normal file
397
.github/workflows/CI.yml
vendored
Normal file
@@ -0,0 +1,397 @@
|
||||
name: CI
|
||||
|
||||
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
|
||||
MSRV: 1.49.0
|
||||
# TODO: remove this once tracing's MSRV is bumped.
|
||||
APPENDER_MSRV: 1.53.0
|
||||
|
||||
jobs:
|
||||
### check jobs ###
|
||||
|
||||
check:
|
||||
# Run `cargo check` first to ensure that the pushed code at least compiles.
|
||||
name: cargo check
|
||||
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.
|
||||
name: cargo fmt
|
||||
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
|
||||
needs: check
|
||||
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: cargo check (-Zminimal-versions)
|
||||
needs: check
|
||||
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
|
||||
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)
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: install cargo-hack
|
||||
uses: taiki-e/install-action@cargo-hack
|
||||
- name: cargo hack 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_HACK=(cargo hack 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_HACK[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
|
||||
;;
|
||||
tracing-subscriber)
|
||||
INCLUDE_FEATURES=(fmt ansi json registry env-filter)
|
||||
${CARGO_HACK[@]} --include-features "${INCLUDE_FEATURES[*]}"
|
||||
;;
|
||||
*)
|
||||
${CARGO_HACK[@]}
|
||||
;;
|
||||
esac
|
||||
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@master
|
||||
- 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)"
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- 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
|
||||
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 }}
|
||||
|
||||
### test jobs #############################################################
|
||||
|
||||
test:
|
||||
# Test against stable Rust across macOS, Windows, and Linux, and against
|
||||
# beta and nightly rust on Ubuntu.
|
||||
name: "cargo test (${{ matrix.rust }} on ${{ matrix.os }})"
|
||||
needs: check
|
||||
strategy:
|
||||
matrix:
|
||||
# test all Rust versions on ubuntu-latest
|
||||
os: [ubuntu-latest]
|
||||
rust: [stable, beta, nightly]
|
||||
# test stable Rust on Windows and MacOS as well
|
||||
include:
|
||||
- rust: stable
|
||||
os: windows-latest
|
||||
- rust: stable
|
||||
os: macos-latest
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: install cargo-nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
- name: Run tests
|
||||
run: cargo nextest run --profile ci --workspace
|
||||
# TODO(eliza): punt on this for now because the generated JUnit report is
|
||||
# missing some fields that this action needs to give good output.
|
||||
# - name: Publish Test Report
|
||||
# uses: mikepenz/action-junit-report@v3
|
||||
# if: always() # always run even if the previous step fails
|
||||
# with:
|
||||
# report_paths: 'target/nextest/ci/junit.xml'
|
||||
# check_name: "cargo test (Rust ${{ matrix.rust }} on ${{ matrix.os }})"
|
||||
# check_title_template: "{{SUITE_NAME}}::{{TEST_NAME}}"
|
||||
- name: Run doctests
|
||||
run: cargo test --doc --workspace
|
||||
|
||||
test-build-wasm:
|
||||
name: build tests (wasm)
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# TODO(securityinsanity): slowly add wasm32 test runner to each crate, and move to seperate actions that run tests.
|
||||
subcrate:
|
||||
- tracing-appender
|
||||
- tracing-attributes
|
||||
- tracing-core
|
||||
- tracing-error
|
||||
- tracing-flame
|
||||
- tracing-journald
|
||||
- tracing-log
|
||||
- tracing-macros
|
||||
- tracing-opentelemetry
|
||||
- tracing-serde
|
||||
- tracing-subscriber
|
||||
- tracing-tower
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
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 }}
|
||||
|
||||
test-wasm:
|
||||
name: cargo test (wasm)
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
subcrate:
|
||||
- tracing
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
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@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
- 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"
|
||||
- name: "Test static max level (release)"
|
||||
run: cargo test --release
|
||||
working-directory: "tracing/test_static_max_level_features"
|
||||
- name: "Test tracing-core no-std support"
|
||||
run: cargo test --no-default-features
|
||||
working-directory: tracing
|
||||
- name: "Test tracing no-std support"
|
||||
run: cargo test --no-default-features
|
||||
working-directory: tracing
|
||||
# this skips running doctests under the `--no-default-features` flag,
|
||||
# as rustdoc isn't aware of cargo's feature flags.
|
||||
- name: "Test tracing-subscriber with all features disabled"
|
||||
run: cargo test --lib --tests --no-default-features
|
||||
working-directory: tracing-subscriber
|
||||
|
||||
# all required checks except for the main test run (which we only require
|
||||
# specific matrix combinations from)
|
||||
all_required:
|
||||
name: "all systems go!"
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- style
|
||||
- minimal-versions
|
||||
- cargo-hack
|
||||
- check-msrv
|
||||
- check-msrv-appender
|
||||
- test-build-wasm
|
||||
- test-wasm
|
||||
- test-features-stable
|
||||
steps:
|
||||
- run: exit 0
|
||||
108
.github/workflows/check.yml
vendored
108
.github/workflows/check.yml
vendored
@@ -1,108 +0,0 @@
|
||||
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
|
||||
120
.github/workflows/check_features.yml
vendored
120
.github/workflows/check_features.yml
vendored
@@ -1,120 +0,0 @@
|
||||
name: Check Features
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "v0.1.x"
|
||||
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:
|
||||
cargo-hack:
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
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: cargo hack 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_HACK=(cargo hack 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_HACK[@]} --exclude-features "${EXCLUDE_FEATURES[*]}"
|
||||
;;
|
||||
tracing-subscriber)
|
||||
INCLUDE_FEATURES=(fmt ansi json registry env-filter)
|
||||
${CARGO_HACK[@]} --include-features "${INCLUDE_FEATURES[*]}"
|
||||
;;
|
||||
*)
|
||||
${CARGO_HACK[@]}
|
||||
;;
|
||||
esac
|
||||
shell: bash
|
||||
|
||||
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.
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
- 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"
|
||||
- name: "Test static max level (release)"
|
||||
run: cargo test --release
|
||||
working-directory: "tracing/test_static_max_level_features"
|
||||
- name: "Test tracing-core no-std support"
|
||||
run: cargo test --no-default-features
|
||||
working-directory: tracing
|
||||
- name: "Test tracing no-std support"
|
||||
run: cargo test --no-default-features
|
||||
working-directory: tracing
|
||||
# this skips running doctests under the `--no-default-features` flag,
|
||||
# as rustdoc isn't aware of cargo's feature flags.
|
||||
- name: "Test tracing-subscriber with all features disabled"
|
||||
run: cargo test --lib --tests --no-default-features
|
||||
working-directory: tracing-subscriber
|
||||
102
.github/workflows/check_msrv.yml
vendored
102
.github/workflows/check_msrv.yml
vendored
@@ -1,102 +0,0 @@
|
||||
name: Check MSRV
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "v0.1.x"
|
||||
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
|
||||
MSRV: 1.49.0
|
||||
# TODO: remove this once tracing's MSRV is bumped.
|
||||
APPENDER_MSRV: 1.53.0
|
||||
|
||||
jobs:
|
||||
check-msrv:
|
||||
# Run `cargo check` on our minimum supported Rust version (1.49.0).
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- 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).
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- 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
|
||||
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 }}
|
||||
48
.github/workflows/test_os.yml
vendored
48
.github/workflows/test_os.yml
vendored
@@ -1,48 +0,0 @@
|
||||
name: Tests (OS)
|
||||
|
||||
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:
|
||||
test-os:
|
||||
# Test against stable Rust across macOS, Windows, and Linux.
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all
|
||||
50
.github/workflows/test_versions.yml
vendored
50
.github/workflows/test_versions.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: Tests (Versions)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "v0.1.x"
|
||||
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:
|
||||
test-versions:
|
||||
# Test against the stable, beta, and nightly Rust toolchains on ubuntu-latest.
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
rust: [stable, beta, nightly]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all
|
||||
80
.github/workflows/test_wasm.yml
vendored
80
.github/workflows/test_wasm.yml
vendored
@@ -1,80 +0,0 @@
|
||||
name: Tests (WASM)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "v0.1.x"
|
||||
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:
|
||||
test-build-wasm:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# TODO(securityinsanity): slowly add wasm32 test runner to each crate, and move to seperate actions that run tests.
|
||||
subcrate:
|
||||
- tracing-appender
|
||||
- tracing-attributes
|
||||
- tracing-core
|
||||
- tracing-error
|
||||
- tracing-flame
|
||||
- tracing-journald
|
||||
- tracing-log
|
||||
- tracing-macros
|
||||
- tracing-opentelemetry
|
||||
- tracing-serde
|
||||
- tracing-subscriber
|
||||
- tracing-tower
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
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 }}
|
||||
|
||||
test-wasm:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
subcrate:
|
||||
- tracing
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
target: wasm32-unknown-unknown
|
||||
toolchain: stable
|
||||
override: true
|
||||
- name: install test runner for wasm
|
||||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
- name: run wasm tests
|
||||
run: cd ${{ matrix.subcrate }} && wasm-pack test --node
|
||||
@@ -23,6 +23,7 @@ default = ["std-future", "std"]
|
||||
futures-01 = ["futures_01", "std"]
|
||||
futures-03 = ["std-future", "futures", "futures-task", "std"]
|
||||
std-future = ["pin-project-lite"]
|
||||
tokio = ["tokio_01"]
|
||||
std = ["tracing/std"]
|
||||
|
||||
[dependencies]
|
||||
@@ -32,13 +33,12 @@ futures-task = { version = "0.3", optional = true }
|
||||
pin-project-lite = { version = "0.2.4", optional = true }
|
||||
tracing = { path = "../tracing", version = "0.2", default-features = false }
|
||||
tokio-executor = { version = "0.1", optional = true }
|
||||
tokio = { version = "0.1", optional = true }
|
||||
tokio_01 = { package = "tokio", version = "0.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = "1"
|
||||
tokio-test = "0.4"
|
||||
tracing-core = { path = "../tracing-core", version = "0.2" }
|
||||
tracing-mock = { path = "../tracing-mock" }
|
||||
tracing-mock = { path = "../tracing-mock", features = ["tokio-test"] }
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
||||
@@ -44,7 +44,7 @@ pub use self::tokio::*;
|
||||
mod tokio {
|
||||
use crate::{Instrument, Instrumented, WithDispatch};
|
||||
use futures_01::Future;
|
||||
use tokio::{
|
||||
use tokio_01::{
|
||||
executor::{Executor, SpawnError, TypedExecutor},
|
||||
runtime::{current_thread, Runtime, TaskExecutor},
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ publish = false
|
||||
[dependencies]
|
||||
tracing = { path = "../tracing", version = "0.2", default-features = false }
|
||||
tracing-core = { path = "../tracing-core", version = "0.2", default-features = false }
|
||||
tokio-test = { version = "0.3.0", optional = true }
|
||||
tokio-test = { version = "0.4", optional = true }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
Reference in New Issue
Block a user