Skip to content

refactor(desktop): restrict PRs base branch selection to valid options (Now use a select) #463

refactor(desktop): restrict PRs base branch selection to valid options (Now use a select)

refactor(desktop): restrict PRs base branch selection to valid options (Now use a select) #463

Workflow file for this run

name: Perf benches
# Runs the bench suite on every PR that touches apps/desktop/, and on push
# to main. Compares against the committed baseline (apps/desktop/perf/
# baseline.json) and fails the workflow if a bench regresses by > 15 %.
on:
pull_request:
paths:
- "apps/desktop/**"
- ".github/workflows/perf.yml"
push:
branches: [main]
jobs:
bench:
name: Perf bench (Linux)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
run: |
set -euxo pipefail
sudo apt-get update
# Full Tauri 2 prereqs (https://v2.tauri.app/start/prerequisites/#linux).
# `libglib2.0-dev` + `libsoup-3.0-dev` are required by glib-sys /
# gio-sys / gobject-sys / soup3-sys — even when only building the
# parity-probe example, cargo still has to compile all the Tauri
# dependency tree which transitively pulls these crates in.
# `libayatana-appindicator3-dev` is the supported replacement for
# the deprecated `libappindicator3-dev`.
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libglib2.0-dev \
libsoup-3.0-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libxdo-dev \
libssl-dev \
build-essential \
file \
patchelf
# Diagnostic — fail fast if a .pc file is missing.
echo "=== probe glib stack ==="
for pkg in glib-2.0 gobject-2.0 gio-2.0 cairo gdk-pixbuf-2.0 pango \
gtk+-3.0 webkit2gtk-4.1 javascriptcoregtk-4.1 \
libsoup-3.0 ayatana-appindicator3-0.1 librsvg-2.0; do
if version=$(pkg-config --modversion "$pkg" 2>/dev/null); then
printf ' ✓ %-32s %s\n' "$pkg" "$version"
else
printf ' ✗ %-32s MISSING\n' "$pkg"
missing=1
fi
done
if [ "${missing:-0}" = "1" ]; then
echo "::error::One or more Tauri Linux prereqs are missing"
exit 1
fi
# Export PKG_CONFIG_PATH at runner level so cargo subprocesses see it.
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig" >> "$GITHUB_ENV"
# Cache cargo deps to keep CI under the 20 min budget.
# First run: ~8 min compile (rayon + git2 vendored). Subsequent: ~30 s.
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
apps/desktop/src-tauri/target
key: ${{ runner.os }}-cargo-perf-${{ hashFiles('apps/desktop/src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-perf-
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Build the parity probe in release mode — bench should reflect what
# users actually run, not a debug build.
- name: Build parity probe
working-directory: apps/desktop/src-tauri
run: cargo build --locked --example parity-probe --release
- name: Run benches
working-directory: apps/desktop
run: |
if [ -f perf/baseline.json ] && [ -n "$(jq -r '.timestamp // empty' perf/baseline.json)" ]; then
node perf/bench.mjs --check-against perf/baseline.json
else
echo "::warning::No baseline.json yet — running bench without comparison."
echo "::warning::Once perf is stable, run 'pnpm bench:write-baseline' on a representative machine and commit the file."
node perf/bench.mjs
fi
# @gitwand/core must be built before apps/desktop typechecks because
# the desktop frontend resolves `@gitwand/core` via pnpm workspace and
# vue-tsc reads the package's `dist/index.d.ts`. Without this step the
# typecheck fails with `TS2307: Cannot find module '@gitwand/core'`.
# ci.yml / publish.yml / release.yml already do this; perf.yml was the
# outlier. Same pattern as ci.yml L116.
- name: Build @gitwand/core (TS declarations for downstream typecheck)
run: pnpm --filter @gitwand/core run build
# Frontend bundle size budgets — catches accidental eager imports
# that would undo §1.2 (lazy panels) or §4.3 (lazy highlight.js).
- name: Build frontend
working-directory: apps/desktop
run: pnpm build
- name: Bundle size check
working-directory: apps/desktop
run: node perf/bundle-check.mjs
# Always upload the run artifact so we can inspect even when the job
# fails. Useful when investigating a regression.
- name: Upload bench results
if: always()
uses: actions/upload-artifact@v4
with:
name: perf-results-${{ github.sha }}
path: apps/desktop/perf/last-run.json
retention-days: 14