Files
WeKnora/.github/workflows/cli.yml
T
NianJiu 832b5fede8 ci: close 6 production test gate blind spots and add Lite E2E smoke test
Why:
PR CI previously left six production-critical paths unverified:
1. .github/workflows/app.yml ran without PostgreSQL/ParadeDB or Redis service
   containers and left WEKNORA_*_POSTGRES_DSN / WEKNORA_TEST_REDIS_ADDR unset,
   causing all PostgreSQL migration, row-locking, pgvector, catalog, and
   multi-replica Redis tests to 100% t.Skip (masking a step-down regression in
   TestPostgresMigrationsServeAgentHistory once migrations >000106 were added).
2. app.yml invoked go vet/test without -tags sqlite_fts5, causing SQLite FTS5
   retriever tests under internal/application/repository/retriever/sqlite to
   100% t.Skip.
3. Desktop build-tag checks only ran ./internal/container, missing
   ./internal/application/service, ./cmd/desktop, and darwin/windows
   cross-compilation of ./internal/localsandbox/{seatbelt,winhost}, while
   release-lite.yml remained pinned to GO_VERSION=1.24 (go.mod requires 1.26.0).
4. The standalone client/ Go SDK module was excluded by app.yml (!client/**)
   and ignored by cli.yml / cli-e2e.yml / pre-push hooks despite cli/
   depending on ../client (masking unformatted files and a Unix-only 0o640
   permission assertion on Windows in client/).
5. High-concurrency packages (internal/stream, internal/sandbox,
   internal/agent, internal/im) ran without -race, and PR CI had no
   zero-external-dependency Lite mode end-to-end smoke test.

What:
- Provision paradedb/paradedb:v0.25.11-pg17 and redis:7.0-alpine services in
  app.yml, create isolated disposable test databases, and inject all
  PostgreSQL/Redis test DSNs with WEKNORA_REQUIRE_INTEGRATION=1; fix
  TestPostgresMigrationsServeAgentHistory to migrate down before 000106 and
  back up instead of stepping -1 from HEAD.
- Pass -tags sqlite_fts5 across app.yml and git hooks while keeping an explicit
  non-FTS5 run for TestSaveWorksWhenTheFTS5ModuleIsNotCompiledIn.
- Vet, test, and build ./internal/container, ./internal/application/service,
  and ./cmd/desktop with -tags desktop,sqlite_fts5; isolate cgo-only pg_query
  and gojieba bindings behind !cgo stubs so darwin/arm64 and windows/amd64
  cross-compilation of ./internal/localsandbox/... runs on Linux CI; align
  release-lite.yml GO_VERSION to 1.26.
- Watch client/** in cli.yml, cli-e2e.yml, and git pre-push hooks, running
  client gofmt, build, vet, and -race tests across Linux, macOS, and Windows,
  and fix the pre-existing gofmt drift and Windows permission assertion in
  client/ uncovered by the new gate.
- Enable -race on internal/{stream,sandbox,agent,im}/... and add
  tests/lite_smoke/lite_e2e_test.go exercising a real WeKnora-lite subprocess
  end-to-end (auth, models, KB, Markdown upload/indexing, vector+FTS5 search,
  SSE RAG chat, message persistence, and SIGTERM shutdown).
2026-11-18 15:10:24 +08:00

78 lines
2.2 KiB
YAML

name: CLI
# Builds and tests the cli/ Go module on every push / PR that touches it.
# Foundation PR (PR-1) gates: 3-platform `go build` + `go test ./...` green.
on:
push:
branches: [main]
paths:
- 'cli/**'
- 'client/**'
- '.github/workflows/cli.yml'
pull_request:
paths:
- 'cli/**'
- 'client/**'
- '.github/workflows/cli.yml'
workflow_dispatch:
defaults:
run:
working-directory: cli
# Windows default is PowerShell, which tokenizes `go test -coverprofile=coverage.out ./...`
# in a way that detaches `.out` as a separate positional package arg.
# Force bash everywhere so the run lines parse identically across platforms
# (Git Bash is preinstalled on windows-latest runners).
shell: bash
permissions:
contents: read
jobs:
test:
name: test (${{ matrix.os }} / go ${{ matrix.go }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.26']
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
cache-dependency-path: cli/go.sum
- name: Check client formatting
if: runner.os == 'Linux'
working-directory: client
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following client Go files are not gofmt-formatted:"
echo "$unformatted"
exit 1
fi
- name: client go build, vet, and test
working-directory: client
run: |
go build ./...
go vet ./...
go test -race ./...
- name: go build
run: go build ./...
- name: go test
run: go test -race -coverprofile=coverage.out ./...
- name: go vet
run: go vet ./...
- name: Check agent-facing doc wire vocabulary
if: runner.os == 'Linux'
run: scripts/check-skill-wire-vocab.sh
- name: Check for committed credentials in docs
if: runner.os == 'Linux'
run: scripts/check-secret-tokens.sh
- name: coverage report
if: matrix.os == 'ubuntu-latest'
run: go tool cover -func=coverage.out