[moz] ci: CI 管道新增 frontend build job(tsc + vite build)
This commit is contained in:
+23
-3
@@ -62,12 +62,30 @@ jobs:
|
|||||||
(echo '=== RETRY WITH VERBOSE ===' && \
|
(echo '=== RETRY WITH VERBOSE ===' && \
|
||||||
PYTHONPATH=$(pwd) /tmp/ci-venv-test/bin/pytest tests/ -m "not e2e" -x -v 2>&1 | tail -30)
|
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.<job>.result 直接判断,不查询 commit status API
|
# 使用 needs.<job>.result 直接判断,不查询 commit status API
|
||||||
# 根因:notify 自身的 pending status 会污染 commit status 查询结果(竞态条件)
|
# 根因:notify 自身的 pending status 会污染 commit status 查询结果(竞态条件)
|
||||||
notify-on-failure:
|
notify-on-failure:
|
||||||
runs-on: macos-arm64
|
runs-on: macos-arm64
|
||||||
needs: [lint, test]
|
needs: [lint, test, frontend]
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: Check results and notify
|
- name: Check results and notify
|
||||||
@@ -75,12 +93,13 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
LINT_RESULT: ${{ needs.lint.result }}
|
LINT_RESULT: ${{ needs.lint.result }}
|
||||||
TEST_RESULT: ${{ needs.test.result }}
|
TEST_RESULT: ${{ needs.test.result }}
|
||||||
|
FRONTEND_RESULT: ${{ needs.frontend.result }}
|
||||||
run: |
|
run: |
|
||||||
echo "Lint result: $LINT_RESULT"
|
echo "Lint result: $LINT_RESULT"
|
||||||
echo "Test result: $TEST_RESULT"
|
echo "Test result: $TEST_RESULT"
|
||||||
|
|
||||||
# 只有 lint 或 test 明确失败时才发通知
|
# 只有 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..."
|
echo "CI has failures, sending notification..."
|
||||||
|
|
||||||
# 如果是 PR 事件,写评论通知
|
# 如果是 PR 事件,写评论通知
|
||||||
@@ -90,6 +109,7 @@ jobs:
|
|||||||
FAILED_JOBS=""
|
FAILED_JOBS=""
|
||||||
[ "$LINT_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}lint "
|
[ "$LINT_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}lint "
|
||||||
[ "$TEST_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}test "
|
[ "$TEST_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}test "
|
||||||
|
[ "$FRONTEND_RESULT" = "failure" ] && FAILED_JOBS="${FAILED_JOBS}frontend "
|
||||||
|
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
|||||||
Reference in New Issue
Block a user