-
Notifications
You must be signed in to change notification settings - Fork 1
560 lines (500 loc) · 16.9 KB
/
publish.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
name: Publish
on:
workflow_call:
jobs:
publish-dockerfile:
name: Publish Test Results (Dockerfile)
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Dockerfile)
files: "artifacts/**/*.xml"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-docker-image:
name: Publish Test Results (Docker Image ${{ matrix.arch }})
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
security-events: write
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: ${{ matrix.arch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
with:
load: true
push: false
platforms: linux/${{ matrix.arch }}
tags: step-security/publish-unit-test-result-action:latest
outputs: type=docker
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
if: always()
env:
INPUT_GITHUB_TOKEN: ${{ github.token }}
INPUT_CHECK_NAME: Test Results (Docker Image ${{ matrix.arch }})
INPUT_FILES: "artifacts/**/*.xml"
INPUT_JSON_FILE: "tests.json"
INPUT_JSON_SUITE_DETAILS: true
INPUT_JSON_TEST_CASE_RESULTS: true
INPUT_REPORT_SUITE_LOGS: "any"
run: |
docker run --platform linux/${{ matrix.arch }} \
--workdir $GITHUB_WORKSPACE \
--rm \
-e "INPUT_CHECK_NAME" \
-e "INPUT_JSON_FILE" \
-e "INPUT_JSON_SUITE_DETAILS" \
-e "INPUT_JSON_TEST_CASE_RESULTS" \
-e "INPUT_LOG_LEVEL" \
-e "INPUT_ROOT_LOG_LEVEL" \
-e "INPUT_GITHUB_TOKEN" \
-e "INPUT_GITHUB_TOKEN_ACTOR" \
-e "INPUT_GITHUB_RETRIES" \
-e "INPUT_COMMIT" \
-e "INPUT_COMMENT_TITLE" \
-e "INPUT_COMMENT_MODE" \
-e "INPUT_FAIL_ON" \
-e "INPUT_ACTION_FAIL" \
-e "INPUT_ACTION_FAIL_ON_INCONCLUSIVE" \
-e "INPUT_FILES" \
-e "INPUT_JUNIT_FILES" \
-e "INPUT_NUNIT_FILES" \
-e "INPUT_XUNIT_FILES" \
-e "INPUT_TRX_FILES" \
-e "INPUT_TIME_UNIT" \
-e "INPUT_TEST_FILE_PREFIX" \
-e "INPUT_REPORT_INDIVIDUAL_RUNS" \
-e "INPUT_REPORT_SUITE_LOGS" \
-e "INPUT_DEDUPLICATE_CLASSES_BY_FILE_NAME" \
-e "INPUT_LARGE_FILES" \
-e "INPUT_IGNORE_RUNS" \
-e "INPUT_CHECK_RUN" \
-e "INPUT_JOB_SUMMARY" \
-e "INPUT_COMPARE_TO_EARLIER_COMMIT" \
-e "INPUT_PULL_REQUEST_BUILD" \
-e "INPUT_EVENT_FILE" \
-e "INPUT_EVENT_NAME" \
-e "INPUT_TEST_CHANGES_LIMIT" \
-e "INPUT_CHECK_RUN_ANNOTATIONS" \
-e "INPUT_CHECK_RUN_ANNOTATIONS_BRANCH" \
-e "INPUT_SECONDS_BETWEEN_GITHUB_READS" \
-e "INPUT_SECONDS_BETWEEN_GITHUB_WRITES" \
-e "INPUT_SECONDARY_RATE_LIMIT_WAIT_SECONDS" \
-e "INPUT_JSON_THOUSANDS_SEPARATOR" \
-e "INPUT_SEARCH_PULL_REQUESTS" \
-e "HOME" \
-e "GITHUB_JOB" \
-e "GITHUB_REF" \
-e "GITHUB_SHA" \
-e "GITHUB_REPOSITORY" \
-e "GITHUB_REPOSITORY_OWNER" \
-e "GITHUB_RUN_ID" \
-e "GITHUB_RUN_NUMBER" \
-e "GITHUB_RETENTION_DAYS" \
-e "GITHUB_RUN_ATTEMPT" \
-e "GITHUB_ACTOR" \
-e "GITHUB_TRIGGERING_ACTOR" \
-e "GITHUB_WORKFLOW" \
-e "GITHUB_HEAD_REF" \
-e "GITHUB_BASE_REF" \
-e "GITHUB_EVENT_NAME" \
-e "GITHUB_SERVER_URL" \
-e "GITHUB_API_URL" \
-e "GITHUB_GRAPHQL_URL" \
-e "GITHUB_REF_NAME" \
-e "GITHUB_REF_PROTECTED" \
-e "GITHUB_REF_TYPE" \
-e "GITHUB_WORKSPACE" \
-e "GITHUB_ACTION" \
-e "GITHUB_EVENT_PATH" \
-e "GITHUB_ACTION_REPOSITORY" \
-e "GITHUB_ACTION_REF" \
-e "GITHUB_PATH" \
-e "GITHUB_ENV" \
-e "GITHUB_STEP_SUMMARY" \
-e "GITHUB_STATE" \
-e "GITHUB_OUTPUT" \
-e "RUNNER_OS" \
-e "RUNNER_ARCH" \
-e "RUNNER_NAME" \
-e "RUNNER_TOOL_CACHE" \
-e "RUNNER_TEMP" \
-e "RUNNER_WORKSPACE" \
-e "ACTIONS_RUNTIME_URL" \
-e "ACTIONS_RUNTIME_TOKEN" \
-e "ACTIONS_CACHE_URL" \
-e GITHUB_ACTIONS=true \
-e CI=true \
-v "$RUNNER_TEMP":"$RUNNER_TEMP" \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/home/runner/work/_temp/_github_home":"/github/home" \
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" \
-v "/home/runner/work/publish-unit-test-result-action/publish-unit-test-result-action":"$GITHUB_WORKSPACE" \
step-security/publish-unit-test-result-action:latest
shell: bash
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
- name: Scan for vulnerabilities
id: scan
uses: crazy-max/ghaction-container-scan@v2
with:
image: step-security/publish-unit-test-result-action:latest
dockerfile: ./Dockerfile
annotations: true
- name: Upload SARIF artifact
uses: actions/upload-artifact@v4
with:
name: SARIF
path: ${{ steps.scan.outputs.sarif }}
- name: Upload SARIF file
if: always() && steps.scan.outputs.sarif != ''
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
publish-composite:
name: Publish Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
max-parallel: 2
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
include:
- os: ubuntu-latest
os-label: Linux
python: "3.8"
- os: ubuntu-latest
os-label: Linux
python: "venv"
- os: ubuntu-latest
os-label: Linux
python: "installed"
- os: ubuntu-20.04
os-label: Linux 20.04
python: "installed"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
if: matrix.python != 'installed' && matrix.python != 'venv'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install virtualenv
if: matrix.python == 'venv'
run: python3 -m pip install virtualenv
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
uses: ./linux
with:
check_name: Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
files: artifacts/**/*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-macos:
name: Publish Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
max-parallel: 2
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
include:
- os: macos-latest
os-label: macOS
python: "3.8"
- os: macos-latest
os-label: macOS
python: "venv"
- os: macos-latest
os-label: macOS
python: "installed"
- os: macos-11
os-label: macOS 11
python: "installed"
- os: macos-13
os-label: macOS 13
python: "installed"
- os: macos-14
os-label: macOS 14
python: "installed"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
if: matrix.python != 'installed' && matrix.python != 'venv'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install virtualenv
if: matrix.python == 'venv'
run: python3 -m pip install virtualenv
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
uses: ./macos
with:
check_name: Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
files: artifacts/**/*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-windows:
name: Publish Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
max-parallel: 2
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
include:
- os: windows-latest
os-label: Windows
python: "installed"
- os: windows-latest
os-label: Windows
python: "venv"
- os: windows-2019
os-label: Windows 2019
python: "installed"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
if: matrix.python != 'installed' && matrix.python != 'venv'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install virtualenv
if: matrix.python == 'venv'
run: python3 -m pip install virtualenv
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
uses: ./windows
with:
check_name: Test Results (${{ matrix.os-label }} python ${{ matrix.python }})
files: artifacts\**\*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
- name: Publish Test Results (Bash)
id: test-results-bash
if: always() && steps.test-results.outcome != 'skipped'
uses: ./windows/bash
with:
check_name: Test Results (${{ matrix.os-label }} bash python ${{ matrix.python }})
files: artifacts\**\*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output (Bash)
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results-bash.outputs.json }}'
json_file: 'tests.json'
publish-composite:
name: Publish Test Results (${{ matrix.os-label }} composite)
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
max-parallel: 1
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# test *-latest and newer (because newer eventually become 'latest' and should be tested to work before that)
include:
- os: macos-latest
os-label: macOS
- os: ubuntu-latest
os-label: Linux
- os: windows-latest
os-label: Windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
id: test-results
uses: ./composite
with:
check_name: Test Results (${{ matrix.os-label }} composite python ${{ matrix.python }})
files: |
artifacts/**/*.xml
artifacts\**\*.xml
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-test-files:
name: Publish Test Files
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy test result files
run: cp -rv python/test/files test-files
shell: bash
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Test Files)
fail_on: nothing
files: |
test-files/**/*.xml
test-files/**/*.trx
test-files/**/*.json
junit_files: "test-files/junit-xml/**/*.xml"
nunit_files: "test-files/nunit/**/*.xml"
xunit_files: "test-files/xunit/**/*.xml"
trx_files: "test-files/trx/**/*.trx"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'
publish-test-file:
name: Publish Test File
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy test junit xml files
run: cp -rv python/test/files/junit-xml test-files
shell: bash
- name: Prepare publish action from this branch
run: |
sed --in-place "s/image: .*/image: 'Dockerfile'/" action.yml
shell: bash
- name: Publish Test Results
id: test-results
uses: ./
with:
check_name: Test Results (Test File)
fail_on: nothing
files: "test-files/pytest/junit.gloo.standalone.xml"
json_file: "tests.json"
json_suite_details: true
json_test_case_results: true
report_suite_logs: "any"
log_level: DEBUG
- name: JSON output
uses: ./misc/action/json-output
with:
json: '${{ steps.test-results.outputs.json }}'
json_file: 'tests.json'