# Quality gate for pull requests and pushes to main: frontend format check, lint, # type check, unit tests and build; backend fmt, clippy and tests. release.yml is separate # and only builds artifacts when a tag is pushed. # # Layout: # - `changes` looks at the changed paths first. A change that touches only # docs skips the heavy jobs. A job skipped through `if:` counts as passed for # the required checks on main, while a workflow that never ran would leave # them pending forever, so the path filter lives here and not in `on:`. # - clippy runs on Windows so the Windows-only modules keep compiling. # - the tests run on macOS: the same crate compiles far faster there than on # the Windows runner, and both are release targets. # - a Linux job runs clippy and the tests on Ubuntu 22.04, the system the # Linux packages are built on, so the Linux-only modules keep compiling and # their tests run. # - debuginfo is off for CI builds. Nothing reads it, and generating it is a # large part of the compile and link time. # - backend checks use Tauri's dev context, so they do not need frontend assets. # - tests skip optimizing the application, while dependencies keep their O2 # override for CPU-heavy tests such as XLSX export. name: CI on: pull_request: push: branches: - main # A new push to the same branch cancels the run still going. concurrency: group: ci-${{ github.ref }} cancel-in-progress: true jobs: changes: name: Changed paths runs-on: ubuntu-latest permissions: contents: read pull-requests: read outputs: code: ${{ steps.filter.outputs.code }} steps: - uses: actions/checkout@v4 # `code` is true when at least one changed file is neither under docs/ # nor a Markdown file. - uses: dorny/paths-filter@v4 id: filter with: predicate-quantifier: every filters: | code: - '**' - '!docs/**' - '!**/*.md' frontend: name: Frontend (lint + tsc + test + build) needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - name: Install deps run: npm ci - name: Format check (prettier) run: npm run format:check - name: Lint (eslint, ratcheted warnings) run: npm run lint - name: Type check run: npx tsc --noEmit - name: Type check the web demo run: npx tsc --noEmit -p web - name: Unit tests run: npm test - name: Build run: npx vite build rust-lint: name: Backend lint (fmt + clippy) needs: changes if: needs.changes.outputs.code == 'true' runs-on: windows-latest env: CARGO_PROFILE_DEV_DEBUG: 0 steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 with: workspaces: "./src-tauri -> target" - name: rustfmt working-directory: src-tauri run: cargo fmt --all -- --check - name: clippy working-directory: src-tauri run: cargo clippy --all-targets -- -D warnings rust-test: name: Backend test needs: changes if: needs.changes.outputs.code == 'true' runs-on: macos-latest env: CARGO_PROFILE_DEV_DEBUG: 0 CARGO_PROFILE_TEST_DEBUG: 0 steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: workspaces: "./src-tauri -> target" - name: test working-directory: src-tauri env: # Only the workspace crate changes; keep the existing dependency cache. CARGO_PROFILE_TEST_OPT_LEVEL: 0 run: cargo test rust-linux: name: Backend Linux (clippy + test) needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-22.04 env: CARGO_PROFILE_DEV_DEBUG: 0 CARGO_PROFILE_TEST_DEBUG: 0 steps: - uses: actions/checkout@v4 - name: Install system libraries run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libdbus-1-dev - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy - uses: Swatinem/rust-cache@v2 with: workspaces: "./src-tauri -> target" - name: clippy working-directory: src-tauri run: cargo clippy --all-targets -- -D warnings - name: test working-directory: src-tauri env: CARGO_PROFILE_TEST_OPT_LEVEL: 0 run: cargo test