ci: 搭建前后端持续集成

This commit is contained in:
leonincs
2026-05-24 00:19:34 +08:00
parent 8a3d18b097
commit 88196db47f
2 changed files with 71 additions and 0 deletions

64
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: CI
on:
pull_request:
push:
branches:
- main
- master
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24.x"
cache-dependency-path: backend/go.sum
- name: Download dependencies
run: go mod download
- name: Vet
run: go vet ./...
- name: Test
run: go test -race -count=1 ./...
frontend:
name: Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build

View File

@@ -66,6 +66,13 @@ cd frontend
npm install && npm run dev
```
## CI
GitHub Actions 配置位于 `.github/workflows/ci.yml`,在 Pull Request 以及推送到 `main``master` 时运行。
- 后端Go 1.24.x执行 `go mod download``go vet ./...``go test -race -count=1 ./...`
- 前端Node.js 22执行 `npm ci``npm run build`
## 接口清单
### 账号 `/account`