ci: disable validate and tool-selection eval jobs #193
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: Production | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: production-${{ github.workflow }} | |
| cancel-in-progress: false | |
| env: | |
| TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.VERCEL_ORG_ID }} | |
| jobs: | |
| # --------------------------------------------------------------------------- | |
| # Detect which services are affected (turbo dependency graph) | |
| # --------------------------------------------------------------------------- | |
| detect-changes: | |
| name: Detect changes | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 5 | |
| env: | |
| TURBO_SCM_BASE: ${{ github.event.before }} | |
| outputs: | |
| api: ${{ steps.affected.outputs.api }} | |
| dashboard: ${{ steps.affected.outputs.dashboard }} | |
| worker: ${{ steps.affected.outputs.worker }} | |
| website: ${{ steps.affected.outputs.website }} | |
| jobs: ${{ steps.affected.outputs.jobs }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 50 | |
| - uses: ./.github/actions/setup | |
| - name: Detect affected services | |
| id: affected | |
| run: | | |
| AFFECTED=$(bunx turbo build --affected --dry-run=json 2>/dev/null | jq -r '.packages[]' 2>/dev/null || echo "") | |
| echo "Affected packages: $AFFECTED" | |
| echo "api=$(echo "$AFFECTED" | grep -q '@midday/api' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| echo "dashboard=$(echo "$AFFECTED" | grep -q '@midday/dashboard' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| echo "worker=$(echo "$AFFECTED" | grep -q '@midday/worker' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| echo "website=$(echo "$AFFECTED" | grep -q '@midday/website' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| echo "jobs=$(echo "$AFFECTED" | grep -q '@midday/jobs' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| # --------------------------------------------------------------------------- | |
| # Validate — runs in parallel with detect-changes | |
| # TEMPORARILY DISABLED: set `if: false` to skip; remove to re-enable. | |
| # --------------------------------------------------------------------------- | |
| validate: | |
| name: Validate | |
| if: false | |
| runs-on: blacksmith-16vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| services: | |
| postgres-test: | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_DB: midday_test | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5433:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| TURBO_SCM_BASE: ${{ github.event.before }} | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5433/midday_test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 50 | |
| - uses: ./.github/actions/setup | |
| - name: Setup test database schema | |
| run: | | |
| PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d midday_test -f src/test/helpers/setup-test-db.sql | |
| bunx drizzle-kit push --config=drizzle.config.test.ts --force | |
| working-directory: packages/db | |
| - name: Lint | |
| run: bunx turbo lint --affected | |
| - name: Build required type dependencies | |
| run: bunx turbo build --filter=workbench | |
| - name: Typecheck | |
| run: bunx turbo typecheck --affected | |
| - name: Test | |
| run: bunx turbo test --affected | |
| # --------------------------------------------------------------------------- | |
| # Tool selection evals — runs when API changes to catch regressions | |
| # TEMPORARILY DISABLED: set `if: false` to skip; restore the condition to re-enable. | |
| # --------------------------------------------------------------------------- | |
| eval-tool-selection: | |
| name: Tool selection evals | |
| needs: [detect-changes] | |
| if: false | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Rebuild better-sqlite3 for Node | |
| run: cd node_modules/better-sqlite3 && npx --yes node-gyp rebuild | |
| - name: Run tool selection evals | |
| run: bun run eval:run | |
| working-directory: apps/api | |
| # --------------------------------------------------------------------------- | |
| # Deploy API to Railway | |
| # --------------------------------------------------------------------------- | |
| deploy-api: | |
| name: Deploy API | |
| needs: [detect-changes, validate, eval-tool-selection] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.detect-changes.outputs.api == 'true' && | |
| (needs.eval-tool-selection.result == 'success' || needs.eval-tool-selection.result == 'skipped') | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| concurrency: railway-api-production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Stamp git SHA for Docker build | |
| run: echo "${{ github.sha }}" > .git-commit-sha | |
| - name: Deploy to Railway | |
| run: npx @railway/cli up --service api | |
| env: | |
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} | |
| # --------------------------------------------------------------------------- | |
| # E2E smoke tests — runs against production API after deployment | |
| # --------------------------------------------------------------------------- | |
| e2e-api: | |
| name: E2E API tests | |
| needs: [detect-changes, validate, deploy-api] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.deploy-api.result == 'success' | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Wait for API to be healthy | |
| run: | | |
| for i in $(seq 1 30); do | |
| if curl -sf "${{ secrets.PRODUCTION_API_URL }}/health" > /dev/null 2>&1; then | |
| echo "API is healthy" | |
| exit 0 | |
| fi | |
| echo "Waiting for API... ($i/30)" | |
| sleep 5 | |
| done | |
| echo "API did not become healthy in time" | |
| exit 1 | |
| - name: Run E2E tests against production | |
| env: | |
| API_BASE_URL: ${{ secrets.PRODUCTION_API_URL }} | |
| MIDDAY_API_KEY: ${{ secrets.PRODUCTION_API_KEY }} | |
| run: bun test --exit --timeout 60000 src/__tests__/e2e/ | |
| working-directory: apps/api | |
| # --------------------------------------------------------------------------- | |
| # Deploy Dashboard to Railway (waits for API when both change) | |
| # --------------------------------------------------------------------------- | |
| deploy-dashboard: | |
| name: Deploy Dashboard | |
| needs: [detect-changes, validate, deploy-api] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.detect-changes.outputs.dashboard == 'true' && | |
| (needs.deploy-api.result == 'success' || needs.deploy-api.result == 'skipped') | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| concurrency: railway-dashboard-production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Stamp git SHA for Docker build | |
| run: echo "${{ github.sha }}" > .git-commit-sha | |
| - name: Deploy to Railway | |
| run: npx @railway/cli up --service dashboard | |
| env: | |
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} | |
| # --------------------------------------------------------------------------- | |
| # Deploy Worker to Railway (waits for API when both change) | |
| # --------------------------------------------------------------------------- | |
| deploy-worker: | |
| name: Deploy Worker | |
| needs: [detect-changes, validate, deploy-api] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.detect-changes.outputs.worker == 'true' && | |
| (needs.deploy-api.result == 'success' || needs.deploy-api.result == 'skipped') | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| concurrency: railway-worker-production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Stamp git SHA for Docker build | |
| run: echo "${{ github.sha }}" > .git-commit-sha | |
| - name: Deploy to Railway | |
| run: npx @railway/cli up --service worker | |
| env: | |
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} | |
| # --------------------------------------------------------------------------- | |
| # Deploy Website to Vercel | |
| # --------------------------------------------------------------------------- | |
| deploy-website: | |
| name: Deploy Website | |
| needs: [detect-changes, validate] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.detect-changes.outputs.website == 'true' | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_WEBSITE }} | |
| NODE_OPTIONS: "--max-old-space-size=4096" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Pull Vercel environment | |
| run: bunx vercel env pull .env --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Pull Vercel project config | |
| run: bunx vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build | |
| run: bunx vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy | |
| run: | | |
| bunx vercel deploy --prebuilt --prod --archive=tgz --token=${{ secrets.VERCEL_TOKEN }} > domain.txt | |
| bunx vercel alias --scope=${{ secrets.VERCEL_ORG_ID }} --token=${{ secrets.VERCEL_TOKEN }} set $(cat domain.txt) midday.ai | |
| # --------------------------------------------------------------------------- | |
| # Deploy Jobs to Trigger.dev | |
| # --------------------------------------------------------------------------- | |
| deploy-jobs: | |
| name: Deploy Jobs | |
| needs: [detect-changes, validate] | |
| if: >- | |
| always() && | |
| (needs.validate.result == 'success' || needs.validate.result == 'skipped') && | |
| needs.detect-changes.outputs.jobs == 'true' | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Deploy to Trigger.dev | |
| env: | |
| TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} | |
| run: | | |
| TRIGGER_PROJECT_ID=${{ secrets.TRIGGER_PROJECT_ID }} bunx trigger.dev@4.1.2 deploy | |
| working-directory: packages/jobs |