Skip to content

Instantly share code, notes, and snippets.

@graffhyrum
Created July 10, 2024 21:55
Show Gist options
  • Save graffhyrum/cd58ceadf6d4bceaa4e7226f07680aa7 to your computer and use it in GitHub Desktop.
Save graffhyrum/cd58ceadf6d4bceaa4e7226f07680aa7 to your computer and use it in GitHub Desktop.
A good github action template for running playwright tests using Bun
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: '16.x'
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: bun install --frozen-lockfile
- run: bunx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: bunx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Run Playwright tests
run: bunx playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results
path: test-results/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment