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', },