From f89a10bde772f4704b6ff10ea16a087a872db374 Mon Sep 17 00:00:00 2001 From: Xoshbin Date: Sun, 15 Nov 2026 00:05:38 +0300 Subject: [PATCH 1/2] ci: cancel stale in-flight PR runs and cache pnpm store - Add PR concurrency auto-cancellation to test-and-lint and CodeQL workflows to prevent runner queue pileups on rapid pushes - Preserve full non-cancelled runs for pushes on main - Reorder pnpm setup and enable pnpm store caching in actions/setup-node across Ubuntu, Windows, and macOS runners --- .github/workflows/codeql.yml | 4 ++++ .github/workflows/test-and-lint.yml | 37 +++++++++++++++++------------ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a15cf0bae..74f365134 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -19,6 +19,10 @@ on: schedule: - cron: '20 5 * * 4' +concurrency: + group: codeql-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: analyze: name: Analyze (${{ matrix.language }}) diff --git a/.github/workflows/test-and-lint.yml b/.github/workflows/test-and-lint.yml index 00b739d79..8be69cc21 100644 --- a/.github/workflows/test-and-lint.yml +++ b/.github/workflows/test-and-lint.yml @@ -12,6 +12,10 @@ on: permissions: contents: read +concurrency: + group: test-and-lint-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test-and-lint: runs-on: ubuntu-latest @@ -33,16 +37,17 @@ jobs: sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: 22 - - name: Setup pnpm uses: pnpm/action-setup@v5 with: version: 10.26.0 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + - name: Install Rust 1.97.0 uses: dtolnay/rust-toolchain@1.97.0 with: @@ -182,16 +187,17 @@ jobs: # `build.rs` reads node_modules/asyar-sdk/package.json to inject the SDK # version, so the workspace symlink must exist. `--ignore-scripts` skips # the native (keytar) builds the Rust tests don't need, keeping this fast. - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: 22 - - name: Setup pnpm uses: pnpm/action-setup@v5 with: version: 10.26.0 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + - name: Install workspace dependencies (for build.rs SDK-version read) run: pnpm install --frozen-lockfile --ignore-scripts @@ -276,16 +282,17 @@ jobs: # build.rs reads node_modules/asyar-sdk/package.json to inject the # SDK version, so the workspace symlink must exist. --ignore-scripts # skips native (keytar) builds the Rust tests don't need. - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: 22 - - name: Setup pnpm uses: pnpm/action-setup@v5 with: version: 10.26.0 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + - name: Install workspace dependencies (for build.rs SDK-version read) run: pnpm install --frozen-lockfile --ignore-scripts From 444c400aa29d4588f5956504e21c2d0c4f22f60c Mon Sep 17 00:00:00 2001 From: Xoshbin Date: Sun, 15 Nov 2026 00:27:08 +0300 Subject: [PATCH 2/2] ci: parallelize frontend and platform Rust tests with aggregator gate - Split monolithic test-and-lint job into a lean, dedicated frontend job and platform Rust test jobs - Run frontend checks (Prettier, Svelte types, Vitest) concurrently with Rust tests, cutting feedback time to ~2-3 minutes - Retain a lightweight test-and-lint aggregator gate job to satisfy GitHub branch rulesets and release workflow callers --- .github/workflows/test-and-lint.yml | 112 ++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test-and-lint.yml b/.github/workflows/test-and-lint.yml index 8be69cc21..7c3320096 100644 --- a/.github/workflows/test-and-lint.yml +++ b/.github/workflows/test-and-lint.yml @@ -17,26 +17,12 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - test-and-lint: + frontend: + name: Frontend & Workspace Checks runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - # Reclaim disk space on the standard GitHub Actions runner before installing - # dependencies and restoring the Rust cache. Unused pre-installed SDKs - # (.NET, Android, Haskell) take up ~30 GB, leaving less than 15 GB free. - # Without this cleanup, the runner runs out of disk space when linking - # the test binaries and GNU ld aborts with SIGBUS (signal 7 [Bus error]). - - name: Free runner disk space - run: | - sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/share/boost - df -h - - - name: Install system dependencies (Tauri / webkit2gtk) - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev - - name: Setup pnpm uses: pnpm/action-setup@v5 with: @@ -48,20 +34,6 @@ jobs: node-version: 22 cache: 'pnpm' - - name: Install Rust 1.97.0 - uses: dtolnay/rust-toolchain@1.97.0 - with: - components: clippy, rustfmt - - - name: Cache Rust - uses: Swatinem/rust-cache@v2 - with: - workspaces: asyar-launcher/src-tauri -> target - - - name: Check Rust formatting - run: cargo fmt --check - working-directory: asyar-launcher/src-tauri - - name: Install workspace dependencies run: pnpm install --frozen-lockfile @@ -98,6 +70,56 @@ jobs: asyar-sdk/cli/lib/knownRuntimes.ts \ asyar-sdk/cli/lib/gatedPermissions.ts + test-rust-linux: + name: Rust tests (Linux) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + # Reclaim disk space on the standard GitHub Actions runner before installing + # dependencies and restoring the Rust cache. Unused pre-installed SDKs + # (.NET, Android, Haskell) take up ~30 GB, leaving less than 15 GB free. + # Without this cleanup, the runner runs out of disk space when linking + # the test binaries and GNU ld aborts with SIGBUS (signal 7 [Bus error]). + - name: Free runner disk space + run: | + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/share/boost + df -h + + - name: Install system dependencies (Tauri / webkit2gtk) + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev + + - name: Setup pnpm + uses: pnpm/action-setup@v5 + with: + version: 10.26.0 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + + - name: Install Rust 1.97.0 + uses: dtolnay/rust-toolchain@1.97.0 + with: + components: clippy, rustfmt + + - name: Cache Rust + uses: Swatinem/rust-cache@v2 + with: + workspaces: asyar-launcher/src-tauri -> target + cache-on-failure: true + + - name: Check Rust formatting + run: cargo fmt --check + working-directory: asyar-launcher/src-tauri + + - name: Install workspace dependencies (for build.rs SDK-version read) + run: pnpm install --frozen-lockfile --ignore-scripts + - name: Run Rust tests run: cargo test --workspace working-directory: asyar-launcher/src-tauri @@ -319,3 +341,33 @@ jobs: - name: Run Clippy run: cargo clippy --workspace --all-targets -- -D warnings working-directory: asyar-launcher/src-tauri + + # Aggregator gate job required by GitHub branch ruleset (`context: "test-and-lint"`). + # Runs after all parallel jobs finish, ensuring that frontend and all platform Rust + # jobs passed, and blocks merge if any job failed. + test-and-lint: + name: test-and-lint + runs-on: ubuntu-latest + needs: + - frontend + - test-rust-linux + - test-rust-windows + - test-rust-macos + if: always() + steps: + - name: Verify all matrix checks succeeded + run: | + echo "Frontend: ${{ needs.frontend.result }}" + echo "Rust (Linux): ${{ needs.test-rust-linux.result }}" + echo "Rust (Windows): ${{ needs.test-rust-windows.result }}" + echo "Rust (macOS): ${{ needs.test-rust-macos.result }}" + + if [ "${{ needs.frontend.result }}" != "success" ] || \ + [ "${{ needs.test-rust-linux.result }}" != "success" ] || \ + [ "${{ needs.test-rust-windows.result }}" != "success" ] || \ + [ "${{ needs.test-rust-macos.result }}" != "success" ]; then + echo "::error::One or more test matrix jobs failed." + exit 1 + fi + + echo "All checks passed successfully."