Merge pull request #58 from Thibaultjaigu/add-requesty-byok #164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| workspace-build: | |
| name: workspace build smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8.15.4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Cache turbo | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| turbo-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: I18n changed-file guard | |
| env: | |
| I18N_AUDIT_BASE: ${{ github.event.pull_request.base.sha || github.event.before || 'HEAD' }} | |
| run: pnpm i18n:check:changed | |
| - name: Build all workspace packages (except admin & desktop) | |
| # - admin: build 脚本含 tsc 严格检查、有已知 drift,单独走 vite-only 烟囱 | |
| # - desktop: 走 tauri build,需要 Rust 工具链,应在专用 release pipeline 跑 | |
| # 其余覆盖 contracts/config/i18n/ui/app/cloud-console/site/cloud-api | |
| run: pnpm exec turbo run build --filter=!@yinjie/admin --filter=!@yinjie/desktop | |
| - name: Admin vite-only build smoke | |
| # 验证 admin 能产出可发布的前端 bundle(绕开 tsc drift) | |
| run: pnpm --filter @yinjie/admin exec vite build | |
| api-smoke: | |
| name: api (NestJS) build smoke | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: api | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: api/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build (nest build) | |
| run: npm run build | |
| - name: Verify build output | |
| # 编出 dist/main.js 才算"能跑起来" | |
| run: test -f dist/main.js | |
| cloud-smoke: | |
| name: cloud-smoke (browser e2e) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| diagnosis_highest_severity: ${{ steps.cloud_smoke_diagnosis.outputs.highest_severity }} | |
| diagnosis_primary_candidate_id: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_id }} | |
| diagnosis_primary_candidate_title: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_title }} | |
| diagnosis_primary_candidate_recommended_artifacts: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_recommended_artifacts }} | |
| diagnosis_primary_candidate_next_step: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_next_step }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8.15.4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Cache turbo | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| turbo-${{ runner.os }}- | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| playwright-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Test cloud smoke artifact collector | |
| run: pnpm test:cloud-smoke-artifacts | |
| - name: Test cloud smoke manifest diagnosis | |
| run: pnpm test:cloud-smoke-diagnosis | |
| - name: Install Playwright Chromium | |
| run: pnpm --filter @yinjie/cloud-console exec playwright install --with-deps chromium | |
| - name: Cloud smoke validation | |
| env: | |
| YINJIE_TEST_PRESERVE_TMP: "1" | |
| run: | | |
| rm -rf /tmp/yinjie-cloud-console-browser-* | |
| pnpm ci:cloud:browser | |
| - name: Collect cloud smoke artifacts | |
| if: failure() | |
| run: node ./scripts/collect-cloud-smoke-artifacts.mjs | |
| - name: Analyze cloud smoke manifest | |
| if: failure() | |
| id: cloud_smoke_diagnosis | |
| run: node ./scripts/analyze-cloud-smoke-manifest.mjs | |
| - name: Publish cloud smoke verdict annotation | |
| if: failure() && steps.cloud_smoke_diagnosis.outcome == 'success' | |
| env: | |
| DIAG_SEVERITY: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_severity }} | |
| DIAG_TITLE: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_title }} | |
| DIAG_ARTIFACTS: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_recommended_artifacts }} | |
| DIAG_NEXT_STEP: ${{ steps.cloud_smoke_diagnosis.outputs.primary_candidate_next_step }} | |
| run: | | |
| annotation_level=notice | |
| case "$DIAG_SEVERITY" in | |
| high) annotation_level=error ;; | |
| medium) annotation_level=warning ;; | |
| esac | |
| message="$DIAG_TITLE" | |
| if [ -n "$DIAG_ARTIFACTS" ]; then | |
| message="$message | Start with: $DIAG_ARTIFACTS" | |
| fi | |
| if [ -n "$DIAG_NEXT_STEP" ]; then | |
| message="$message | Next step: $DIAG_NEXT_STEP" | |
| fi | |
| echo "::${annotation_level} title=Cloud smoke verdict::${message}" | |
| - name: Upload cloud smoke diagnosis | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cloud-smoke-diagnosis | |
| retention-days: 7 | |
| if-no-files-found: error | |
| path: .artifacts/cloud-smoke/diagnosis.json | |
| - name: Upload cloud smoke manifest | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cloud-smoke-manifest | |
| retention-days: 7 | |
| if-no-files-found: error | |
| path: .artifacts/cloud-smoke/manifest.json | |
| - name: Upload cloud smoke Playwright artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cloud-smoke-playwright-artifacts | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| path: .artifacts/cloud-smoke/playwright | |
| - name: Upload cloud smoke browser harness artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cloud-smoke-browser-harness | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| path: .artifacts/cloud-smoke/browser-harness |