1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: CI
on:
push:
branches:
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- name: Format
run: cargo fmt --all -- --check
# Three feature sets, not two: default is the config-only crate, and
# `logging` on its own is what most services will actually compile, so
# both must stand without `--all-features` papering over a gating hole.
- name: Clippy (default features)
run: cargo clippy --all-targets -- -D warnings
- name: Clippy (logging)
run: cargo clippy --all-targets --features logging -- -D warnings
- name: Clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test (default features)
run: cargo test
- name: Test (logging)
run: cargo test --features logging
- name: Test (all features)
run: cargo test --all-features
# The whole one-crate design rests on this: a config-only consumer must
# compile none of the logging stack. If this ever fails, the crate has
# sprung a leak and the failure should be loud, not discovered in a
# consumer's build time.
- name: Default tree carries no logging dependencies
run: |
if cargo tree -e normal | grep -E "tracing-subscriber|tracing-appender|opentelemetry"; then
echo "::error::the default feature set pulls logging dependencies"
exit 1
fi
# Examples are documentation that compiles. Building them under clippy
# with warnings denied is what stops them drifting from the API.
- name: Examples
run: cargo clippy --examples --all-features -- -D warnings
# The three that need no external service are run for real, so an example
# that compiles but no longer does what its comments claim still fails.
- name: Run examples
run: |
cargo run --quiet --example basic
cargo run --quiet --example precedence
cargo run --quiet --example typed
cargo run --quiet --example custom_source
cargo run --quiet --example logging_basic --features logging
- name: Docs
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
msrv:
name: msrv (1.88.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
toolchain: 1.88.0
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
# A declared rust-version that CI never compiles with is a promise that
# drifts. Check, not test: the MSRV contract is "it builds", and the
# behavioural suite already runs on stable.
- name: Check (all features on MSRV)
run: cargo check --all-targets --all-features
deny:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2
with:
command: check advisories bans sources licenses