|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + library: |
| 11 | + name: Library — lint / test / build |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: actions/setup-node@v4 |
| 16 | + with: |
| 17 | + node-version: 22 |
| 18 | + cache: npm |
| 19 | + - run: npm ci |
| 20 | + - run: npx nx lint stream-resource |
| 21 | + - run: npx nx test stream-resource --coverage |
| 22 | + - run: npx nx build stream-resource --configuration=production |
| 23 | + |
| 24 | + website: |
| 25 | + name: Website — lint / build |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: 22 |
| 32 | + cache: npm |
| 33 | + - run: npm ci |
| 34 | + - run: npx nx lint website |
| 35 | + # nx build website triggers demo:build first (dependsOn in project.json) |
| 36 | + - run: npx nx build website |
| 37 | + |
| 38 | + mcp: |
| 39 | + name: MCP — build / smoke |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 22 |
| 46 | + cache: npm |
| 47 | + - run: npm ci |
| 48 | + - run: npx nx test mcp --skip-nx-cache |
| 49 | + |
| 50 | + chat-agent-smoke: |
| 51 | + name: Chat Agent — smoke |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + - uses: actions/setup-node@v4 |
| 56 | + with: |
| 57 | + node-version: 22 |
| 58 | + cache: npm |
| 59 | + - name: Install uv |
| 60 | + uses: astral-sh/setup-uv@v4 |
| 61 | + with: |
| 62 | + python-version: '3.12' |
| 63 | + - run: npm ci |
| 64 | + - working-directory: examples/chat-agent |
| 65 | + run: uv sync |
| 66 | + - run: npx nx run chat-agent:smoke --skip-nx-cache |
| 67 | + |
| 68 | + website-e2e: |
| 69 | + name: Website — e2e |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + - uses: actions/setup-node@v4 |
| 74 | + with: |
| 75 | + node-version: 22 |
| 76 | + cache: npm |
| 77 | + - run: npm ci |
| 78 | + - run: npx playwright install --with-deps chromium |
| 79 | + - run: npx nx e2e website --skip-nx-cache |
| 80 | + |
| 81 | + deploy: |
| 82 | + name: Deploy → Vercel |
| 83 | + needs: [library, website, mcp, chat-agent-smoke, website-e2e] |
| 84 | + runs-on: ubuntu-latest |
| 85 | + # Only deploy on pushes to main, not on pull requests |
| 86 | + if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + - uses: actions/setup-node@v4 |
| 90 | + with: |
| 91 | + node-version: 22 |
| 92 | + cache: npm |
| 93 | + # Vercel re-runs the full build on its servers using vercel.json buildCommand. |
| 94 | + # Required GitHub secrets (Settings → Secrets and variables → Actions): |
| 95 | + # VERCEL_TOKEN — vercel.com/account/tokens |
| 96 | + # VERCEL_ORG_ID — from .vercel/project.json after `vercel link` |
| 97 | + # VERCEL_PROJECT_ID — from .vercel/project.json after `vercel link` |
| 98 | + - run: npm ci |
| 99 | + - run: npx playwright install --with-deps chromium |
| 100 | + - name: Deploy to Vercel (production) |
| 101 | + id: deploy |
| 102 | + run: | |
| 103 | + url=$(npx vercel deploy --prod --yes --token=${{ secrets.VERCEL_TOKEN }} | tail -n 1) |
| 104 | + echo "deployment_url=$url" >> "$GITHUB_OUTPUT" |
| 105 | + env: |
| 106 | + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
| 107 | + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
| 108 | + - name: Verify deployed website |
| 109 | + run: npx nx e2e website --skip-nx-cache |
| 110 | + env: |
| 111 | + BASE_URL: ${{ steps.deploy.outputs.deployment_url }} |
0 commit comments