-
Notifications
You must be signed in to change notification settings - Fork 3
194 lines (161 loc) · 4.99 KB
/
lint-and-test.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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Lint and test
on:
pull_request:
push:
branches:
- main
- release-bot/**
workflow_dispatch:
jobs:
lint-code:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Lint
run: npm run lint
- name: Check formatting
run: npm run format:check
build-package:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Build package
run: npm run dist:build
lint-commit-messages:
name: Lint commit messages
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Git clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Lint commit messages
run: |
npm exec --no -- commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
test-unit:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Run unit tests
run: npm run test
determine-playwright-image:
name: Determine Playwright container image
runs-on: ubuntu-latest
outputs:
container-image: mcr.microsoft.com/playwright:${{ steps.read-version.outputs.version }}-jammy
steps:
- name: Git clone repository
uses: actions/checkout@v4
- id: read-version
name: Read Playwright version
run: |
echo "version=$(scripts/get-playwright-version.sh)" >> "$GITHUB_OUTPUT"
test-e2e:
name: Run e2e tests (${{ matrix.shard }}/${{ matrix.total_shards }})
runs-on: ubuntu-latest
needs:
- determine-playwright-image
container:
image: ${{ needs.determine-playwright-image.outputs.container-image }}
options: --user 1001
strategy:
matrix:
shard: [1, 2, 3, 4]
total_shards: [4]
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Run e2e tests
run: npm run test:e2e -- --shard ${{ matrix.shard }}/${{ matrix.total_shards }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-blob-reports
path: blob-report
retention-days: 1
merge-e2e-reports:
name: Merge e2e test reports
runs-on: ubuntu-latest
if: always()
needs:
- determine-playwright-image
- test-e2e
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Merge reports
uses: ./.github/actions/merge-playwright-reports
with:
input-artifact: e2e-blob-reports
output-artifact: e2e-html-report
test-visual-regression:
name: Run visual regression tests (${{ matrix.shard }}/${{ matrix.total_shards }})
runs-on: ubuntu-latest
needs:
- determine-playwright-image
container:
image: ${{ needs.determine-playwright-image.outputs.container-image }}
options: --user 1001
strategy:
matrix:
shard: [1, 2]
total_shards: [2]
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Run visual regression tests
run: npm run test:visual:native -- --shard ${{ matrix.shard }}/${{ matrix.total_shards }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: visual-regression-blob-reports
path: blob-report
retention-days: 1
merge-visual-regression-reports:
name: Merge visual regression reports
runs-on: ubuntu-latest
if: always()
needs:
- determine-playwright-image
- test-visual-regression
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Merge reports
uses: ./.github/actions/merge-playwright-reports
with:
input-artifact: visual-regression-blob-reports
output-artifact: visual-regression-html-report
audit-dependencies:
name: Audit dependencies
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/prepare-environment
- name: Run audit
run: npm audit