Skip to content

fix(cli): say "1 file" in the scan summary for a one-file scan #161

fix(cli): say "1 file" in the scan summary for a one-file scan

fix(cli): say "1 file" in the scan summary for a one-file scan #161

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
# A new push to the same PR cancels the still-running previous run —
# no point finishing checks for a commit that's already been superseded.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Which parts of the tree a change touches. Only consumer right now is
# the Tauri compile below, which is far too slow to run on a doc-only PR.
changes:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: read
outputs:
app: ${{ steps.filter.outputs.app }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
app:
- 'crates/**'
- 'app/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
# Formatting and lints answer the same on every platform, so they run
# once rather than three times.
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: swatinem/rust-cache@v2
# Core + CLI only: building the Tauri crate needs webkitgtk, which
# lints of the library don't need. `app-tauri` below covers the shell.
#
# --all-targets so tests are linted too. `cargo test` compiles test
# code but applies no lints to it, so without this the suite — by now
# a good half of the crate — drifts unlinted while CI stays green.
- run: cargo fmt --check
- run: cargo clippy -p diskern-core -p diskern-cli --all-targets --all-features -- -D warnings
# The engine's behaviour is platform-specific in ways a run on one OS
# cannot reach, and it ships on more than one: `default_excludes` has a
# `cfg` arm per platform, most of the rules database describes Windows
# and macOS paths, and quarantine flattens drive letters and separators
# that only exist on Windows. Until this matrix, all of that was checked
# against string literals on Linux and executed on Windows for the first
# time in the release build — after the tag was pushed.
#
# Note: `diskern-app` tests run in `app-tauri` below where Linux webview
# dependencies (webkitgtk) are already installed.
#
# fail-fast off: when a change breaks two platforms, seeing one of them
# is half a bug report.
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2
- run: cargo test -p diskern-core -p diskern-cli --all-features
# Type-checks and tests app/src-tauri against the current diskern-core. Until this
# existed nothing compiled the Tauri crate between releases: a breaking
# change to a core signature merged green, then failed the release build
# after the v* tag was already pushed.
#
# clippy, not a full `cargo build` — the goal is catching signature drift
# and lint regressions in the shell; the release workflow still owns
# producing an actual bundle.
#
# Runs tests with `cargo test -p diskern-app` after clippy. The Tauri system
# dependencies (webkitgtk on Linux) are already installed in this job.
#
# Every platform the shell is built for, because the shells differ:
# Linux links webkitgtk and the GTK3 stack, Windows links WebView2,
# macOS links WKWebView, and a `cfg`-shaped mistake compiles fine on one
# and not another. Windows used to be compiled for the first time during
# the release build.
#
# macOS is here even though its release entry is still commented out.
# Leaving it off would hand whoever re-enables that entry the exact
# failure this job exists to prevent — a first compile after the tag is
# pushed. It costs a few minutes on PRs that touch `crates/` or `app/`,
# and nothing on any other PR: `changes` gates the whole job.
app-tauri:
needs: changes
if: needs.changes.outputs.app == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
# Same apt line as release.yml. Kept in sync by hand; there is no
# cheaper way to share it between workflows. Windows needs none of
# this — WebView2 ships with the OS.
- name: Linux system deps (Tauri v2 / webkitgtk 4.1)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev \
librsvg2-dev patchelf
# tauri.conf.json points frontendDist at ../dist, which is gitignored.
# Build it first so tauri-build has something to resolve.
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: app/package-lock.json
- run: npm ci
working-directory: app
- run: npm run build
working-directory: app
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: swatinem/rust-cache@v2
- run: cargo clippy -p diskern-app --all-targets -- -D warnings
- run: cargo test -p diskern-app
# Spell-check code, docs, and comments. Config in _typos.toml.
# Failures annotate the exact line in the PR diff.
typos:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- uses: crate-ci/typos@v1
# Validate relative links between markdown docs (offline = deterministic;
# external-link rot is checked weekly in audit.yml instead, so a flaky
# third-party site can't fail an unrelated PR).
doc-links:
# ubuntu-latest, not 22.04: the prebuilt lychee binary needs glibc >= 2.38
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: lycheeverse/lychee-action@v2
with:
args: --offline --include-fragments --no-progress './**/*.md'
fail: true
# Landing page: oxlint + production build must stay green, since a
# push to main deploys it straight to GitHub Pages.
site:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: site/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
# Desktop app frontend: Vite build only — no Tauri/webkitgtk needed,
# so JSX errors surface here instead of in the slow release workflow.
app-frontend:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: app/package-lock.json
- run: npm ci
- run: npm run build