-
-
Notifications
You must be signed in to change notification settings - Fork 7
executable file
·351 lines (342 loc) · 11.8 KB
/
publish-release.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
name: 'Release'
on:
workflow_dispatch:
permissions:
contents: read
jobs:
unit_tests_linux:
name: Verify Tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable
- name: Install deps
run: yarn
- name: Run all unit tests
run: yarn nx run-many --target=test/unit/ci --parallel --verbose --projects=tag:linux
- uses: codecov/codecov-action@v4
if: always()
with:
files: '**/.test-runs/unit/lcov.info'
flags: unit-tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
component_tests_linux:
name: Verify PR - Component Tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Run all component tests
run: yarn nx run-many --target=test/components/ci --parallel --verbose --projects=tag:linux
- name: Upload test video artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: component-cypress-videos
path: apps/playnite-web/cypress/videos
- name: Upload test screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: component-cypress-videos
path: apps/playnite-web/cypress/screenshots
- uses: codecov/codecov-action@v4
if: always()
with:
files: '**/.test-runs/component/lcov.info'
flags: component-tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
visual_component_tests_linux:
name: Verify PR - Component Visual Regression Tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Run all visual regression tests
run: yarn nx affected --base=origin/main --head=HEAD --target=test/components/visual/ci --verbose --exclude='*,!tag:linux'
- name: Upload visual regression artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: visual-regression-comparisons
path: apps/playnite-web/visual-regression-tests/screenshots
- name: Upload test video artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: visual-regression-cypress-videos
path: apps/playnite-web/cypress/videos
- name: Upload test screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: visual-regression-cypress-screenshots
path: apps/playnite-web/cypress/screenshots
e2e_tests_linux:
name: Verify PR - e2e Tests (Linux)
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
OWNER: andrew-codes
PUBLISH: 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY}}
username: ${{ env.OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run Version
run: yarn nx run-many --target=version --exclude='*,!tag:linux'
env:
NODE_ENV: production
- name: Package projects
run: yarn nx run-many --target=package --parallel --verbose --exclude '*,!tag:linux'
env:
NODE_ENV: production
DEBUG: 'playnite-web/*'
PLATFORM: linux/amd64,linux/arm64
- name: Run all e2e tests
run: yarn nx run-many --target=test/e2e/ci --verbose --projects=tag:linux
env:
NODE_ENV: production
DEBUG: 'playnite-web/*'
PLATFORM: linux/amd64,linux/arm64
- name: Upload visual regression artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: visual-regression-e2e-comparisons
path: apps/playnite-web/visual-regression-tests/screenshots
- name: Upload test video artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: e2e-cypress-videos
path: apps/playnite-web/cypress/videos
- name: Upload test screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: e2e-cypress-screenshots
path: apps/playnite-web/cypress/screenshots
unit_tests_windows:
name: Verify PR - Tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read Node version
run: echo "value=$(./jq.exe -r .engines.node package.json | sed -e 's/>=//g' | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: node_version
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Read Yarn version
run: echo "value=$(./jq.exe -r .engines.yarn package.json | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: yarn_version
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows
package_windows:
name: Package Windows projects
runs-on: windows-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download Playnite Toolbox
run: |-
mkdir -p .tools/Playnite && curl "${{ secrets.PLAYNITE_TOOLBOX_URL }}" -o Playnite.zip && unzip Playnite.zip -d .tools/Playnite
- name: Install jq
run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- name: Read Node version
run: echo "value=$(./jq.exe -r .engines.node package.json | sed -e 's/>=//g' | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: node_version
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Read Yarn version
run: echo "value=$(./jq.exe -r .engines.yarn package.json | sed -e 's/"//g')" >> $GITHUB_OUTPUT
shell: bash
id: yarn_version
- name: Enable yarn
run: corepack enable
- run: corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Get next version
run: echo "value=$(yarn node nextVersion.js)" >> $GITHUB_OUTPUT
shell: bash
id: nextVersion
- name: Run Version
run: yarn nx run-many --target=version --exclude='*,!tag:windows'
env:
NODE_ENV: production
VERSION: '${{ steps.nextVersion.outputs.value }}'
- name: Package projects
run: yarn nx run-many --target=package --exclude='*,!tag:windows'
env:
NODE_ENV: production
VERSION: '${{ steps.nextVersion.outputs.value }}'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-web-extension
path: apps/*/_packaged/**
publish_release:
name: Publish release
needs:
- unit_tests_linux
- unit_tests_windows
- component_tests_linux
- visual_component_tests_linux
- e2e_tests_linux
- package_windows
env:
REGISTRY: ghcr.io
OWNER: andrew-codes
PUBLISH: 'true'
permissions:
packages: write
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download plugin artifact
uses: actions/download-artifact@v4
with:
path: _packaged
name: playnite-web-extension
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: node_version
with:
cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Extract node version from package.json
uses: sergeysova/jq-action@v2
id: yarn_version
with:
cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' | sed -e 's/>=//g'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ steps.node_version.outputs.value }}'
- name: Use Yarn
run: corepack enable
- run: corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: '0'
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY}}
username: ${{ env.OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Semantic Release
run: yarn dlx semantic-release
env:
NODE_ENV: production
DEBUG: 'playnite-web/*'
PLATFORM: linux/amd64,linux/arm64
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCLUDE: '*,!tag:linux'
INCLUDE_GH_RELEASE: 'true'