feat: 新增开发 CI 流程,重构 test.yml 支持分层测试
新增 ci.yml,在 push(dev/main)和 PR 时触发快速检查(lint + 全量测试) 重构 test.yml,新增 full 参数控制是否运行 MySQL 和 E2E 测试 release.yml 调用 test.yml 时传 full: true,行为与重构前一致 同步更新 ci-test-gate spec
This commit is contained in:
14
.github/workflows/ci.yml
vendored
Normal file
14
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev, main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
uses: ./.github/workflows/test.yml
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -41,6 +41,8 @@ jobs:
|
||||
name: Test Gate
|
||||
needs: prepare
|
||||
uses: ./.github/workflows/test.yml
|
||||
with:
|
||||
full: true
|
||||
|
||||
build-web:
|
||||
name: Build Web Asset
|
||||
|
||||
71
.github/workflows/test.yml
vendored
71
.github/workflows/test.yml
vendored
@@ -2,13 +2,48 @@ name: Test (Full)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
full:
|
||||
description: "Run full test suite including MySQL and E2E"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-gate:
|
||||
name: Test Gate
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
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
|
||||
|
||||
mysql:
|
||||
name: MySQL Tests
|
||||
if: inputs.full
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
@@ -41,18 +76,32 @@ jobs:
|
||||
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
|
||||
|
||||
e2e:
|
||||
name: E2E Tests
|
||||
if: inputs.full
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
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: Install Playwright browsers
|
||||
run: cd frontend && bunx playwright install --with-deps chromium
|
||||
|
||||
|
||||
Reference in New Issue
Block a user