selective_assertions 0.3.0

Macros for asserting equality of structs with the flexibility to exclude or focus on specific fields.
Documentation
name: "Test"
on:
  push:
    branches: ["main"]
  pull_request:
  schedule:
    - cron: "0 0 * * *"

jobs:
  test_on_stable:
    name: Rust test on stable
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu, macos, windows]
    timeout-minutes: 45
    steps:
      # Prepare
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
          components: rustfmt, clippy
      - run: rustc --version

      # Check compilation
      - name: Run cargo check
        run: cargo check --release --workspace --all-features

      # Check lints
      - name: Run cargo clippy
        run: |
          cargo clippy --version
          cargo clippy --all-targets --all-features -- -D warnings --no-deps

      # Check dependencies order
      # Run only on Ubuntu to ensure compatibility.
      - name: Install cargo-sort
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-sort
        if: matrix.os == 'ubuntu'
      - name: Run cargo sort
        run: cargo sort --check --workspace --grouped
        if: matrix.os == 'ubuntu'

      # Check formatting
      - name: Run cargo fmt
        run: |
          cargo fmt --version
          cargo fmt --all --check --message-format human

      # Run tests
      - name: Run tests with all features
        run: cargo test --all-features
      - name: Run tests for documentation
        run: cargo test --doc

  test_on_nightly:
    name: Rust test on nightly
    needs: test_on_stable
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu]
    steps:
      # Prepare
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly
      - run: rustc --version

      # Check unused dependencies
      - name: Install cargo-udeps
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-udeps
      - name: Run cargo +nightly udeps
        run: cargo +nightly udeps --release --workspace --all-targets --all-features