-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (150 loc) · 4.54 KB
/
ci.yml
File metadata and controls
159 lines (150 loc) · 4.54 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 22.13.x
jobs:
Lint:
name: Lint-Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
Type-Check:
name: Type-Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
Unit-Tests:
name: Unit-Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm test:unit
E2E-Tests:
name: E2E-Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Install Playwright browsers and dependencies
run: npx playwright install --with-deps chromium
- name: Run Playwright e2e tests
run: pnpm test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
Visual-Regression-Tests:
name: Visual-Regression-Tests
runs-on: ubuntu-latest
env:
PORT: 4321
HOST: 0.0.0.0
BASE_URL: http://127.0.0.1:4321
PUBLIC_GA_MEASUREMENT_ID: ${{ vars.PUBLIC_GA_MEASUREMENT_ID }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Validate PUBLIC_GA_MEASUREMENT_ID
run: |
if [ -z "$PUBLIC_GA_MEASUREMENT_ID" ]; then
echo "Error: PUBLIC_GA_MEASUREMENT_ID is not configured in GitHub repository variables"
echo "Please configure it in: Settings → Secrets and variables → Actions → Variables"
exit 1
fi
echo "PUBLIC_GA_MEASUREMENT_ID is configured"
- name: Build app
run: pnpm build
- name: Start server
run: |
nohup env PORT=$PORT HOST=$HOST pnpm start > server.log 2>&1 &
for i in {1..60}; do
if curl -fsS "$BASE_URL" >/dev/null; then echo "Server is up"; break; fi
sleep 2
done
- name: Build visual test runner image
run: docker compose build
- name: Run visual tests (Docker)
run: pnpm run test:visual
- name: Upload Playwright HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-visual-report
path: playwright-report
- name: Upload Playwright test-results (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: test-results
- name: Show server log
if: always()
run: cat server.log || true
Build:
name: Build-App
runs-on: ubuntu-latest
env:
PUBLIC_GA_MEASUREMENT_ID: ${{ vars.PUBLIC_GA_MEASUREMENT_ID }}
needs:
- Lint
- Type-Check
- Unit-Tests
- E2E-Tests
# - Visual-Regression-Tests
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Validate PUBLIC_GA_MEASUREMENT_ID
run: |
if [ -z "$PUBLIC_GA_MEASUREMENT_ID" ]; then
echo "Error: PUBLIC_GA_MEASUREMENT_ID is not configured in GitHub repository variables"
echo "Please configure it in: Settings → Secrets and variables → Actions → Variables"
exit 1
fi
echo "PUBLIC_GA_MEASUREMENT_ID is configured"
- run: pnpm build