Skip to content

Fixup

Fixup #109

Workflow file for this run

name: Playwright tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: ${{ matrix.browser }}
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/cache@v3
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- uses: actions/setup-node@v3
with:
node-version: '16.x' # Same as in package.json
- name: Use .env.development
run: |
# NB: copying instead of symlinking due to https://github.com/vercel/next.js/issues/53086
cp .env.development .env
# Kill .env.production because the server likes grabbing it when using 'npm next build'
rm .env.production
- name: Run databases
run: |
# Doesn't wait for startup but should be fine hopefully
docker-compose up -d
- name: Install dependencies
run: npm ci
- name: Create DB tables
run: npx prisma db push
# Note: we always install Chromium because we use it in playwright-setup.ts, but ideally it should be fixed
- name: Install Playwright
run: npx playwright install --with-deps ${{ matrix.browser }} chromium
- name: Build the app
run: npm run build
# Note: Playwright will start the server by itself, see playwright.config.ts
- name: Run Playwright tests
run: npx playwright test --browser ${{ matrix.browser }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results-${{ matrix.browser }}
path: test-results/
retention-days: 30