1
0

feat: release CI 加入全流程测试门禁

新增独立可复用测试 workflow(test.yml),在 release 构建前串行执行
lint、默认测试、MySQL 测试和 E2E 测试,测试不通过则阻止发布构建。
This commit is contained in:
2026-05-07 12:14:00 +08:00
parent c04a13bf8a
commit cd0b3e8fc1
5 changed files with 174 additions and 11 deletions

View File

@@ -37,9 +37,14 @@ jobs:
go run ./versionctl verify-tag "${GITHUB_REF_NAME}"
printf 'version=%s\n' "$version" >> "$GITHUB_OUTPUT"
test-gate:
name: Test Gate
needs: prepare
uses: ./.github/workflows/test.yml
build-web:
name: Build Web Asset
needs: prepare
needs: [prepare, test-gate]
runs-on: ubuntu-latest
permissions:
contents: read
@@ -81,7 +86,7 @@ jobs:
build-linux:
name: Build Linux ${{ matrix.arch }} Assets
needs: prepare
needs: [prepare, test-gate]
strategy:
fail-fast: false
matrix:
@@ -147,7 +152,7 @@ jobs:
build-windows:
name: Build Windows ${{ matrix.arch }} Assets
needs: prepare
needs: [prepare, test-gate]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
@@ -231,7 +236,7 @@ jobs:
build-macos:
name: Build macOS Assets
needs: prepare
needs: [prepare, test-gate]
runs-on: macos-15
permissions:
contents: read

60
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Test (Full)
on:
workflow_call:
permissions:
contents: read
jobs:
test-gate:
name: Test Gate
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: testpass
MYSQL_DATABASE: nex_test
MYSQL_USER: nex_test
MYSQL_PASSWORD: testpass
ports:
- 13306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -ptestpass"
--health-interval=3s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v5
with:
lfs: true
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.work
cache-dependency-path: |
backend/go.sum
versionctl/go.sum
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Lint
run: make lint
- name: Test
run: make test
- name: MySQL tests
run: cd backend && go test -tags=mysql ./tests/mysql/... -v -count=1
- name: Install Playwright browsers
run: cd frontend && bunx playwright install --with-deps chromium
- name: E2E tests
run: cd frontend && bun run test:e2e