slog 2.8.2

Structured, extensible, composable logging for Rust
Documentation
# We use `actions-rs` for most of our actions
#
# This file is for the main tests. clippy & rustfmt are separate workflows
on: [push, pull_request]
name: Cargo Test

env:
  CARGO_TERM_COLOR: always
  # has a history of occasional bugs (especially on old versions)
  #
  # the ci is free so we might as well use it ;)
  CARGO_INCREMENTAL: 0


# Tested versions:
# 1. stable
# 2. nightly
# 3. Minimum Supported Rust Version (MSRV)

jobs:
  test:
    # Only run on PRs if the source branch is on someone else's repo
    if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false # Even if one job fails we still want to see the other ones
      matrix:
        rust:
          # Minimum Supported Rust Version
          #
          # This is hardcoded and needs to be in sync with Cargo.toml and the README
          #
          # If one of the features does not support this MSRV,
          # you need to remove this from the main list and manually add the desired
          # feature/version combinations to 'include'
          # This hack is not currently needed because serde-erased v0.3 supports our MSRV.
          - 1.61

          # Per the MSRV policy (discussed in Wiki/docs), this places an upper bound on the MSRV
          #
          # In other words, we can never raise the MSRV past this, and must always support it.
          - "stable minus 15 releases"
          #
          # Intermediate Releases (between MSRV and latest stable)
          # Be careful not to add these needlessly; they hold up CI
          # <nothing currently>

          # The most recent version of stable rust (automatically updated)
          - stable
          - nightly
        # NOTE: Features to test must be specified manually. They are applied to all versions separately.
        #
        # This has the advantage of being more flexible and thorough
        # This has the disadvantage of being more verbose
        #
        # Specific feature combos can be overridden per-version with 'include' and 'ecclude'
        features:
          - ""
          - "nested-values"
          - "dynamic-keys"
          - "std"
          - "std nested-values"
          - "std nested-values anyhow"
          - "std dynamic-keys"
          - "std nothreads"
          - "std nested-values dynamic-keys"
          - "std nested-values dynamic-keys nothreads"
          - "std nested-values dynamic-keys anyhow"
        include:
          # Our MSRV doesn't support parking_lot, so explicitly test it here
          - rust: stable
            features: "std nested-values parking_lot_0_12"

    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
        if: ${{ matrix.rust != 'nightly' }} # ineffective due to version key
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-minimal-versions,cargo-hack
      - name: Check
        run: |
          cargo check --all-targets --verbose --no-default-features --features "${{ matrix.features }}"
        # A failing `cargo check` always fails the build
        continue-on-error: false
      - name: Test
        # NOTE: Running --all-targets does not include doc tests
        run: |
          cargo test --all --verbose --no-default-features --features "${{ matrix.features }}"

        # We require tests to succeed on all the feature combinations.
        #
        # However, we can grant special exceptions for the Minimum Supported Rust Version
        # if there is a really good reason (like a dependency that requires a newer version).
        continue-on-error: false
      - name: Test (-Zminimal-versions)
        run:
          cargo minimal-versions test --all --verbose --no-default-features "${{ matrix.features }}"
      - name: rustdoc
        # Restrict to working on nightly/stable (old versions might have undefined types)
        if: ${{ matrix.rust == 'nightly' || matrix.rust == 'stable' }}
        env:
          RUSTDOCFLAGS: -Dwarnings
        run: |
          cargo doc --no-deps --all --verbose --no-default-features --features "${{ matrix.features }}"
  # Runs the same build that docs.rs does. See https://github.com/dtolnay/cargo-docs-rs
  docsrs:
    # Only run on PRs if the source branch is on someone else's repo
    if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}

    name: docs.rs
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@nightly
      - uses: dtolnay/install@cargo-docs-rs
      - run: cargo docs-rs