name: Smoke Tests (Post-Deploy) on: workflow_dispatch: inputs: environment: description: 'Target environment' required: true default: 'staging' type: choice options: - staging - production api_url: description: 'API base URL (overrides default for env)' required: false type: string web_url: description: 'Web base URL (overrides default for env)' required: false type: string workflow_call: inputs: environment: required: false type: string default: 'staging' api_url: required: false type: string web_url: required: false type: string concurrency: group: smoke-${{ inputs.environment || 'staging' }}-${{ github.ref }} cancel-in-progress: true jobs: smoke: name: Smoke — ${{ inputs.environment || 'staging' }} runs-on: ubuntu-latest timeout-minutes: 10 env: API_BASE_URL: ${{ inputs.api_url || (inputs.environment == 'production' && vars.PROD_API_URL) || vars.STAGING_API_URL || 'http://localhost:3001/api/v1/' }} WEB_BASE_URL: ${{ inputs.web_url || (inputs.environment == 'production' && vars.PROD_WEB_URL) || vars.STAGING_WEB_URL || 'http://localhost:3000' }} CI: true steps: - name: Checkout uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Cache Playwright browsers id: playwright-cache uses: actions/cache@v4 with: path: ~/.cache/ms-playwright key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Install Playwright browsers if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps chromium - name: Install Playwright system deps if: steps.playwright-cache.outputs.cache-hit == 'true' run: npx playwright install-deps chromium - name: Run smoke tests (API) run: npx playwright test --project=smoke-api env: API_BASE_URL: ${{ env.API_BASE_URL }} - name: Run smoke tests (Web) run: npx playwright test --project=smoke-web env: WEB_BASE_URL: ${{ env.WEB_BASE_URL }} API_BASE_URL: ${{ env.API_BASE_URL }} - name: Upload smoke report if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: name: smoke-report-${{ inputs.environment || 'staging' }}-${{ github.run_id }} path: playwright-report/ retention-days: 7 - name: Notify failure if: failure() run: | echo "::error::Smoke tests FAILED on ${{ inputs.environment || 'staging' }}. Check the uploaded playwright-report artifact for details."