feat(ci): add semantic-release pipeline, cross-platform builds, and lefthook git hooks

- Replace single wails.yml with three-workflow pipeline: ci.yml (PR checks),
  release.yml (semantic-release on main), build.yml (versioned builds on tag)
- PR pipeline: conventional commit lint, golangci-lint, govulncheck, go test,
  codegen freshness check, frontend type-check, cross-platform build verification
- Release pipeline: semantic-release with auto-changelog and draft GitHub releases
- Build pipeline: versioned linux/amd64, darwin/universal, windows/amd64 binaries
  with version and commit SHA injected via ldflags
- Add lefthook as go tool for pre-commit (vet, lint, codegen, tsc) and
  pre-push (test, mod verify) git hooks
- Fix golangci-lint gci config to enforce three-group import style
- Upgrade Go to 1.25
- Add version/commit variables to main.go for build-time injection
- Add lint, test, vulncheck, and setup targets to Makefile
This commit is contained in:
2026-02-13 21:26:33 -06:00
parent d78c0584e2
commit caf3e843af
12 changed files with 717 additions and 164 deletions
+169
View File
@@ -0,0 +1,169 @@
name: Build & Publish
run-name: Build ${{ github.ref_name }}
on:
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: false
env:
GO_VERSION: "1.25"
PNPM_VERSION: "10"
NODE_VERSION: "22"
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
build:
name: Build (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Linux (amd64)
os: ubuntu-latest
platform: linux/amd64
binary: yellowjacket
artifact: yellowjacket-linux-amd64
- name: macOS (universal)
os: macos-latest
platform: darwin/universal
binary: yellowjacket
artifact: yellowjacket-darwin-universal
- name: Windows (amd64)
os: windows-latest
platform: windows/amd64
binary: yellowjacket.exe
artifact: yellowjacket-windows-amd64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
# ── System dependencies ──────────────────────
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libgtk-3-dev libwebkit2gtk-4.1-dev
# ── Install Wails CLI ────────────────────────
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
# ── Build ────────────────────────────────────
- name: Determine version
id: version
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Building version: $VERSION"
- name: Build (Linux)
if: runner.os == 'Linux'
working-directory: ${{ github.workspace }}
run: |
wails build \
--platform ${{ matrix.platform }} \
-o ${{ matrix.binary }} \
-tags webkit2_41 \
-ldflags "-s -w -X 'main.version=${{ steps.version.outputs.version }}' -X 'main.commit=${{ github.sha }}'"
- name: Build (macOS)
if: runner.os == 'macOS'
working-directory: ${{ github.workspace }}
run: |
wails build \
--platform ${{ matrix.platform }} \
-o ${{ matrix.binary }} \
-ldflags "-s -w -X 'main.version=${{ steps.version.outputs.version }}' -X 'main.commit=${{ github.sha }}'"
- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}
shell: bash
run: |
wails build \
--platform ${{ matrix.platform }} \
-o ${{ matrix.binary }} \
-ldflags "-s -w -X 'main.version=${{ steps.version.outputs.version }}' -X 'main.commit=${{ github.sha }}'"
# ── Fix permissions ──────────────────────────
- name: Set executable permission (Linux)
if: runner.os == 'Linux'
run: chmod +x build/bin/${{ matrix.binary }}
- name: Set executable permission (macOS)
if: runner.os == 'macOS'
run: chmod +x build/bin/${{ matrix.binary }}.app/Contents/MacOS/*
# ── Zip macOS .app bundle ────────────────────
- name: Zip macOS app
if: runner.os == 'macOS'
working-directory: ${{ github.workspace }}
run: |
ditto -c -k --keepParent build/bin/${{ matrix.binary }}.app build/bin/${{ matrix.artifact }}.app.zip
# ── Upload artifacts ─────────────────────────
- name: Upload artifact (Linux/Windows)
if: runner.os != 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build/bin/${{ matrix.binary }}
- name: Upload artifact (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build/bin/${{ matrix.artifact }}.app.zip
publish:
name: Publish Release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ${{ github.workspace }}/artifacts
- name: List artifacts
run: find ${{ github.workspace }}/artifacts -type f
- name: Upload assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
# The release was already created as a draft by semantic-release.
# This step finds it by tag and attaches binaries, then publishes.
draft: false
tag_name: ${{ github.ref_name }}
fail_on_unmatched_files: true
files: |
artifacts/yellowjacket-linux-amd64
artifacts/yellowjacket-darwin-universal.app.zip
artifacts/yellowjacket-windows-amd64.exe
+200
View File
@@ -0,0 +1,200 @@
name: CI
run-name: CI — ${{ github.head_ref || github.ref_name }}
on:
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
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
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@v5
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: Go mod verify
run: go mod verify
- name: Go vet
run: go vet -tags webkit2_41 ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2
args: --timeout 5m -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@v5
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 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@v5
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 and build
# ──────────────────────────────────────────────
frontend:
name: Frontend Build
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
- name: Build
run: pnpm build
# ──────────────────────────────────────────────
# 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 }}
+45
View File
@@ -0,0 +1,45 @@
name: Release
run-name: Release — determine version
on:
push:
branches: [main]
# Only one release at a time.
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
issues: write
pull-requests: write
jobs:
semantic-release:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install semantic-release and plugins
run: >
npm install --no-save
semantic-release@24
@semantic-release/changelog@6
@semantic-release/git@10
@semantic-release/github@11
@semantic-release/commit-analyzer@13
@semantic-release/release-notes-generator@14
conventional-changelog-conventionalcommits@8
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
-146
View File
@@ -1,146 +0,0 @@
name: Release YellowJacket
run-name: Release ${{ github.ref_name }}
permissions:
contents: write
on:
push:
tags:
# Match any new tag
- '*'
env:
# Necessary for most environments as build failure can occur due to OOM issues
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Dependencies
uses: ConorMacBride/install-package@v1
with:
apt: libasound2-dev
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Build wails
uses: dAppServer/wails-build-action@main
id: build
with:
build-name: yellowjacket
build-platform: 'linux/amd64'
go-version: '1.24'
package: false
app-working-directory: ${{ github.workspace }}
- name: List Files
run: find ${{ github.workspace }}/build -type f
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: yellowjacket
path: ${{ github.workspace }}/build/bin/yellowjacket
build-mac:
runs-on: 'macos-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Build wails
uses: dAppServer/wails-build-action@main
id: build
with:
build-name: yellowjacket
build-platform: 'darwin/universal'
go-version: '1.24'
package: false
app-working-directory: ${{ github.workspace }}
- name: List Files
run: find ${{ github.workspace }}/build -type f
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: yellowjacket.app.zip
path: ${{ github.workspace }}/build/bin/yellowjacket.app.zip
build-windows:
runs-on: 'windows-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Build wails
uses: dAppServer/wails-build-action@main
id: build
with:
build-name: yellowjacket.exe
build-platform: 'windows/amd64'
go-version: '1.24'
package: false
app-working-directory: ${{ github.workspace }}
- name: List Files
shell: powershell
run: Get-ChildItem -Path ${{ github.workspace }}\build -Recurse -File
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: yellowjacket.exe
path: ${{ github.workspace }}\build\bin\yellowjacket.exe
release:
runs-on: ubuntu-latest
needs: [build-linux, build-mac, build-windows]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ${{ github.workspace }}/bin
- run: find ${{ github.workspace }}/bin -type f
- name: Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
body: |
# YellowJacket Release ${{ github.ref_name }}
This is an early preview of YellowJacket. Please report any bugs to [our issues] page.
Thanks for trying out our app!
## Which do I click?
- Linux: `yellowjacket`
- Windows: `yellowjacket.exe`
- MacOS: `yellowjacket.app.zip`
files: ${{ github.workspace }}/bin/*