Infrastructure/migrate to astro db from suprabase and upstash #53
Workflow file for this run
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
| # Runs lint, unit tests, and E2E suites to gate deployments | |
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| env: | |
| CONVERTKIT_API_KEY: ${{ secrets.CONVERTKIT_API_KEY }} | |
| CONVERTKIT_FORM_ID: ${{ secrets.CONVERTKIT_FORM_ID }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| WEBMENTION_IO_TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }} | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| if: ${{ !startsWith(github.head_ref || github.ref_name, 'hotfix/') }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: Sync Astro types | |
| run: npm run sync | |
| - name: Run Astro check | |
| run: npm run check | |
| - name: Run lint | |
| run: npm run lint:base | |
| - name: Run Actions lint | |
| run: npm run lint:actions | |
| unit-test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| if: ${{ !startsWith(github.head_ref || github.ref_name, 'hotfix/') }} | |
| permissions: | |
| actions: write | |
| checks: write | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| # Astro build runs sync, check, and integrations including verify links | |
| - name: Verify green build (local DB snapshot) | |
| run: npm run build:ci | |
| - name: Run unit tests (Vitest — coverage with GitHub Actions reporter) | |
| id: vitest | |
| run: npm run test:coverage | |
| - name: Report Coverage | |
| if: steps.vitest.outcome == 'success' && hashFiles('coverage/coverage-summary.json') != '' | |
| uses: davelosert/vitest-coverage-report-action@v2.9.0 | |
| with: | |
| json-summary-path: './coverage/coverage-summary.json' | |
| json-final-path: './coverage/coverage-final.json' | |
| - name: Upload test coverage | |
| if: always() && hashFiles('coverage/coverage-summary.json') != '' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: test-coverage | |
| path: coverage/ | |
| retention-days: 30 | |
| e2e-test: | |
| name: E2E Tests | |
| runs-on: ubuntu-latest | |
| needs: unit-test | |
| # Temporarily disabled until the simplified flow is battle-tested | |
| if: ${{ false && !startsWith(github.head_ref || github.ref_name, 'hotfix/') }} | |
| permissions: | |
| actions: write | |
| contents: read | |
| env: | |
| CONVERTKIT_API_KEY: ${{ secrets.CONVERTKIT_API_KEY }} | |
| CONVERTKIT_FORM_ID: ${{ secrets.CONVERTKIT_FORM_ID }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| WEBMENTION_IO_TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Start Astro dev server | |
| run: | | |
| npm run dev -- --host 0.0.0.0 > /tmp/astro-dev.log 2>&1 & | |
| echo $! > /tmp/astro-dev.pid | |
| - name: Wait for dev server | |
| run: | | |
| for attempt in $(seq 1 60); do | |
| if curl -fsS http://127.0.0.1:4321 >/dev/null; then | |
| echo "✅ Dev server is responding" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "❌ Dev server failed to start" >&2 | |
| if [ -f /tmp/astro-dev.log ]; then | |
| echo '--- Astro dev server log ---' | |
| cat /tmp/astro-dev.log | |
| fi | |
| exit 1 | |
| - name: Run Playwright E2E tests | |
| run: npm run test:e2e | |
| env: | |
| CI: '1' | |
| - name: Stop Astro dev server | |
| if: always() | |
| run: | | |
| if [ -f /tmp/astro-dev.pid ]; then | |
| kill $(cat /tmp/astro-dev.pid) || true | |
| rm /tmp/astro-dev.pid | |
| fi | |
| - name: Upload Playwright report | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| hotfix-bypass: | |
| name: Hotfix Bypass Notice | |
| runs-on: ubuntu-latest | |
| if: ${{ startsWith(github.head_ref || github.ref_name, 'hotfix/') }} | |
| steps: | |
| - name: Skip testing for hotfix branch | |
| run: echo "hotfix/* branch detected; skipping lint, unit, and e2e workflows but allowing deployments." |