name: lint
on:
  push:
    branches:
      - main
  pull_request:
jobs:
  clippy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: raviqqe/rust-cache@v1
      - run: cargo clippy -- -D warnings
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: cargo fmt -- --check
  spell_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: streetsidesoftware/cspell-action@main
        with:
          files: "**/*.{md,rs,sh,toml}"
  readme:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: lycheeverse/lychee-action@v2
        with:
          fail: true
  lint:
    needs:
      - clippy
      - format
      - readme
      - spell_check
    if: always()
    runs-on: ubuntu-latest
    steps:
      - run: for result in ${{ join(needs.*.result, ' ') }}; do [ $result = success ]; done
