ZTC-1478: track the number of times a logger has been replaced with a child logger #143
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
RUSTFLAGS: -Dwarnings | |
RUST_BACKTRACE: 1 | |
jobs: | |
pr-status-checks: | |
name: Pull Request Status Checks | |
runs-on: ubuntu-latest | |
needs: | |
- docs | |
- deny | |
- clippy | |
- fmt | |
- check-features | |
- test | |
- minimal-versions | |
steps: | |
- run: exit 0 | |
docs: | |
name: Doc checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Nightly Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run doc checks | |
run: | | |
cargo doc --lib --no-deps --all-features --document-private-items | |
env: | |
RUSTDOCFLAGS: --cfg docsrs -Dwarnings --cfg tokio_unstable --cfg foundations_unstable | |
RUSTFLAGS: --cfg docsrs -Dwarnings --cfg tokio_unstable --cfg foundations_unstable | |
# based on tokio minver cbecm | |
minimal-versions: | |
name: minimal-versions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Nightly Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check minimal versions | |
env: | |
# empty those flags! | |
RUSTFLAGS: | |
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 --all-features --ignore-private | |
- name: Check minimal versions with unstable features | |
env: | |
RUSTFLAGS: --cfg tokio_unstable --cfg foundations_unstable | |
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 --all-features --ignore-private | |
deny: | |
name: Cargo deny checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run cargo deny checks | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
command: check | |
clippy: | |
name: Clippy checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run Clippy | |
run: | | |
cargo clippy --all-targets -- \ | |
-D warnings \ | |
-D unreachable_pub \ | |
-D clippy::await_holding_lock \ | |
-D clippy::clone_on_ref_ptr | |
env: | |
RUSTFLAGS: -Dwarnings --cfg tokio_unstable --cfg foundations_unstable | |
fmt: | |
name: fmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
# Check fmt | |
- name: "rustfmt --check" | |
# Workaround for rust-lang/cargo#7732 | |
# based on tokio's ci job | |
run: | | |
if ! rustfmt --check --edition 2021 $(git ls-files '*.rs'); then | |
printf "Please run \`rustfmt --edition 2021 \$(git ls-files '*.rs')\` to fix rustfmt errors.\n" >&2 | |
exit 1 | |
fi | |
check-features: | |
name: Check feature combinations | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Check | |
run: ./scripts/check-features.sh | |
shell: bash | |
check-tokio-unstable: | |
name: Check unstable | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Check unstable | |
run: cargo hack check --no-dev-deps | |
env: | |
RUSTFLAGS: -Dwarnings --cfg tokio_unstable --cfg foundations_unstable | |
test-tokio-unstable: | |
name: Test unstable | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Test unstable | |
run: cargo test --all-features | |
env: | |
RUSTFLAGS: -Dwarnings --cfg tokio_unstable --cfg foundations_unstable | |
_RJEM_MALLOC_CONF: prof:true | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
thing: | |
- x86_64-linux | |
- aarch64-linux | |
- arm64-android | |
- arm-android | |
- aarch64-ios | |
- x86_64-macos | |
include: | |
- apt_packages: "" | |
- custom_env: {} | |
- build_only: false | |
- cargo_args: "" | |
- thing: x86_64-linux | |
target: x86_64-unknown-linux-gnu | |
rust: stable | |
os: ubuntu-latest | |
- thing: aarch64-linux | |
build_only: true | |
target: aarch64-unknown-linux-gnu | |
rust: stable | |
os: ubuntu-latest | |
apt_packages: crossbuild-essential-arm64 | |
custom_env: | |
CC: aarch64-linux-gnu-gcc | |
CXX: aarch64-linux-gnu-g++ | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++ | |
- thing: arm64-android | |
build_only: true | |
target: aarch64-linux-android | |
rust: stable | |
os: ubuntu-latest | |
cargo_args: --no-default-features --features server-client-common-default | |
- thing: arm-android | |
build_only: true | |
target: armv7-linux-androideabi | |
rust: stable | |
os: ubuntu-latest | |
cargo_args: --no-default-features --features server-client-common-default | |
- thing: aarch64-ios | |
build_only: true | |
target: aarch64-apple-ios | |
rust: stable | |
os: macos-latest | |
cargo_args: --no-default-features --features server-client-common-default | |
- thing: x86_64-macos | |
target: x86_64-apple-darwin | |
rust: stable | |
os: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
targets: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install target-specific APT dependencies | |
if: "matrix.apt_packages != ''" | |
run: sudo apt update && sudo apt install -y ${{ matrix.apt_packages }} | |
shell: bash | |
- name: Set Android Linker path | |
if: endsWith(matrix.thing, '-android') | |
run: echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" >> "$GITHUB_ENV" | |
- name: Build tests | |
# We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets. | |
run: cargo build --target ${{ matrix.target }} ${{matrix.cargo_args}} | |
shell: bash | |
env: ${{ matrix.custom_env }} | |
- name: Run tests | |
if: "!matrix.build_only" | |
run: _RJEM_MALLOC_CONF=prof:true cargo test --target ${{ matrix.target }} ${{matrix.cargo_args}} | |
shell: bash | |
env: ${{ matrix.custom_env }} |