测试:优化 server 数据库夹具并接入 race 门禁
This commit is contained in:
1 parent
a642b02ec3
commit
1b60d161ee
6 files changed
+215
-8
No files matched your search
@@ -0,0 +1,90 @@
|
||||
name: Pull Request 质量门禁
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
go:
|
||||
name: Go 检查
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 配置 Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: 检查格式
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
if [ -n "$(gofmt -l .)" ]; then
|
||||
echo "发现未格式化的 Go 文件,请先运行 gofmt -w。" >&2
|
||||
gofmt -l .
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 检查中文注释
|
||||
run: go run ./tools/commentlint -mode check -root . -baseline .commentlint/go-baseline.json
|
||||
|
||||
- name: 运行 go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: 运行 golangci-lint
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.1
|
||||
args: ./...
|
||||
|
||||
- name: 运行 Go 测试
|
||||
run: go test ./...
|
||||
|
||||
- name: 运行 server 并发 smoke race
|
||||
run: make test-server-race
|
||||
|
||||
frontend:
|
||||
name: React 前端检查
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 配置 Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: 安装前端依赖
|
||||
run: npm ci --prefix frontend
|
||||
|
||||
- name: 检查中文注释
|
||||
run: npm run comments:check --prefix frontend
|
||||
|
||||
- name: 检查 TypeScript 类型
|
||||
run: npm run typecheck --prefix frontend
|
||||
|
||||
- name: 运行前端测试
|
||||
run: npm test --prefix frontend
|
||||
|
||||
- name: 构建并校验嵌入式前端产物
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
npm run build --prefix frontend
|
||||
git diff --exit-code -- internal/webui/static
|
||||
Reference in new issue
Block a user