1.4 KiB · text History 0d6bdf0
name: clippy
# Clippy over the two NIF crates, as a gate: any warning fails the run.
# The CLI's own clippy runs in cli/Dockerfile, with the same command.
on:
  push:
    branches: [master]
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

# A newer push supersedes this run: on a branch or PR the run in
# progress is cancelled; on master it finishes, and only a run still
# waiting is replaced.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
  clippy:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4

      # As the Dockerfile's builder: what the NIFs need to compile.
      - name: Build dependencies
        run: |
          sudo apt-get update -q
          sudo apt-get install -y -q --no-install-recommends \
            build-essential pkg-config libssl-dev libclang-dev

      # The same toolchain as checks.yml and the Dockerfile.
      - name: Rust
        run: |
          curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.92.0 -c clippy
          echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"

      - name: Clippy
        run: |
          set -eu
          for crate in native/gitgud_gix native/gitgud_apt native/gitgud_badge; do
            echo "::group::$crate"
            (cd "$crate" && cargo clippy --workspace --all-targets --locked -- -D warnings)
            echo "::endgroup::"
          done