ci(engineering): Gitea Actions 门禁 + 前端测试设施 + 版本注入修复
- .gitea/workflows/ci.yml:后端 gofmt/vet/test + 前端 lint/test/build 双 job 门禁 - vitest + @testing-library + jsdom 落地,14 个命脉用例:useListQuery 乱序丢弃/卸载中止、 http.ts 401 单飞刷新+队列重放+失败登出+silent 直拒、审计防抖、StepDeploy 部署目标、query-utils - 版本注入断裂修复:main 补 buildTime/gitCommit 符号,build.sh/Dockerfile 注入 main.version, /health 返回真实版本,前端 package.json 版本对齐 2.0.0 - gofmt 清零(8 个存量未格式化文件)
This commit is contained in:
1 parent
2975452c21
commit
4f74fe6c3f
23 files changed
+1399
-77
No files matched your search
@@ -0,0 +1,55 @@
|
||||
# Gitea Actions CI — 合并门禁(与 GitHub Actions 语法兼容)
|
||||
# 后端: gofmt/vet/test;前端: lint/build/test。全部通过才允许合并。
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
name: Backend (go vet + test)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: backend/go.mod
|
||||
cache-dependency-path: backend/go.sum
|
||||
- name: gofmt check
|
||||
working-directory: backend
|
||||
run: |
|
||||
unformatted=$(gofmt -l .)
|
||||
if [ -n "$unformatted" ]; then
|
||||
echo "::error::以下文件未通过 gofmt:"; echo "$unformatted"; exit 1
|
||||
fi
|
||||
- name: go vet
|
||||
working-directory: backend
|
||||
run: go vet ./...
|
||||
- name: go test
|
||||
working-directory: backend
|
||||
run: go test ./...
|
||||
|
||||
frontend:
|
||||
name: Frontend (lint + build + test)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
- name: npm ci
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
- name: lint
|
||||
working-directory: frontend
|
||||
run: npm run lint
|
||||
- name: test
|
||||
working-directory: frontend
|
||||
run: npm test
|
||||
- name: build
|
||||
working-directory: frontend
|
||||
run: npm run build
|
||||
Reference in new issue
Block a user