Skip to content

ci: run Playwright tests on pull requests only #51

ci: run Playwright tests on pull requests only

ci: run Playwright tests on pull requests only #51

Workflow file for this run

name: CI & Preview
on:
push:
branches-ignore: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npx tsc --noEmit
- name: Validate skills
run: npx skills add . -y && rm -rf .agents .claude/skills skills-lock.json
- name: Build
run: npm run build
env:
NODE_OPTIONS: "--max_old_space_size=4096"
test-scripts:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run present tests (Linux/macOS)
if: runner.os != 'Windows'
run: bash tests/test-present.sh
- name: Run present tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: ./tests/test-present.ps1
playwright:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npx playwright test
- name: Upload test report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 14
preview:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build for preview
run: |
BRANCH_NAME=${GITHUB_REF_NAME}
npm run build -- --base=/super-json/preview/${BRANCH_NAME}/
env:
NODE_OPTIONS: "--max_old_space_size=4096"
- name: Deploy preview to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: preview/${{ github.ref_name }}
keep_files: true