From 6825b0db2160501d04a895d7e4f7e8bfad1f6423 Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Sat, 7 Nov 2026 22:39:49 +0800 Subject: [PATCH] ci: validate Linux CLI alongside macOS --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++---- .github/workflows/release.yml | 2 +- AGENTS.md | 2 +- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e7e7e0..cc5e01f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,13 @@ env: MACOSX_DEPLOYMENT_TARGET: "11.0" jobs: - check: - name: Check - # macos-15 is arm64, so the host target is the only one gbat ships. - runs-on: macos-15 + validate: + name: Validate (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [macos-15, ubuntu-24.04] + runs-on: ${{ matrix.os }} timeout-minutes: 15 steps: - name: Check out source @@ -30,6 +33,7 @@ jobs: # rustup installs the toolchain pinned in rust-toolchain.toml on first use. - name: Format + if: runner.os == 'macOS' run: cargo fmt --check - name: Lint @@ -37,3 +41,26 @@ jobs: - name: Test run: cargo test --locked + + # Linux is installed from source; verify linking and startup without HID access. + - name: Build and smoke-test Linux CLI + if: runner.os == 'Linux' + run: | + set -euo pipefail + cargo build --release --locked + version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)" + test -n "$version" + test "$(./target/release/gbat --version)" = "gbat $version" + + check: + name: Check + # Keep the existing required check, and fail even if validation was skipped. + if: always() + needs: validate + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Require both platforms to pass + env: + VALIDATION_RESULT: ${{ needs.validate.result }} + run: test "$VALIDATION_RESULT" = success diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e248f7..710d974 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ env: jobs: build: name: Build aarch64-apple-darwin - # macos-15 is arm64, so a native build produces the only target gbat ships. + # macos-15 is arm64; release archives remain macOS-only. Linux is built from source. runs-on: macos-15 timeout-minutes: 30 env: diff --git a/AGENTS.md b/AGENTS.md index 0b66138..33adc60 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ For an authorized PR merge, wait for the checks required by the current GitHub b Once those requirements are satisfied, proceed with the merge while optional checks such as CodeQL continue asynchronously. Report optional checks that are still pending as pending, and investigate any known failures or security findings rather than describing the entire CI run as successful. Wait for all checks when the user explicitly requests that scope. -Keep PR validation in a single macOS job running formatting, Clippy, and tests. Keep CodeQL enabled as an asynchronous check; add caching or parallel jobs only when measured runtime justifies their overhead. +Validate PRs natively on macOS and Linux so platform-specific code and HID backends are checked. Keep Clippy and tests together in each platform job, run formatting once, and preserve `Check` as the required aggregate gate that passes only when both platforms succeed. Keep CodeQL enabled as an asynchronous check; add caching or further job splitting only when measured runtime justifies their overhead. ## Versioning