Skip to content

Setup Smoke

Setup Smoke #1668

Workflow file for this run

name: Setup Smoke
on:
schedule:
- cron: '17 * * * *'
workflow_dispatch:
pull_request:
branches: [main]
paths:
- '.env.local.example'
- 'apps/web/.env'
- 'apps/web/.env.development.local.example'
- 'dev/local/setup-env.ts'
- 'dev/local/env-sync/**'
- 'scripts/dev.sh'
- '.github/workflows/setup-smoke.yml'
permissions:
contents: read
issues: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup-smoke:
runs-on: ${{ vars.RUNNER_LARGE_LABEL || 'ubuntu-24.04-8core' }}
timeout-minutes: 45
env:
NODE_ENV: development
DEBUG_SHOW_DEV_UI: 'true'
PORT: '3000'
NEXTAUTH_URL: http://localhost:3000
POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres
POSTGRES_CONNECT_TIMEOUT: '30000'
POSTGRES_MAX_QUERY_TIME: '30000'
SKIP_STRIPE_API: 'true'
NEXT_PUBLIC_POSTHOG_KEY: fake-token
PLAYWRIGHT_BASE_URL: http://localhost:3000
steps:
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1
with:
lfs: true
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.1.2 --activate
- name: Expose pnpm to tmux shells
run: |
printf '#!/usr/bin/env bash\nexport PATH="%s"\nexec "%s/pnpm" "$@"\n' "$PATH" "$PNPM_HOME" | sudo tee /usr/local/bin/pnpm >/dev/null
sudo chmod +x /usr/local/bin/pnpm
- name: Install tmux
run: |
sudo apt-get update
sudo apt-get install -y tmux
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate local environment
run: pnpm dev:setup-env --ci
- name: Sync local service environment
run: pnpm dev:env -y
- name: Start local infrastructure
run: docker compose -f dev/docker-compose.yml up -d --wait
- name: Verify migrations bootstrap cleanly
run: pnpm drizzle:verify-bootstrap
- name: Run database migrations
run: pnpm drizzle migrate
- name: Install Playwright browsers
run: pnpm --filter web exec playwright install --with-deps chromium
- name: Start dev stack
run: pnpm dev:start --no-attach
- name: Wait for web app
run: |
for _ in {1..60}; do
if curl -fsSL http://localhost:3000/users/sign_in >/dev/null; then
exit 0
fi
pnpm dev:status
sleep 5
done
echo "Web app did not become ready in time"
exit 1
- name: Run setup smoke tests
run: pnpm test:setup-smoke
- name: Summarize setup smoke tests
if: always()
run: |
report='apps/web/test-results/setup-smoke-results.json'
echo '## Setup smoke test results' >> "$GITHUB_STEP_SUMMARY"
echo >> "$GITHUB_STEP_SUMMARY"
if [[ ! -f "$report" ]]; then
echo 'Playwright did not produce a JSON report.' >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
clean=$(jq -r '.stats.expected // 0' "$report")
flaky=$(jq -r '.stats.flaky // 0' "$report")
failed=$(jq -r '.stats.unexpected // 0' "$report")
skipped=$(jq -r '.stats.skipped // 0' "$report")
{
echo '| Outcome | Tests |'
echo '|---|---:|'
echo "| Passed without retries | $clean |"
echo "| Passed after retry | $flaky |"
echo "| Failed | $failed |"
echo "| Skipped | $skipped |"
} >> "$GITHUB_STEP_SUMMARY"
if (( flaky > 0 )); then
echo "::warning::$flaky setup smoke test(s) passed only after retry"
fi
- name: Stop dev stack
if: always()
run: pnpm dev:stop --force
- name: Upload setup smoke artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: setup-smoke-artifacts
path: |
apps/web/playwright-report
apps/web/test-results
dev/logs
retention-days: 7
- name: Notify setup smoke failure
if: failure() && github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
ISSUE_NUMBER: '3791'
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
cat > /tmp/setup-smoke-failure.md <<EOF
@RSO Setup Smoke failed.
Run: ${RUN_URL}
Ref: ${GITHUB_REF_NAME}
SHA: ${GITHUB_SHA}
Trigger: ${GITHUB_EVENT_NAME}
EOF
gh issue comment "$ISSUE_NUMBER" --body-file /tmp/setup-smoke-failure.md