Skip to content

Commit 9f19394

Browse files
committed
feat: add CI verification targets and PR checks workflow
Add Makefile targets for deterministic local/CI verification: - make check: runs all checks in sequence (fail-fast) - Go: go-build, go-vet, go-test, go-lint, fmt-check, fmt - Bindings: bindings, bindings-check (detects stale wails bindings) - UI: ui-install, ui-build, ui-lint, ui-typecheck Add GitHub Actions PR workflow (.github/workflows/pr-checks.yml): - Runs Go checks, bindings freshness, and UI checks in parallel - Caches Go modules and pnpm store - Gates PR merges on all checks passing Add dist/.gitkeep so go:embed all:dist resolves without a frontend build, enabling Go checks to run independently.
1 parent c6f0c14 commit 9f19394

4 files changed

Lines changed: 174 additions & 14 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: pr-checks-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
GO_VERSION: "1.26"
13+
NODE_VERSION: "20"
14+
PNPM_VERSION: "10"
15+
16+
jobs:
17+
go-checks:
18+
name: Go checks
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ env.GO_VERSION }}
26+
cache: true
27+
28+
- name: Build
29+
run: make go-build
30+
31+
- name: Vet
32+
run: make go-vet
33+
34+
- name: Test
35+
run: make go-test
36+
37+
- name: Format check
38+
run: make fmt-check
39+
40+
- name: Lint
41+
uses: golangci/golangci-lint-action@v6
42+
with:
43+
version: latest
44+
args: run
45+
env:
46+
GOWORK: "off"
47+
48+
bindings-check:
49+
name: Bindings freshness
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- uses: actions/setup-go@v5
55+
with:
56+
go-version: ${{ env.GO_VERSION }}
57+
cache: true
58+
59+
- name: Install wails
60+
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0
61+
62+
- name: Check bindings are up to date
63+
run: make bindings-check
64+
65+
ui-checks:
66+
name: UI checks
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- uses: actions/setup-node@v4
72+
with:
73+
node-version: ${{ env.NODE_VERSION }}
74+
75+
- uses: pnpm/action-setup@v4
76+
with:
77+
version: ${{ env.PNPM_VERSION }}
78+
79+
- name: Get pnpm store directory
80+
id: pnpm-cache
81+
shell: bash
82+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
83+
84+
- uses: actions/cache@v4
85+
with:
86+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
87+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
88+
restore-keys: ${{ runner.os }}-pnpm-store-
89+
90+
- name: Install dependencies
91+
run: make ui-install
92+
93+
- name: Build
94+
run: make ui-build
95+
96+
- name: Lint
97+
run: make ui-lint
98+
99+
- name: Typecheck
100+
run: make ui-typecheck

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ lerna-debug.log*
3030

3131
node_modules
3232
dist
33+
!dist/.gitkeep
3334
dist-ssr
3435
*.local
3536

Makefile

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,78 @@
11

22
.PHONY: docs prepare sync packages dev dev-plugin runtime build
3+
.PHONY: check go-build go-vet go-test go-lint bindings bindings-check
4+
.PHONY: ui-install ui-build ui-lint ui-typecheck fmt fmt-check
5+
6+
# ──────────────────────────────────────────────
7+
# CI / Verification targets
8+
# ──────────────────────────────────────────────
9+
10+
# Run all checks in sequence, fail fast on first error.
11+
# Note: dist/.gitkeep satisfies the go:embed directive so Go checks work without a frontend build.
12+
check: go-build go-vet go-test go-lint fmt-check bindings-check ui-install ui-build ui-lint ui-typecheck
13+
14+
# Go checks
15+
go-build:
16+
GOWORK=off go build ./...
17+
18+
go-vet:
19+
GOWORK=off go vet ./...
20+
21+
go-test:
22+
GOWORK=off go test ./...
23+
24+
go-lint:
25+
@if command -v golangci-lint >/dev/null 2>&1; then \
26+
GOWORK=off golangci-lint run; \
27+
else \
28+
echo "golangci-lint not installed, skipping"; \
29+
fi
30+
31+
# Go formatting
32+
fmt:
33+
goimports -w .
34+
gofmt -w .
35+
36+
fmt-check:
37+
@UNFORMATTED=$$(gofmt -l .); \
38+
if [ -n "$$UNFORMATTED" ]; then \
39+
echo "The following Go files are not formatted:"; \
40+
echo "$$UNFORMATTED"; \
41+
exit 1; \
42+
fi
43+
44+
# Wails bindings
45+
bindings:
46+
GOWORK=off wails generate module
47+
48+
bindings-check:
49+
@TMPDIR=$$(mktemp -d); \
50+
cp -R packages/omniviewdev-runtime/src/wailsjs "$$TMPDIR/wailsjs-before"; \
51+
GOWORK=off wails generate module; \
52+
if ! diff -r packages/omniviewdev-runtime/src/wailsjs "$$TMPDIR/wailsjs-before" >/dev/null 2>&1; then \
53+
echo "Wails bindings are stale. Run 'make bindings' and commit the result."; \
54+
rm -rf "$$TMPDIR"; \
55+
exit 1; \
56+
fi; \
57+
rm -rf "$$TMPDIR"
58+
59+
# Frontend checks
60+
ui-install:
61+
pnpm install --frozen-lockfile
62+
63+
ui-build:
64+
$(MAKE) packages
65+
pnpm build
66+
67+
ui-lint:
68+
ESLINT_USE_FLAT_CONFIG=false pnpm lint
69+
70+
ui-typecheck:
71+
pnpm exec tsc -p tsconfig.app.json --noEmit
72+
73+
# ──────────────────────────────────────────────
74+
# Development targets
75+
# ──────────────────────────────────────────────
376

477
prepare:
578
go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0
@@ -59,17 +132,3 @@ sign:
59132
.PHONY: build-debug
60133
build-debug:
61134
wails build -clean -debug
62-
63-
lint: lint-core lint-plugin lint-kubernetes
64-
65-
lint-core:
66-
cd src && golangci-lint run --fix
67-
68-
lint-plugin:
69-
cd packages/plugin && golangci-lint run --fix
70-
71-
lint-kubernetes:
72-
cd plugins/kubernetes && golangci-lint run --fix
73-
74-
install-kubernetes:
75-
cd plugins/kubernetes && go build pkg/main.go

dist/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)