stratify 1.1.0

Layered configuration and structured logging for Rust services: pluggable sources, priority merging, typed access, and a tracing facade
Documentation
name: CI

on:
  push:
    branches: [main]
  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