json-subscriber 0.2.8

Customizable layer and subscriber for `tracing` that emits logs in JSON
name: CI

env:
  CARGO_TERM_COLOR: always
  MSRV: '1.75.0'

on:
  push:
    branches:
    - main
  pull_request: {}

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@beta
      with:
        components: clippy
    - uses: dtolnay/rust-toolchain@nightly
      with:
        components: rustfmt
    - uses: Swatinem/rust-cache@v2
    - name: Check
      run: cargo +beta clippy --workspace --all-targets --all-features -- -D warnings
    - name: rustfmt
      run: cargo +nightly fmt --all --check

  check-docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: cargo doc
      env:
        RUSTDOCFLAGS: "-D missing_docs -D rustdoc::all -A rustdoc::private-doc-tests"
      run: cargo doc --all-features --no-deps

  cargo-hack:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: Install cargo-hack
      run: |
        curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
    - name: cargo hack check
      run: cargo hack check --each-feature --no-dev-deps --all

  test-versions:
    needs: check
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust: [stable, beta, nightly]
    steps:
    - uses: actions/checkout@v4
    - uses: taiki-e/install-action@protoc
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.rust }}
    - uses: Swatinem/rust-cache@v2
    - name: Run tests
      run: cargo test --workspace --all-features --all-targets

  test-msrv:
    needs: check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ env.MSRV }}
    - name: "install Rust nightly"
      uses: dtolnay/rust-toolchain@nightly
    - uses: Swatinem/rust-cache@v2
    - name: Select minimal version
      run: cargo +nightly update -Z minimal-versions
    - name: Run tests
      run: |
        cargo update -p regex --precise 1.5.3
        cargo +${{ env.MSRV }} test --workspace --all-features --all-targets --locked

  deny-check:
    name: cargo-deny check
    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.checks == 'advisories' }}
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources
    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          command: check ${{ matrix.checks }}
          arguments: --features tracing-log,env-filter
          manifest-path: Cargo.toml

  typos:
    name: Spell Check with Typos
    runs-on: ubuntu-latest
    if: github.event_name == 'push' || !github.event.pull_request.draft

    steps:
      - name: Checkout Actions Repository
        uses: actions/checkout@v4

      - name: Check the spelling of the files in our repo
        uses: crate-ci/typos@v1.20.8