pingrep 25.3.0

A command-line tool to quickly and easily search through your Pinboard bookmarks locally
Documentation
name: CI tests
on: [push]

jobs:
  build:
    name: Build project
    runs-on: ubuntu-latest
    outputs:
      rustc_cache_key: ${{ steps.setup_rust.outputs.cachekey }}
    steps:
      - run: sudo apt install libdbus-1-dev pkg-config
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4
      - uses: dtolnay/rust-toolchain@stable
        id: setup_rust
        with:
          components: "rustfmt, clippy"
      - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf  # v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: "cargo-base-${{ steps.setup_rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}"
          restore-keys: |
            cargo-base-${{ env.RUSTC_CACHEKEY }}
      - run: cargo build --locked --all-targets

  test:
    name: Run tests and linters
    runs-on: ubuntu-latest
    needs: build
    steps:
      - run: sudo apt install libdbus-1-dev pkg-config
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4
      - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf  # v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: "cargo-lint-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
          restore-keys: |
            cargo-lint-${{ env.RUSTC_CACHEKEY }}
            cargo-base-${{ env.RUSTC_CACHEKEY }}
          fail-on-cache-miss: true

      - run: cargo fmt --all --check
      - run: cargo test
      - run: cargo clippy -- -D warnings


  pre-commit:
    name: Run pre-commit
    runs-on: ubuntu-latest
    needs: build
    env:
      # These hooks are expensive and already run as dedicated jobs above
      SKIP: "tests,clippy"
    steps:
      - run: sudo apt install libdbus-1-dev pkg-config
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4
      - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf  # v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: "cargo-lint-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
          restore-keys: |
            cargo-lint-${{ env.RUSTC_CACHEKEY }}
            cargo-base-${{ env.RUSTC_CACHEKEY }}
          fail-on-cache-miss: true

      - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38  # v5
      - name: set PYVERSION
        run: echo "PYVERSION=$(python --version | tr ' ' '-')" >> $GITHUB_ENV
      - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf  # v4
        with:
          path: ~/.cache/pre-commit
          # Changes to pre-commit-config.yaml may require the installation of
          # new binaries/scripts. When a cache hit occurs, changes to the cache
          # aren't persisted at the end of the run, so making the key dependent
          # on the configuration file ensures we always persist a complete cache.
          key: pre-commit-${{ env.PYVERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}

      - run: pip install pre-commit
      - run: pre-commit run --all --color=always --show-diff-on-failure