Co-authored-by: onion-4-dinner <15676555+onion-4-dinner@users.noreply.github.com>
215 lines
7.2 KiB
YAML
215 lines
7.2 KiB
YAML
name: CI
|
|
run-name: CI — ${{ github.head_ref || github.ref_name }}
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
# Allow running manually for debugging.
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.head_ref || github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GO_VERSION: "1.25"
|
|
PNPM_VERSION: "10"
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
|
|
|
jobs:
|
|
# ──────────────────────────────────────────────
|
|
# Enforce conventional commit format on PR title
|
|
# (squash-merge means PR title = release commit)
|
|
# ──────────────────────────────────────────────
|
|
commitlint:
|
|
name: Lint PR Title
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
steps:
|
|
- uses: amannn/action-semantic-pull-request@v6
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
types: |
|
|
feat
|
|
fix
|
|
perf
|
|
refactor
|
|
revert
|
|
docs
|
|
style
|
|
chore
|
|
ci
|
|
test
|
|
build
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Go: lint, vet, vulnerability check
|
|
# ──────────────────────────────────────────────
|
|
go-checks:
|
|
name: Go Checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install system dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libgtk-3-dev libwebkit2gtk-4.1-dev
|
|
|
|
# The go:embed directive in main.go requires frontend/dist to exist.
|
|
# A stub suffices for vet/lint; the real build is verified separately.
|
|
- name: Create frontend dist stub
|
|
run: mkdir -p frontend/dist && touch frontend/dist/index.html
|
|
|
|
- name: Go mod verify
|
|
run: go mod verify
|
|
|
|
- name: Go vet
|
|
run: go vet -tags webkit2_41 ./...
|
|
|
|
- name: golangci-lint
|
|
continue-on-error: true
|
|
uses: golangci/golangci-lint-action@v7
|
|
with:
|
|
version: v2.5.0
|
|
args: --timeout 5m --build-tags webkit2_41
|
|
|
|
- name: govulncheck
|
|
uses: golang/govulncheck-action@v1
|
|
with:
|
|
go-version-input: ${{ env.GO_VERSION }}
|
|
go-package: ./...
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Go: run tests
|
|
# ──────────────────────────────────────────────
|
|
go-test:
|
|
name: Go Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install system dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libgtk-3-dev libwebkit2gtk-4.1-dev
|
|
|
|
# The go:embed directive in main.go requires frontend/dist to exist.
|
|
- name: Create frontend dist stub
|
|
run: mkdir -p frontend/dist && touch frontend/dist/index.html
|
|
|
|
- name: Run tests
|
|
run: go test -tags webkit2_41 -race -count=1 -timeout 120s ./...
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Code generation: verify generated code is fresh
|
|
# ──────────────────────────────────────────────
|
|
codegen-check:
|
|
name: Code Generation Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install system dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libgtk-3-dev libwebkit2gtk-4.1-dev
|
|
|
|
- name: Run code generation
|
|
run: go generate ./...
|
|
|
|
- name: Check for uncommitted changes
|
|
run: |
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
echo "::error::Generated code is out of date. Run 'make generate' and commit the changes."
|
|
git diff --stat
|
|
git diff
|
|
exit 1
|
|
fi
|
|
echo "Generated code is up to date."
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Frontend: type-check
|
|
# (full build is verified by the build-check job
|
|
# via Wails which handles path resolution)
|
|
# ──────────────────────────────────────────────
|
|
frontend:
|
|
name: Frontend Type Check
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Type check
|
|
run: pnpm exec tsc --noEmit
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Build verification: ensure it compiles on all
|
|
# target platforms (no artifacts uploaded)
|
|
# ──────────────────────────────────────────────
|
|
build-check:
|
|
name: Build Check (${{ matrix.platform }})
|
|
needs: [go-checks, go-test, codegen-check, frontend]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
os: ubuntu-latest
|
|
build-name: yellowjacket
|
|
apt-deps: libasound2-dev
|
|
- platform: darwin/universal
|
|
os: macos-latest
|
|
build-name: yellowjacket
|
|
- platform: windows/amd64
|
|
os: windows-latest
|
|
build-name: yellowjacket.exe
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install system dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.apt-deps }}
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
- name: Build with Wails
|
|
uses: dAppServer/wails-build-action@main
|
|
with:
|
|
build-name: ${{ matrix.build-name }}
|
|
build-platform: ${{ matrix.platform }}
|
|
go-version: ${{ env.GO_VERSION }}
|
|
package: false
|
|
app-working-directory: ${{ github.workspace }}
|