shortener 0.1.2

A simple URL shortener.
Documentation
name: Tests

on:
  push:
    branches:
      - main
    tags:
      - '**'
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions: {}

defaults:
  run:
    shell: bash -xeuo pipefail {0}

jobs:
  build:
    uses: ./.github/workflows/build.yml
    permissions:
      contents: read
    with:
      stable: false
      profile: dev
      cache: ${{ (github.event_name == 'push' && github.ref_type == 'branch') || github.event_name == 'pull_request' }}

  tests:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - name: Set up Rust
        run: |
          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
            sh -s -- -y --no-modify-path \
              --default-toolchain stable
      - name: Cache Cargo registry
        if: (github.event_name == 'push' && github.ref_type == 'branch') || github.event_name == 'pull_request'
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git/db
          key: tests-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            tests-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
            tests-cargo-${{ matrix.target }}-
            tests-cargo-${{ matrix.target }}-
      - name: Cache build artifacts
        if: (github.event_name == 'push' && github.ref_type == 'branch') || github.event_name == 'pull_request'
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            target
          key: tests-target-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            tests-target-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
            tests-target-${{ matrix.target }}-
      - name: Run format check
        run: cargo fmt --all --check
      - name: Run build
        run: cargo build --locked --all-targets --all-features
      - name: Run Clippy
        run: cargo clippy --locked --all-targets --all-features -- -D warnings
      - name: Run tests
        run: cargo test --locked --all-targets --all-features
      - name: Build and check docs
        run: RUSTDOCFLAGS="-D warnings" cargo doc --locked --all-features --no-deps