name: Checks / CI on: push: workflow_dispatch: # Cancel in-progress runs when a new push is made to the same branch concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: fast-checks: name: Prek & Format runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false - name: Install uv uses: https://github.com/astral-sh/setup-uv@v6 with: enable-cache: true ignore-nothing-to-cache: true cache-dependency-glob: '' - name: Run prek (formerly prefligit) run: uvx prek run --show-diff-on-failure --color=always -v --all-files --hook-stage manual - name: Install rust nightly with rustfmt run: | uvx rustup override set nightly uvx rustup component add rustfmt - name: Check formatting run: | cargo +nightly fmt --all -- --check clippy: name: Clippy runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false - name: Install uv uses: https://github.com/astral-sh/setup-uv@v6 with: enable-cache: true ignore-nothing-to-cache: true cache-dependency-glob: '' # Disable Python dependency tracking for Rust project - name: Install Rust toolchain run: | # Install toolchain from rust-toolchain.toml uvx rustup show # This will auto-install from rust-toolchain.toml # cache-apt-pkgs-action requires apt lists to be initialised first - name: Update APT package lists run: sudo apt-get update - name: Cache system packages uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest with: packages: clang liburing-dev version: 1.0 - name: Cache Rust registry uses: actions/cache@v4 with: path: | ~/.cargo/git !~/.cargo/git/checkouts ~/.cargo/registry !~/.cargo/registry/src key: rust-registry-${{hashFiles('**/Cargo.lock') }} - name: Run Clippy lints run: | cargo clippy \ --workspace \ --features full \ --locked \ --no-deps \ --profile test \ -- \ -D warnings tests: name: Tests runs-on: ubuntu-latest env: SCCACHE_ENABLED: ${{ vars.GH_APP_ID != '' && secrets.GH_APP_PRIVATE_KEY != '' }} steps: - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false - name: Install uv uses: https://github.com/astral-sh/setup-uv@v6 with: enable-cache: true ignore-nothing-to-cache: true cache-dependency-glob: '' # Disable Python dependency tracking for Rust project - name: Install Rust toolchain run: | # Install toolchain from rust-toolchain.toml uvx rustup show # This will auto-install from rust-toolchain.toml # cache-apt-pkgs-action requires apt lists to be initialised first - name: Update APT package lists run: sudo apt-get update - name: Cache system packages uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest with: packages: clang liburing-dev version: 1.0 - name: Cache Rust registry uses: actions/cache@v4 with: path: | ~/.cargo/git !~/.cargo/git/checkouts ~/.cargo/registry !~/.cargo/registry/src key: rust-registry-${{hashFiles('**/Cargo.lock') }} - name: Create GitHub App token for sccache if: env.SCCACHE_ENABLED == 'true' uses: https://github.com/actions/create-github-app-token@v1 id: app-token with: app-id: ${{ vars.GH_APP_ID }} private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} github-api-url: https://api.github.com owner: ${{ vars.GH_APP_OWNER }} repositories: "" - name: Setup sccache if: env.SCCACHE_ENABLED == 'true' uses: ./.forgejo/actions/sccache with: token: ${{ steps.app-token.outputs.token }} - name: Setup Timelord if: env.SCCACHE_ENABLED == 'true' uses: ./.forgejo/actions/timelord with: key: sccache-v0 path: . - name: Run Cargo tests run: | cargo test \ --workspace \ --features full \ --locked \ --profile test \ --all-targets \ --no-fail-fast - name: Display sccache statistics if: always() && env.SCCACHE_ENABLED == 'true' run: sccache --show-stats