42 e2e testing with playwright #92
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
name: 'Build 🧱' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@master | |
- name: Setup 👨🏻💻 | |
uses: ./.github/actions/setup | |
with: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Build Application 🧱 | |
run: bun run build | |
env: | |
DATABASE_URL: url | |
AUTH_DISCORD_ID: secret | |
AUTH_DISCORD_SECRET: secret | |
AUTH_GITHUB_ID: secret | |
AUTH_GITHUB_SECRET: secret | |
AUTH_SECRET: secret | |
- name: Upload production artifact 📤 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./.next | |
lint: | |
name: 'Lint 🐱' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@master | |
- name: Setup 👨🏻💻 | |
uses: ./.github/actions/setup | |
with: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Lint JS files 🐱 | |
run: bun run lint | |
env: | |
DATABASE_URL: url | |
AUTH_DISCORD_ID: secret | |
AUTH_DISCORD_SECRET: secret | |
AUTH_GITHUB_ID: secret | |
AUTH_GITHUB_SECRET: secret | |
AUTH_SECRET: secret | |
test: | |
name: 'Unit Tests 🧪' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@master | |
- name: Setup 👨🏻💻 | |
uses: ./.github/actions/setup | |
with: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Run unit tests 🧪 | |
run: bun run test:coverage | |
- name: Collect coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
e2e: | |
name: 'E2E Tests 🧪' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@master | |
- name: Setup 👨🏻💻 | |
uses: ./.github/actions/setup | |
with: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Download production artifact 📤 | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./.next | |
- name: log dist | |
run: ls | |
- name: Run e2e tests 🧪 | |
run: npx playwright test | |
env: | |
DATABASE_URL: url | |
AUTH_DISCORD_ID: secret | |
AUTH_DISCORD_SECRET: secret | |
AUTH_GITHUB_ID: secret | |
AUTH_GITHUB_SECRET: secret | |
AUTH_SECRET: secret | |
E2E_ACCOUNT_EMAIL: ${{ secrets.E2E_ACCOUNT_EMAIL }} | |
E2E_ACCOUNT_PASSWORD: ${{ secrets.E2E_ACCOUNT_PASSWORD }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |