Skip to content

refactor: ci

refactor: ci #13

Workflow file for this run

name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
cache-dependency-path: |
client/pnpm-lock.yaml
server/pnpm-lock.yaml
# Next.js Cache
- name: Cache Next.js bundle
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
${{ github.workspace }}/client/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('client/pnpm-lock.yaml') }}-${{ hashFiles('client/src/**/*.{js,jsx,ts,tsx}') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('client/pnpm-lock.yaml') }}-
${{ runner.os }}-nextjs-
# Server caching
- name: Cache server
id: cache-server
uses: actions/cache@v4
with:
path: |
server/dist
server/node_modules
key: ${{ runner.os }}-server-${{ hashFiles('server/pnpm-lock.yaml', 'server/tsconfig.json') }}
restore-keys: |
${{ runner.os }}-server-
# Client dependencies cache
- name: Cache client dependencies
id: cache-client
uses: actions/cache@v4
with:
path: |
client/node_modules
client/.eslintcache
key: ${{ runner.os }}-client-deps-${{ hashFiles('client/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-client-deps-
# Playwright browsers cache
- name: Cache Playwright browsers
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('client/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install and build server
working-directory: ./server
run: |
echo "Installing server dependencies..."
NODE_ENV=development pnpm install
echo "Building server..."
pnpm build
- name: Install client dependencies
working-directory: ./client
run: |
echo "Installing client dependencies..."
NODE_ENV=development pnpm install
- name: Build client
working-directory: ./client
run: NODE_ENV=production pnpm build
- name: Install Playwright browsers
working-directory: ./client
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
working-directory: ./client
run: pnpm exec playwright test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: client/playwright-report/
retention-days: 30
- name: Upload test screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-screenshots
path: client/test-results/
retention-days: 30