From eb3db7585946b38aaa7094e5478b2689f074d54b Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 28 Jul 2026 16:04:13 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20P1+P2=E4=BC=98=E5=8C=96=20-=20AI=E9=97=A8?= =?UTF-8?q?=E7=A6=81/=E8=B7=B3=E8=BF=87=E9=80=BB=E8=BE=91/=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E6=9E=84=E5=BB=BA=E9=97=A8=E7=A6=81/daily-check?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P1-3: AI Code Review纳入CI Gate(failure阻塞,pending放行,跨workflow读commit status) P1-4: 纯前端/纯后端PR跳过无关检查 - frontend-lint: 纯后端PR跳过(needs check-frontend-only + if条件) - build-pr: 按service维度跳过,纯前端跳API+Worker,纯后端跳Web P1-5: build-production等测试通过才开始构建(needs 5个检查job) P2-6: daily-check.yml outputs修复 - staging-e2e: steps.smoke → steps.e2e - staging-api-tests: steps.smoke → steps.report P2-7: preview-cleanup默认SSH host对齐preview-deploy (172.30.18.197→47.98.113.167) --- .gitea/workflows/ci-pipeline.yml | 44 +++++++++++++++++++++++++++- .gitea/workflows/daily-check.yml | 4 +-- .gitea/workflows/preview-cleanup.yml | 2 +- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci-pipeline.yml b/.gitea/workflows/ci-pipeline.yml index 192bad25d..d4aa85d7d 100755 --- a/.gitea/workflows/ci-pipeline.yml +++ b/.gitea/workflows/ci-pipeline.yml @@ -458,6 +458,8 @@ jobs: name: Frontend Lint runs-on: ci-l2 timeout-minutes: 10 + needs: check-frontend-only + if: needs.check-frontend-only.outputs.skip_frontend != 'true' steps: - name: Checkout code shell: sh @@ -576,7 +578,12 @@ jobs: name: PR Build ${{ matrix.service_display }} Image runs-on: runtime-builder timeout-minutes: ${{ matrix.timeout }} - if: github.event_name == 'pull_request' + needs: check-frontend-only + if: | + github.event_name == 'pull_request' && ( + (matrix.service == 'web' && needs.check-frontend-only.outputs.skip_frontend != 'true') || + (matrix.service != 'web' && needs.check-frontend-only.outputs.skip_backend != 'true') + ) strategy: fail-fast: false matrix: @@ -1192,6 +1199,11 @@ jobs: runs-on: runtime-builder timeout-minutes: ${{ matrix.timeout }} needs: + - validate-code-quality + - validate-type-check + - unit-tests + - frontend-lint + - frontend-unit-test if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'push' && github.ref_name == 'main') strategy: fail-fast: false @@ -1718,6 +1730,30 @@ jobs: echo " frontend-lint: $RESULT_FRONTEND_LINT" echo " frontend-unit-test: $RESULT_FRONTEND_UNIT" echo " build-pr: $RESULT_BUILD_PR" + + # 查询 AI Code Review 状态(跨workflow,读commit status) + AI_REVIEW_STATUS="pending" + AI_REVIEW_DESC="" + STATUS_JSON=$(curl -sH "Authorization: token $GITHUB_TOKEN" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/commits/${PR_HEAD_SHA}/status" 2>/dev/null || true) + if [ -n "$STATUS_JSON" ]; then + AI_STATUS=$(echo "$STATUS_JSON" | python3 -c " +import json,sys +try: + data=json.load(sys.stdin) + for s in data.get('statuses',[]): + if 'AI Code Review' in s.get('context',''): + print(s['state']+'|'+s.get('description','')) + break +except: pass +" 2>/dev/null) + if [ -n "$AI_STATUS" ]; then + AI_REVIEW_STATUS="${AI_STATUS%%|*}" + AI_REVIEW_DESC="${AI_STATUS#*|}" + fi + fi + echo " ai-code-review: $AI_REVIEW_STATUS ($AI_REVIEW_DESC)" + echo "" # 判断PR类型 @@ -1733,6 +1769,7 @@ jobs: "validate-migration:$RESULT_MIGRATION" "frontend-lint:$RESULT_FRONTEND_LINT" "build-pr:$RESULT_BUILD_PR" + "ai-code-review:$AI_REVIEW_STATUS" ) # 后端检查 @@ -1767,6 +1804,11 @@ jobs: for item in "${REQUIRED_GENERAL[@]}"; do name="${item%%:*}" result="${item##*:}" + # AI Code Review pending时不阻塞(可能还在跑),等它跑完自然会重跑Gate + if [ "$name" = "ai-code-review" ] && [ "$result" = "pending" ]; then + echo " ⏳ $name: pending(审查中,暂不阻塞)" + continue + fi check_job "$name" "$result" done diff --git a/.gitea/workflows/daily-check.yml b/.gitea/workflows/daily-check.yml index 72864174f..cdaaaf695 100644 --- a/.gitea/workflows/daily-check.yml +++ b/.gitea/workflows/daily-check.yml @@ -87,7 +87,7 @@ jobs: runs-on: ci-l2 timeout-minutes: 10 outputs: - report: ${{ steps.smoke.outputs.report }} + report: ${{ steps.report.outputs.report }} steps: - name: Checkout code @@ -201,7 +201,7 @@ jobs: runs-on: ci-l2 timeout-minutes: 15 outputs: - report: ${{ steps.smoke.outputs.report }} + report: ${{ steps.e2e.outputs.report }} steps: - name: Checkout code diff --git a/.gitea/workflows/preview-cleanup.yml b/.gitea/workflows/preview-cleanup.yml index a1977ab08..dbe308548 100755 --- a/.gitea/workflows/preview-cleanup.yml +++ b/.gitea/workflows/preview-cleanup.yml @@ -120,7 +120,7 @@ jobs: PREVIEW_SSH_KEY: ${{ secrets.PREVIEW_SSH_KEY }} run: | set -eux - preview_host="${PREVIEW_SSH_HOST:-172.30.18.197}" + preview_host="${PREVIEW_SSH_HOST:-47.98.113.167}" preview_user="${PREVIEW_SSH_USER:-deploy}" preview_port="${PREVIEW_SSH_PORT:-22222}" preview_dir="/var/www/preview/pr-${PR_NUMBER}" -- 2.54.0