gor-cli 0.2.0

A Rust CLI for GitHub — a 'gh' clone
Documentation
name: CI

on:
  push:
  pull_request:

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -Dwarnings
  RUSTDOCFLAGS: -Dwarnings

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Install system dependencies
        run: sudo apt-get update -y && sudo apt-get install -y libdbus-1-dev

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9  # v1
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4  # v2.9.1

      - name: Check formatting
        run: cargo fmt --all --check

      - name: Clippy
        run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings

      - name: Install cargo-deny
        run: cargo install cargo-deny --locked

      - name: Cargo deny
        run: cargo deny check advisories bans licenses sources

      - name: Typos
        uses: crate-ci/typos@bee27e3a4fd1ea2111cf90ab89cd076c870fce14  # v1.48.0

      - name: Install cargo-shear
        run: cargo install cargo-shear --locked

      - name: Cargo shear (unused dependency check)
        run: cargo shear

  doc:
    name: Docs
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9  # v1
        with:
          toolchain: stable

      - name: Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4  # v2.9.1

      - name: Build documentation
        run: RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps

      - name: Doc tests
        run: cargo test --doc

  test:
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-24.04, macos-14, windows-2022]
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Install system dependencies
        if: runner.os == 'Linux'
        run: sudo apt-get update -y && sudo apt-get install -y libdbus-1-dev

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9  # v1
        with:
          toolchain: stable

      - name: Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4  # v2.9.1

      - name: Install nextest
        uses: taiki-e/install-action@43aecc8d72668fbcfe75c31400bc4f890f1c5853  # v2.83.2
        with:
          tool: nextest

      - name: Run tests (nextest)
        run: cargo nextest run --workspace --all-features

      - name: Run doc tests
        run: cargo test --workspace --all-features --doc

  coverage:
    name: Coverage
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Install system dependencies
        run: sudo apt-get update -y && sudo apt-get install -y libdbus-1-dev

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9  # v1
        with:
          toolchain: stable
          components: llvm-tools

      - name: Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4  # v2.9.1

      - name: Install cargo-llvm-cov and nextest
        uses: taiki-e/install-action@43aecc8d72668fbcfe75c31400bc4f890f1c5853  # v2.83.2
        with:
          tool: cargo-llvm-cov,nextest

      - name: Generate coverage
        run: cargo llvm-cov nextest --workspace --all-features --lcov --output-path lcov.info

      - name: Upload to Codecov
        uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f  # v6.0.2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: lcov.info
          disable_search: true

  msrv:
    name: MSRV
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Install system dependencies
        run: sudo apt-get update -y && sudo apt-get install -y libdbus-1-dev

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9  # v1
        with:
          toolchain: stable

      - name: Install MSRV toolchain
        run: rustup toolchain install 1.86.0 --profile minimal --no-self-update

      - name: Check with MSRV
        run: cargo +1.86.0 check --locked --all-features

  trivy:
    name: Trivy scan
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Run Trivy vulnerability scanner
        uses: aquasecurity/trivy-action@a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8  # v0.36.0
        with:
          scan-type: fs
          scan-ref: .
          scanners: vuln,secret,misconfig
          format: table
          exit-code: '1'
          severity: CRITICAL,HIGH
          trivy-config: trivy.yaml

  kingfisher:
    name: Kingfisher secret scan
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3

      - name: Run Kingfisher secret scanner
        run: |
          docker run --rm \
            -v "$PWD":/src \
            ghcr.io/mongodb/kingfisher:latest scan /src \
            --config /src/kingfisher.yaml