ci: build and check on Windows, Linux and macOS

Windows and Ubuntu 22.04 run fmt, clippy, tests, lint, the JS tests and
a no-bundle release build. The Windows row checks the exe version
resource and uploads the exe as a 7-day artifact. macOS runs cargo check
as the compile gate.
This commit is contained in:
tiennm99 committed 2026-10-21 11:45:20 +07:00
1 parent 2adbeeb613
commit 4e70aa1d22
1 file changed
+90
+90
View File
@@ -0,0 +1,90 @@
name: CI
on:
push:
branches: [main, feat/tauri-port]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v7
with:
node-version: lts/*
cache: npm
- name: Install Linux build prerequisites
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file \
libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
- run: npm ci
- run: cargo fmt --check
- run: cargo clippy --all-targets --locked -- -D warnings
- run: cargo test --locked
- run: npm run lint
- run: npm test
- run: npm run tauri build -- --no-bundle
- name: Check the exe version resource
if: runner.os == 'Windows'
shell: pwsh
run: |
$match = Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"([^"]+)"' | Select-Object -First 1
$cargoVersion = $match.Matches.Groups[1].Value
$info = (Get-Item target/release/claude-code-usage-bubble.exe).VersionInfo
$info | Format-List ProductName, CompanyName, FileDescription, FileVersion, ProductVersion, LegalCopyright
if ($info.ProductVersion -ne $cargoVersion) {
Write-Error "ProductVersion '$($info.ProductVersion)' does not match Cargo.toml version '$cargoVersion'"
exit 1
}
- name: Upload the Windows exe
if: runner.os == 'Windows'
uses: actions/upload-artifact@v7
with:
name: bubble-exe-${{ github.sha }}
path: target/release/claude-code-usage-bubble.exe
retention-days: 7
if-no-files-found: error
macos-check:
name: macos-latest (cargo check)
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-targets --locked