-
-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (112 loc) · 3.68 KB
/
playwright.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: 🎭 Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
name: 🧪 Run E2E Tests
timeout-minutes: 60
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: 📥 Checkout code
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 build
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 and build client
working-directory: ./client
run: |
echo "📦 Installing client dependencies..."
NODE_ENV=development pnpm install
echo "🔨 Running type check and linting..."
pnpm lint:check
echo "🔨 Building client..."
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
env:
# These variables are needed for tests
PLAYWRIGHT_HTML_REPORT: playwright-report
PLAYWRIGHT_JUNIT_OUTPUT_NAME: results.xml
run: pnpm test:e2e
- name: 📊 Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
client/playwright-report/
client/test-results.xml
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