Test Preview Deployment #225
This file contains 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: Test Preview Deployment | |
on: | |
deployment_status: | |
env: | |
PLAYWRIGHT_VERSION: '' | |
jobs: | |
test-preview-deployment: | |
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- name: Install depenendencies | |
run: bun install | |
- name: Get Playwright Version | |
run: | | |
playwright_version=$(bun pm ls | grep @playwright/test | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') | |
echo "PLAYWRIGHT_VERSION=$playwright_version" >> "$GITHUB_ENV" | |
- name: Cache Playwright Browsers | |
id: cache-playwright-browsers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
- name: Install Playwright Browsers | |
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
run: bunx playwright install --with-deps | |
- name: Run Playwright tests | |
run: bunx playwright test | |
env: | |
BASE_URL: ${{ github.event.deployment_status.environment_url }} | |
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }} | |
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }} | |
E2E_CLERK_USER_USERNAME: ${{ secrets.E2E_CLERK_USER_USERNAME }} | |
E2E_CLERK_USER_PASSWORD: ${{ secrets.E2E_CLERK_USER_PASSWORD }} | |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 3 |