Add level metadata to spans #191
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: | |
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 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@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Check | |
run: cargo check --all --tests --benches | |
style: | |
# Check style. | |
name: cargo fmt | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: rustfmt | |
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@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all --examples --tests --benches -- -D warnings | |
cargo-hack: | |
needs: check | |
name: cargo check (feature combinations) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- run: cargo hack check --feature-powerset --no-dev-deps | |
check-msrv: | |
# Run `cargo check` on our minimum supported Rust version (1.60.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: | |
toolchain: | |
- 1.65.0 | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install Rust nightly | |
uses: dtolnay/rust-toolchain@nightly | |
- name: "install Rust ${{ matrix.toolchain }}" | |
uses: dtolnay/rust-toolchain@master | |
with: | |
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 | |
run: cargo minimal-versions check --feature-powerset --no-dev-deps | |
### 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@v4 | |
- name: "install Rust ${{ matrix.rust }}" | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: install cargo-nextest | |
uses: taiki-e/install-action@nextest | |
- name: Run tests | |
run: cargo nextest run --profile ci --workspace --all-features | |
# 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 --all-features | |
test-build-across-targets: | |
name: build tests (${{ matrix.target }}) | |
needs: check | |
strategy: | |
matrix: | |
target: [wasm32-unknown-unknown, wasm32-wasi] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: build all tests | |
run: cargo test --no-run --all-features | |
# 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 | |
- cargo-hack | |
- check-msrv | |
- test-build-across-targets | |
- test | |
steps: | |
- run: exit 0 |