Files
claude-code-usage-bubble/.github/workflows/ci.yml
T
tiennm99 f7c00893b0 ci(release): run the full CI on the tag before building a release
ci.yml is now callable with a ref to test. The release workflow calls it on the prepared tag and both build jobs wait for it, so a tag whose sources fail tests, lint or the build publishes nothing. A called run gets its own concurrency group and is never cancelled. The release steps now push main and wait for green CI before pushing the tag.
2026-10-23 03:07:15 +07:00

111 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main, feat/tauri-port]
pull_request:
# The release workflow runs this on the tag before it builds anything.
workflow_call:
inputs:
ref:
description: 'Git ref to check out and test (defaults to the triggering commit)'
type: string
required: false
permissions:
contents: read
# A called run takes the caller's workflow name and the ref it was given, so
# it never shares a group with a push or PR run. It is never cancelled
# either: a newer push must not abort the checks a release waits on.
concurrency:
group: ci-${{ github.workflow }}-${{ inputs.ref || github.ref }}
cancel-in-progress: ${{ !inputs.ref }}
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
with:
ref: ${{ inputs.ref || github.sha }}
- 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
# The bundler has no icon fallback, so a bad bundle.icon list only
# breaks packaging; the deb needs no patchelf and catches it early.
- name: Bundle the deb
if: runner.os == 'Linux'
run: npm run tauri build -- --bundles deb
- 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/usage-monitor.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/usage-monitor.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
with:
ref: ${{ inputs.ref || github.sha }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-targets --locked