mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-11-23 15:11:15 +08:00
Why: 1. In tests/lite_smoke/lite_e2e_test.go, exited was a 1-buffered channel sent once without closing: if waitForHealth consumed <-exited on an early server crash, t.Cleanup blocked forever on <-exited; serverLogs also used an unsynchronized bytes.Buffer read concurrently on startup/shutdown timeouts under -race, and subprocess/client HTTP calls could inherit developer ENV_FILE, REDIS_ADDR, or proxy settings. 2. frontend/src/utils/catalogToolDisplay.test.ts asserts UI locale coverage against docs/swagger.json, but frontend.yml did not trigger on swagger.json changes. 3. pre-push and cli.yml enforced gofmt on client/ and root Go files, but skipped gofmt checks on changed cli/**/*.go files, and cli-e2e.yml omitted client/go.sum from its Go cache key. What: - Replace single-read exited channel and raw bytes.Buffer in lite_e2e_test.go with a closed done channel + mutex-guarded syncBuffer, and isolate subprocess ENV_FILE/REDIS_ADDR/NO_PROXY and loopback HTTP transport from local proxies. - Add docs/swagger.json to frontend.yml push and pull_request path triggers. - Check gofmt on all changed Go files in pre-push and changed cli Go files in cli.yml, and add client/go.sum to cli-e2e.yml cache-dependency-path.
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
name: CLI E2E
|
|
|
|
# Runs the cli/acceptance/e2e/ suite against a real WeKnora server.
|
|
# Cost-gated so it doesn't fire on every PR:
|
|
# - workflow_dispatch: maintainer can trigger manually
|
|
# - pull_request labeled "acceptance-e2e": adding the label kicks a run
|
|
#
|
|
# Required repo secrets (only set on Tencent/WeKnora; cross-fork PRs have no
|
|
# access and the job exits early via the secrets-present guard):
|
|
# WEKNORA_E2E_HOST - https URL of the test server
|
|
# WEKNORA_E2E_TOKEN - bearer token / API key for that host
|
|
#
|
|
# Mirrors gh acceptance/ trigger pattern: env-gated, opt-in, single matrix.
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [labeled, synchronize]
|
|
paths:
|
|
- 'cli/**'
|
|
- 'client/**'
|
|
- '.github/workflows/cli-e2e.yml'
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: cli
|
|
shell: bash
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
e2e:
|
|
name: rag full loop
|
|
# Skip auto-trigger on label-add unless the label is exactly "acceptance-e2e".
|
|
# Manual workflow_dispatch always runs.
|
|
if: |
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'acceptance-e2e'))
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.26'
|
|
cache-dependency-path: |
|
|
cli/go.sum
|
|
client/go.sum
|
|
|
|
- name: secrets present
|
|
id: secrets
|
|
env:
|
|
E2E_HOST: ${{ secrets.WEKNORA_E2E_HOST }}
|
|
E2E_TOKEN: ${{ secrets.WEKNORA_E2E_TOKEN }}
|
|
run: |
|
|
if [ -z "$E2E_HOST" ] || [ -z "$E2E_TOKEN" ]; then
|
|
echo "::warning::WEKNORA_E2E_HOST or WEKNORA_E2E_TOKEN not set; skipping e2e."
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: go test -tags=acceptance_e2e
|
|
if: steps.secrets.outputs.skip == 'false'
|
|
env:
|
|
WEKNORA_E2E_HOST: ${{ secrets.WEKNORA_E2E_HOST }}
|
|
WEKNORA_E2E_TOKEN: ${{ secrets.WEKNORA_E2E_TOKEN }}
|
|
run: go test -tags=acceptance_e2e -v -timeout=8m ./acceptance/e2e/...
|