From 5060ae240296c5c481ba92ac1a18069a29c591a5 Mon Sep 17 00:00:00 2001 From: SquarePots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 20:30:44 +0800 Subject: [PATCH 1/8] ci: validate pull requests with focused frontend checks --- .github/workflows/pull-request-validation.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/pull-request-validation.yml diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml new file mode 100644 index 00000000..d5b4cce1 --- /dev/null +++ b/.github/workflows/pull-request-validation.yml @@ -0,0 +1,36 @@ +name: Pull Request Validation + +on: + pull_request: + +permissions: + contents: read + +jobs: + frontend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install frontend dependencies + run: pnpm install --frozen-lockfile + + - name: Build frontend + run: pnpm build + + - name: Run focused frontend tests + run: | + pnpm test:desktop-reopen + pnpm test:close-preference + pnpm test:reset-credits From 33c52f13cf50be3fe256c73e192af4cff84218ea Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 20:40:34 +0800 Subject: [PATCH 2/8] ci: validate frontend and Rust on pull requests --- .github/workflows/pull-request-validation.yml | 50 +++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index d5b4cce1..73d24905 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -3,11 +3,16 @@ name: Pull Request Validation on: pull_request: +concurrency: + group: pr-validation-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: contents: read jobs: frontend: + name: Frontend runs-on: ubuntu-latest steps: - name: Checkout @@ -29,8 +34,45 @@ jobs: - name: Build frontend run: pnpm build - - name: Run focused frontend tests + - name: Run frontend tests + run: pnpm test + + rust: + name: Rust tests and format + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install system dependencies run: | - pnpm test:desktop-reopen - pnpm test:close-preference - pnpm test:reset-credits + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check formatting + run: cargo fmt --manifest-path src-tauri/Cargo.toml -- --check + + - name: Run Rust tests + run: cargo test --manifest-path src-tauri/Cargo.toml + + platform-check: + name: Platform compile (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Compile platform-specific Rust + run: cargo check --manifest-path src-tauri/Cargo.toml From 3f5fbd11b1d2b77566f9130cc8e2b6d0a0605a03 Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 20:40:38 +0800 Subject: [PATCH 3/8] test: add aggregate frontend test command --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 40c3b87e..31d7713c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "release": "node scripts/release.mjs", "release:patch": "node scripts/release.mjs patch", "release:minor": "node scripts/release.mjs minor", - "release:major": "node scripts/release.mjs major" + "release:major": "node scripts/release.mjs major", + "test": "pnpm test:desktop-reopen && pnpm test:close-preference && pnpm test:reset-credits" }, "dependencies": { "@tauri-apps/api": "^2.10.0", From b2895055e642b2594efd39ce8d23567c80d32b1f Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 22:27:52 +0800 Subject: [PATCH 4/8] ci: make pull request validation baseline-safe --- .github/workflows/pull-request-validation.yml | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index 73d24905..0e88b2f5 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -2,9 +2,12 @@ name: Pull Request Validation on: pull_request: + push: + branches: + - ci/pull-request-validation concurrency: - group: pr-validation-${{ github.event.pull_request.number }} + group: pr-validation-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: @@ -16,12 +19,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20 + node-version: 24 + package-manager-cache: false - name: Setup pnpm uses: pnpm/action-setup@v4 @@ -42,7 +46,9 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 + with: + fetch-depth: 0 - name: Install system dependencies run: | @@ -54,8 +60,16 @@ jobs: with: components: rustfmt - - name: Check formatting - run: cargo fmt --manifest-path src-tauri/Cargo.toml -- --check + - name: Check changed Rust formatting + shell: bash + env: + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} + HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + mapfile -t files < <(git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$HEAD_SHA" -- 'src-tauri/**/*.rs') + if (( ${#files[@]} )); then + rustfmt --edition 2021 --check "${files[@]}" + fi - name: Run Rust tests run: cargo test --manifest-path src-tauri/Cargo.toml @@ -69,7 +83,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Rust uses: dtolnay/rust-toolchain@stable From af253f037c1f08c9bbe715882b3d29e0b5d58822 Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 22:31:27 +0800 Subject: [PATCH 5/8] ci: keep validation scoped to pull requests --- .github/workflows/pull-request-validation.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index 0e88b2f5..62ef6579 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -2,12 +2,9 @@ name: Pull Request Validation on: pull_request: - push: - branches: - - ci/pull-request-validation concurrency: - group: pr-validation-${{ github.event.pull_request.number || github.ref }} + group: pr-validation-${{ github.event.pull_request.number }} cancel-in-progress: true permissions: From 02ebe1f1a9b88eb09a3aa1b6690c4109ce37b5e3 Mon Sep 17 00:00:00 2001 From: SquarePots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 22:58:46 +0800 Subject: [PATCH 6/8] ci: enforce locked Rust validation --- .github/workflows/pull-request-validation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index 62ef6579..4597ad24 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -69,7 +69,7 @@ jobs: fi - name: Run Rust tests - run: cargo test --manifest-path src-tauri/Cargo.toml + run: cargo test --locked --manifest-path src-tauri/Cargo.toml platform-check: name: Platform compile (${{ matrix.os }}) @@ -86,4 +86,4 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Compile platform-specific Rust - run: cargo check --manifest-path src-tauri/Cargo.toml + run: cargo check --locked --manifest-path src-tauri/Cargo.toml From 0f00c282b16126ff01280709d3fd031a87941f37 Mon Sep 17 00:00:00 2001 From: SquarePots <46488165+squarepots@users.noreply.github.com> Date: Sat, 19 Sep 2026 16:51:44 +0800 Subject: [PATCH 7/8] ci: discover all focused frontend tests --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31d7713c..ab7ba46a 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "release:patch": "node scripts/release.mjs patch", "release:minor": "node scripts/release.mjs minor", "release:major": "node scripts/release.mjs major", - "test": "pnpm test:desktop-reopen && pnpm test:close-preference && pnpm test:reset-credits" + "test": "node --experimental-strip-types --test tests/*.test.*" }, "dependencies": { "@tauri-apps/api": "^2.10.0", From d7895fcc15d568bce3fafe2359bbf2d05d496604 Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Sat, 19 Sep 2026 22:26:04 +0800 Subject: [PATCH 8/8] ci: avoid formatting unchanged Rust modules --- .github/workflows/pull-request-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index 4597ad24..efe87075 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -65,7 +65,7 @@ jobs: run: | mapfile -t files < <(git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$HEAD_SHA" -- 'src-tauri/**/*.rs') if (( ${#files[@]} )); then - rustfmt --edition 2021 --check "${files[@]}" + rustfmt --edition 2021 --check --config skip_children=true "${files[@]}" fi - name: Run Rust tests