From cd7e24cd3cdd9e1f22dd9a2ff94be40a8a31d166 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 14 Jun 2026 16:12:05 +0800 Subject: [PATCH] =?UTF-8?q?[moz]=20ci:=20CI=20=E7=AE=A1=E9=81=93=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20frontend=20build=20job=EF=BC=88tsc=20+=20vite=20bui?= =?UTF-8?q?ld=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8cacba4..82ffd4b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -62,12 +62,30 @@ jobs: (echo '=== RETRY WITH VERBOSE ===' && \ PYTHONPATH=$(pwd) /tmp/ci-venv-test/bin/pytest tests/ -m "not e2e" -x -v 2>&1 | tail -30) - # ── Job 3: CI 失败通知 ─────────────────────────────── + # ── Job 3: Frontend Build ─────────────────────────── + frontend: + runs-on: macos-arm64 + needs: lint + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install & Build + run: | + cd src/frontend + npm ci || npm install + npm run build + + # ── Job 4: CI 失败通知 ─────────────────────────────── # 使用 needs..result 直接判断,不查询 commit status API # 根因:notify 自身的 pending status 会污染 commit status 查询结果(竞态条件) notify-on-failure: runs-on: macos-arm64 - needs: [lint, test] + needs: [lint, test, frontend] if: always() steps: - name: Check results and notify @@ -75,12 +93,13 @@ jobs: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} LINT_RESULT: ${{ needs.lint.result }} TEST_RESULT: ${{ needs.test.result }} + FRONTEND_RESULT: ${{ needs.frontend.result }} run: | echo "Lint result: $LINT_RESULT" echo "Test result: $TEST_RESULT" # 只有 lint 或 test 明确失败时才发通知 - if [ "$LINT_RESULT" = "failure" ] || [ "$TEST_RESULT" = "failure" ]; then + if [ "$LINT_RESULT" = "failure" ] || [ "$TEST_RESULT" = "failure" ] || [ "$FRONTEND_RESULT" = "failure" ]; then echo "CI has failures, sending notification..." # 如果是 PR 事件,写评论通知 @@ -90,6 +109,7 @@ jobs: FAILED_JOBS="" [ "$LINT_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}lint " [ "$TEST_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}test " + [ "$FRONTEND_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}frontend " curl -sf -X POST \ -H "Authorization: token $GITEA_TOKEN" \