cargo-all 0.2.4

Manage all your crates with a single command.
name: Checks
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

env:
  CARGO_INCREMENTAL: 1
  CARGO_TERM_COLOR: always

  GITHUB_CACHE_VERSION: 1
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  RUST_BACKTRACE: full

jobs:
  cargo-checks:
    name: Task cargo ${{ matrix.action }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        action: [clippy, fmt, nextest]
    steps:
      - name: Fetch latest code
        uses: actions/checkout@v3
      - name: Cache cargo
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: cargo-${{ env.GITHUB_CACHE_VERSION }}-${{ matrix.action }}-
      - name: Cargo ${{ matrix.action }}
        if: matrix.action == 'clippy'
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --workspace --all-features --all-targets --locked
      - name: Cargo ${{ matrix.action }}
        if: matrix.action == 'fmt'
        run: cargo ${{ matrix.action }} --all -- --check
      - name: Install cargo-nextest
        if: matrix.action == 'nextest'
        uses: taiki-e/install-action@nextest
      - name: Cargo ${{ matrix.action }}
        if: matrix.action == 'nextest'
        run: cargo ${{ matrix.action }} run --release --workspace --all-features --all-targets --locked
      - name: Fast fail
        uses: vishnudxb/cancel-workflow@v1.2
        if: failure()
        with:
          repo: hack-ink/cargo-all
          workflow_id: ${{ github.run_id }}
          access_token: ${{ github.token }}