From 7a7f936bd04697ab5bb96df7305b46c7646e9f9c Mon Sep 17 00:00:00 2001 From: PotLid Date: Wed, 19 Aug 2026 00:07:32 -0400 Subject: [PATCH] Add GitHub Actions CI: build + Playwright e2e on every PR into master Runs on pull_request into master and push to master/dev: npm ci, build the library, install Chromium, and run the e2e suite. Needed a .gitignore exception since the existing blanket `.*` rule was silently swallowing .github/. Switched the Playwright reporter to 'github' in CI for inline PR annotations on failures. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ .gitignore | 4 +++- playwright.config.ts | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ee457e9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + pull_request: + branches: [master] + push: + branches: [master, dev] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build library + run: npm run build + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run e2e tests + run: npm run test:e2e + + - name: Upload Playwright report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report/ + retention-days: 7 diff --git a/.gitignore b/.gitignore index b39dbd5..5912978 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,6 @@ Thumbs.db # track these files, if they exist !.gitignore !.editorconfig -!.phpcs.xml.dist \ No newline at end of file +!.phpcs.xml.dist +!.github +!.github/** \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts index 81036b9..d60b4ae 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from '@playwright/test' export default defineConfig({ testDir: './e2e', fullyParallel: true, - reporter: 'list', + reporter: process.env.CI ? 'github' : 'list', use: { baseURL: 'http://localhost:4321', },