diff --git a/.gitea/workflows/quality.yml b/.gitea/workflows/quality.yml deleted file mode 100644 index bc6f472e..00000000 --- a/.gitea/workflows/quality.yml +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 0a8f86aa..6547b669 100644 --- a/README.md +++ b/README.md @@ -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`。 diff --git a/scripts/install-git-hooks.sh b/scripts/install-git-hooks.sh new file mode 100755 index 00000000..294e1440 --- /dev/null +++ b/scripts/install-git-hooks.sh @@ -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 可跳过)"