serde-json-assert 0.4.0

Flexible JSON assertions
Documentation
on:
  push:
    branches:
      - main
    tags:
      - "*"
  pull_request:

name: CI
jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable

      # make sure all code has been formatted with rustfmt
      - name: check rustfmt
        run: |
          rustup component add rustfmt
          cargo fmt -- --check --color always --config comment_width=100 --config wrap_comments=true

      # run clippy to verify we have no warnings
      - run: cargo fetch
      - name: cargo clippy
        run: |
          rustup component add clippy
          cargo clippy --all-targets --all-features -- -D warnings

  test:
    name: Test
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - run: cargo fetch
      - name: cargo test build
        # Note the use of release here means longer compile time, but much
        # faster test execution time. If you don't have any heavy tests it
        # might be faster to take off release and just compile in debug
        run: cargo build --tests --release
      - name: cargo test
        run: cargo test --release

  publish-check:
    name: Publish Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - run: cargo fetch
      - name: cargo publish check
        run: cargo publish --dry-run

  # Remove this job if you don't publish the crate(s) from this repo
  # You must add a crates.io API token to your GH secrets called CRATES_IO_TOKEN
  publish:
    name: Publish
    needs: [test, publish-check]
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/')
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
      with:
        toolchain: stable
    - run: cargo fetch
    - run: cargo publish
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}