改用本地推送质量检查

This commit is contained in:
yml2213
2026-08-31 12:32:13 +08:00
parent efde8897c8
commit d47360f484
3 changed files with 21 additions and 36 deletions
-36
View File
@@ -1,36 +0,0 @@
name: 代码质量
on:
push:
pull_request:
jobs:
backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: apps/backend/package-lock.json
- run: npm ci
- run: npm run check
frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: apps/frontend/package-lock.json
- run: npm ci
- run: npm run check
+15
View File
@@ -97,6 +97,21 @@ docker compose -f docker-compose.dev.yml exec -T frontend npm run typecheck
docker compose -f docker-compose.dev.yml exec -T frontend npm run build
```
### 本地推送检查
本项目不使用 Gitea Actions。需要在本机推送前自动执行前后端检查时,启用本地 Git hook:
```bash
bash scripts/install-git-hooks.sh
```
启用后,每次 `git push` 会依次执行 `apps/backend``apps/frontend``npm run check`
仅临时跳过检查时使用:
```bash
SKIP_CHECKS=1 git push
```
## 数据库迁移
采用 **基线 + 渐进增量** 策略,由 `node-pg-migrate` 管理,记录表为 `schema_migrations`
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
git -C "$ROOT_DIR" config core.hooksPath .githooks
echo "已启用 .githooks(推送前执行 backend/frontend 本地检查;SKIP_CHECKS=1 可跳过)"