改用本地推送质量检查
This commit is contained in:
@@ -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
|
||||
@@ -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`。
|
||||
|
||||
Executable
+6
@@ -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 可跳过)"
|
||||
Reference in New Issue
Block a user