- Dockerfile: node:18-slim 升级 node:20-slim(LTS,better-sqlite3 有预编译二进制) - engines 统一 node >=20.19.0(对齐 Vite 8 要求,前后端一致) - backend 新增 npm test(node --test,自动发现 test/ 目录) - 新增 .github/workflows/ci.yml:后端 npm test + 前端 build - 提交 frontend/package-lock.json,CI 依赖缓存生效
39 lines
912 B
YAML
39 lines
912 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
backend-test:
|
|
name: Backend tests
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
cache-dependency-path: backend/package-lock.json
|
|
- run: npm install --registry=https://registry.npmmirror.com
|
|
- run: npm test
|
|
|
|
frontend-build:
|
|
name: Frontend build
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
- run: npm install --registry=https://registry.npmmirror.com
|
|
- run: npm run build |