ci: split go and typescript gates
This commit is contained in:
parent
280f7a59dc
commit
40510af5c8
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
@ -14,14 +14,16 @@ permissions:
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
NODE_VERSION: "24"
|
||||
PNPM_VERSION: "11.0.7"
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
name: Backend
|
||||
go:
|
||||
name: Go
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
@ -34,6 +36,17 @@ jobs:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: Download modules
|
||||
run: go mod download
|
||||
|
||||
- name: Check gofmt
|
||||
run: |
|
||||
files="$(gofmt -l apps/api)"
|
||||
if [ -n "$files" ]; then
|
||||
echo "$files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
@ -43,8 +56,8 @@ jobs:
|
||||
go tool cover -func=coverage.out | tee coverage.txt
|
||||
awk '/^total:/ { sub(/%/, "", $3); if ($3 + 0 < 90) exit 1 }' coverage.txt
|
||||
|
||||
frontend:
|
||||
name: Frontend and Docs
|
||||
typescript:
|
||||
name: TypeScript
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
@ -54,22 +67,28 @@ jobs:
|
||||
- name: Set up pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11.0.7
|
||||
version: ${{ env.PNPM_VERSION }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Typecheck
|
||||
- name: Check TypeScript formatting
|
||||
run: pnpm fmt:ts:check
|
||||
|
||||
- name: Lint TypeScript
|
||||
run: pnpm lint
|
||||
|
||||
- name: Typecheck root tests
|
||||
run: pnpm typecheck
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
- name: Typecheck workspaces
|
||||
run: pnpm -r typecheck
|
||||
|
||||
- name: Build embedded app
|
||||
run: pnpm build
|
||||
@ -82,6 +101,9 @@ jobs:
|
||||
|
||||
e2e:
|
||||
name: Playwright E2E
|
||||
needs:
|
||||
- go
|
||||
- typescript
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
@ -97,12 +119,12 @@ jobs:
|
||||
- name: Set up pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11.0.7
|
||||
version: ${{ env.PNPM_VERSION }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
@ -119,6 +141,9 @@ jobs:
|
||||
|
||||
docker:
|
||||
name: Docker Image
|
||||
needs:
|
||||
- go
|
||||
- typescript
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
|
||||
@ -15,3 +15,5 @@
|
||||
flow for hosted agents.
|
||||
- Added more visible GitHub links to the product website and improved the docs
|
||||
quickstart CTA contrast in dark mode.
|
||||
- Split GitHub Actions into explicit Go, TypeScript, Playwright, and Docker
|
||||
gates, with `gofmt` and `oxfmt --check` enforced in CI.
|
||||
|
||||
@ -151,10 +151,11 @@ provided.
|
||||
- Coverage gate: `pnpm coverage` fails under 90% Go line coverage.
|
||||
|
||||
```sh
|
||||
pnpm check # go test + typecheck + lint
|
||||
pnpm check # go test + root/workspace typecheck + lint + format check
|
||||
pnpm coverage # Go coverage with 90% gate
|
||||
pnpm test:e2e # Playwright
|
||||
pnpm fmt # gofmt + oxfmt
|
||||
pnpm fmt # gofmt + oxfmt write
|
||||
pnpm fmt:check # gofmt + oxfmt check, CI-compatible
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
@ -48,13 +48,14 @@ The Vite dev server proxies `/api` and `/api/realtime/ws` to `localhost:8080`.
|
||||
| Command | What it does |
|
||||
|------------------------|--------------|
|
||||
| `pnpm build` | Builds the Svelte app and the SDK, then copies `apps/web/dist` into `apps/api/internal/webassets/dist`. |
|
||||
| `pnpm check` | Full local gate: `go test ./...`, `pnpm -r typecheck`, `pnpm lint`. |
|
||||
| `pnpm check` | Full local gate: `go test ./...`, root/workspace `tsgo`, `oxlint`, and format checks. |
|
||||
| `pnpm coverage` | Go tests with coverage; fails under 90% line coverage. |
|
||||
| `pnpm dev:api` | `go run ./apps/api/cmd/clickclack serve`. |
|
||||
| `pnpm dev:web` | `vite dev` for the SPA. |
|
||||
| `pnpm fmt` | `gofmt` + `oxfmt` over Go and TS/Svelte. |
|
||||
| `pnpm fmt:check` | CI-compatible formatting check with `gofmt -l` and `oxfmt --check`. |
|
||||
| `pnpm lint` | `oxlint` over web, SDK, examples, and tests. |
|
||||
| `pnpm typecheck` | `tsgo --noEmit -p tsconfig.json`. |
|
||||
| `pnpm typecheck` | `tsgo --noEmit -p tsconfig.json` for root Playwright config/tests. |
|
||||
| `pnpm test` | `go test ./... && pnpm build`. |
|
||||
| `pnpm test:e2e` | Playwright suite in `tests/e2e`. |
|
||||
|
||||
|
||||
@ -5,11 +5,15 @@
|
||||
"scripts": {
|
||||
"build": "pnpm --filter @clickclack/web build && pnpm --filter @clickclack/sdk-ts build && rm -rf apps/api/internal/webassets/dist && cp -R apps/web/dist apps/api/internal/webassets/dist",
|
||||
"docs:site": "node scripts/build-docs-site.mjs",
|
||||
"check": "go test ./... && pnpm -r typecheck && pnpm lint",
|
||||
"check": "go test ./... && pnpm typecheck && pnpm -r typecheck && pnpm lint && pnpm fmt:check",
|
||||
"coverage": "go test ./apps/api/internal/... -coverprofile=coverage.out && go tool cover -func=coverage.out | tee coverage.txt && awk '/^total:/ { sub(/%/, \"\", $3); if ($3 + 0 < 90) exit 1 }' coverage.txt",
|
||||
"dev:web": "pnpm --filter @clickclack/web dev",
|
||||
"dev:api": "go run ./apps/api/cmd/clickclack serve",
|
||||
"fmt": "gofmt -w apps/api && oxfmt --write \"apps/web/src/**/*.{ts,svelte}\" \"packages/sdk-ts/src/**/*.ts\" \"examples/**/*.ts\"",
|
||||
"fmt": "gofmt -w apps/api && pnpm fmt:ts",
|
||||
"fmt:check": "pnpm fmt:go:check && pnpm fmt:ts:check",
|
||||
"fmt:go:check": "files=$(gofmt -l apps/api) && test -z \"$files\" || (printf '%s\n' \"$files\" && exit 1)",
|
||||
"fmt:ts": "oxfmt --write \"apps/web/src/**/*.{ts,svelte}\" \"packages/sdk-ts/src/**/*.ts\" \"examples/**/*.ts\" \"tests/e2e/**/*.ts\" \"playwright.config.ts\"",
|
||||
"fmt:ts:check": "oxfmt --check \"apps/web/src/**/*.{ts,svelte}\" \"packages/sdk-ts/src/**/*.ts\" \"examples/**/*.ts\" \"tests/e2e/**/*.ts\" \"playwright.config.ts\"",
|
||||
"lint": "oxlint apps/web/src packages/sdk-ts/src examples tests/e2e playwright.config.ts",
|
||||
"test:e2e": "playwright test",
|
||||
"typecheck": "tsgo --noEmit -p tsconfig.json",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user