-
Notifications
You must be signed in to change notification settings - Fork 0
619 lines (533 loc) · 19.4 KB
/
02-gh-pages-rebuild-part-1.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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
name: "02-gh-pages-rebuild-part-1" # Note: workflow name is used on workflow 04
on:
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
pages: write
id-token: write
pull-requests: read
jobs:
initialize:
name: Build Basic Site
runs-on: ubuntu-latest
outputs:
pull_requests: ${{ steps.get-prs.outputs.pull_requests }}
steps:
- name: Checkout local code to establish repo
uses: actions/checkout@v4
- name: Get Pull Requests from Github api
id: get-prs
run: |
gh pr list -s open --json url,author,number,title,headRefName
gh pr list -s open --json url,author,number,title,headRefName > prs.json
cat prs.json
pull_requests=`cat prs.json`
echo "pull_requests=${pull_requests}"
echo "pull_requests=${pull_requests}" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
build-javadoc-main:
name: a - Javadoc (main)
runs-on: ubuntu-latest
needs: [initialize]
env:
destination: target/site/apidocs
steps:
- name: Checkout local code to establish repo
uses: actions/checkout@v4
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Build javadoc
run: mvn -DskipTests javadoc:javadoc
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: javadoc
path: ${{ env.destination }}
build-chromatic-main:
name: b - Chromatic (main)
runs-on: ubuntu-latest
needs: [initialize]
env:
destination: frontend/chromatic_static
steps:
- name: Checkout local code to establish repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Chromatic needs the full git history
token: ${{ github.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
run: npm ci
- name: Run Chromatic
id: run_chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: frontend
- name: Echo output
run: |
echo "Chromatic URL: ${{ steps.run_chromatic.outputs.url }}"
echo "Chromatic build ID: ${{ steps.run_chromatic.outputs.storybookUrl }}"
- name: Build redirect file
working-directory: frontend
run: | # Create a redirect file to redirect to the storybook online
mkdir -p chromatic_static
echo "<meta http-equiv=refresh content=0;url=${{steps.run_chromatic.outputs.storybookUrl}}>" > chromatic_static/index.html
echo "<meta http-equiv=refresh content=0;url=${{steps.run_chromatic.outputs.url}}>" > chromatic_static/build.html
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: chromatic
path: ${{ env.destination }}
build-jacoco-main:
name: c - Jacoco (main)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [initialize]
env:
destination: target/site/jacoco
steps:
- uses: actions/checkout@v4
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Build with Maven
continue-on-error: true
env:
TEST_PROPERTIES: ${{ secrets.TEST_PROPERTIES }}
run: mvn -B test jacoco:report verify
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: jacoco
path: ${{ env.destination }}
build-pitest-main:
name: d - Pitest (main)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [initialize]
env:
destination: target/pit-reports
history_destination: target/pit-history
steps:
- uses: actions/checkout@v4
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: create directories
run: |
mkdir -p ${{ env.destination }}
mkdir -p ${{ env.history_destination }}
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: 02-gh-pages-rebuild-part-1.yml
github_token: ${{secrets.GITHUB_TOKEN}}
branch: ${{ env.branch_name }}
name: pitest-main-history.bin
path: ${{ env.history_destination}}
check_artifacts: true
if_no_artifact_found: warn
- name: Copy artifact to pit-history/history.bin # specified in pom.xml as historyInputFile
continue-on-error: true
run: |
historyFile=${{ env.history_destination}}/pitest-main-history.bin
if [ -f "$historyFile" ] ; then
cp $historyFile ${{ env.history_destination}}/history.bin
fi
- name: Build with Maven
continue-on-error: true
env:
TEST_PROPERTIES: ${{ secrets.TEST_PROPERTIES }}
run: mvn test pitest:mutationCoverage -DmutationThreshold=100
- name: Upload Pitest History to Artifacts
if: always() # always upload artifacts, even if tests fail
uses: actions/upload-artifact@v4
with:
name: pitest-main-history.bin
path: ${{ env.history_destination}}/history.bin
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: pitest
path: ${{ env.destination }}
build-coverage-main:
name: e - Coverage (main)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [initialize]
env:
destination: frontend/coverage/lcov-report
steps:
- uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- run: npm ci
working-directory: ./frontend
- run: npm run coverage
continue-on-error: true
working-directory: ./frontend
- name: Upload jest coverage report to Artifacts
if: always() # always upload artifacts, even if tests fail
uses: actions/upload-artifact@v4
with:
name: coverage
path: ${{ env.destination }}
build-stryker-main:
name: f - Stryker (main)
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [initialize]
steps:
- uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: npm clean install, and create directories
working-directory: ./frontend
run: |
npm ci
mkdir -p history
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: 02-gh-pages-rebuild-part-1.yml
github_token: ${{secrets.GITHUB_TOKEN}}
branch: main
name: stryker-incremental-main.json
path: frontend/history
check_artifacts: true
if_no_artifact_found: warn
- name: Stryker (main, incremental)
working-directory: ./frontend
continue-on-error: true
run: |
npx stryker run --incremental --incrementalFile history/stryker-incremental-main.json
- name: Upload stryker incremental file to Artifacts
uses: actions/upload-artifact@v4
with:
name: stryker-incremental-main.json
path: frontend/history
- name: Upload report to Artifacts
if: always() # always upload artifacts, even if tests fail
uses: actions/upload-artifact@v4
with:
name: stryker
path: frontend/reports/mutation/mutation.html
a-build-javadoc-for-each-pr:
name: a - Javadoc (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
needs: [initialize]
env:
destination: target/site/apidocs
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 1
token: ${{ github.token }}
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Build javadoc
run: mvn -DskipTests javadoc:javadoc
- name: Upload javadoc to Artifacts
if: always() # always upload artifacts, even if tests fail
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-javadoc
path: ${{ env.destination }}
b-build-chromatic-for-each-pr:
name: b - Chromatic (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
needs: [initialize]
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- name: Debugging Output
run: |
echo "matrix.value: ${{ matrix.value }}"
echo "matrix.value.url: ${{ matrix.value.url }}"
echo "matrix.value.author: ${{ matrix.value.author }}"
echo "matrix.value.number: ${{ matrix.value.number }}"
echo "matrix.value.title: ${{ matrix.value.title }}"
echo "matrix.value.headRefName: ${{ matrix.value.headRefName }}"
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 0 # Chromatic needs the full git history
token: ${{ github.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Run Chromatic
id: run_chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: frontend
- name: Echo output
run: |
echo "Chromatic URL: ${{ steps.run_chromatic.outputs.url }}"
echo "Chromatic build ID: ${{ steps.run_chromatic.outputs.storybookUrl }}"
- name: Build redirect files
working-directory: frontend
run: | # Create redirect files to redirect to the storybook online
mkdir -p chromatic_static
echo "<meta http-equiv=refresh content=0;url=${{steps.run_chromatic.outputs.storybookUrl}}>" > chromatic_static_${{ matrix.value.number }}/index.html
echo "<meta http-equiv=refresh content=0;url=${{steps.run_chromatic.outputs.url}}>" > chromatic_static_${{ matrix.value.number }}/build.html
- name: Upload Chromatic to artifacts
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-chromatic
path: ${{ env.destination }}
c-build-jacoco-for-each-pr:
name: c - Jacoco (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
needs: [initialize]
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 1
token: ${{ github.token }}
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Build with Maven
continue-on-error: true
env:
TEST_PROPERTIES: ${{ secrets.TEST_PROPERTIES }}
run: mvn -B test jacoco:report verify
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-jacoco
path: target/site/jacoco
d-build-pitest-for-each-pr:
name: d - Pitest (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
needs: [initialize]
env:
destination: target/pit-reports
history_destination: target/pit-history
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 1
token: ${{ github.token }}
- name: create directories
run: |
mkdir -p ${{ env.destination }}
mkdir -p ${{ env.history_destination }}
- name: Figure out branch name
id: get-branch-name
run: |
BRANCH=$(echo "${{ matrix.value.headRefName }}" | sed 's/refs\/heads\///g')
echo "branch_name=${BRANCH}"
echo "branch_name=${BRANCH}" >> "$GITHUB_ENV"
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v4
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: 02-gh-pages-rebuild-part-1.yml
github_token: ${{secrets.GITHUB_TOKEN}}
branch: ${{ env.branch_name }}
name: pitest-${{ matrix.value.number }}-history.bin
path: ${{ env.history_destination}}
check_artifacts: true
if_no_artifact_found: warn
- name: Debugging output before mvn pitest ...
run: |
ls -lRt target
- name: Build with Maven
continue-on-error: true
env:
TEST_PROPERTIES: ${{ secrets.TEST_PROPERTIES }}
run: mvn test pitest:mutationCoverage -DmutationThreshold=100
- name: Debugging output after mvn pitest ...
run: |
ls -lRt target
- name: Upload Pitest History to Artifacts
if: always() # always upload artifacts, even if tests fail
uses: actions/upload-artifact@v4
with:
name: pitest-${{ matrix.value.number }}-history.bin
path: ${{ env.history_destination}}/history.bin
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-pitest
path: ${{ env.destination }}
e-build-coverage-for-each-pr:
name: e - Coverage (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
needs: [initialize]
env:
destination: frontend/coverage/lcov-report
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 1
token: ${{ github.token }}
- name: create directories
run: |
mkdir -p ${{ env.destination }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- run: npm ci
working-directory: ./frontend
- run: npm run coverage
continue-on-error: true
working-directory: ./frontend
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-coverage
path: ${{ env.destination }}
f-build-stryker-for-each-pr:
timeout-minutes: 60
name: f - Stryker (${{ matrix.value.number }}, ${{ matrix.value.headRefName }})
runs-on: ubuntu-latest
if: ${{ needs.initialize.outputs.pull_requests != '[]' && needs.initialize.outputs.pull_requests != '' }}
needs: [initialize]
env:
destination: frontend/reports/mutation
history_destination: frontend/history
strategy:
matrix:
value: ${{ fromJSON(needs.initialize.outputs.pull_requests)}}
steps:
- uses: szenius/set-timezone@v1.2
with:
timezoneLinux: "America/Los_Angeles"
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.value.headRefName }}
fetch-depth: 2
token: ${{ github.token }}
- name: create directories
run: |
mkdir -p ${{ env.destination }}
mkdir -p ${{ env.history_destination}}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- run: npm ci
working-directory: ./frontend
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: 02-gh-pages-rebuild-part-1.yml
github_token: ${{secrets.GITHUB_TOKEN}}
branch: main
name: stryker-incremental-${{ matrix.value.number }}.json
path: ${{ env.history_destination }}
check_artifacts: true
if_no_artifact_found: warn
- name: Stryker (main, incremental)
working-directory: ./frontend
continue-on-error: true
run: |
npx stryker run --incremental --incrementalFile history/stryker-incremental-${{ matrix.value.number }}.json
- name: Upload stryker incremental file to Artifacts
uses: actions/upload-artifact@v4
with:
name: stryker-incremental-${{ matrix.value.number }}.json
path: ${{ env.history_destination }}
- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: prs-${{ matrix.value.number }}-stryker
path: ${{ env.destination }}/mutation.html