-
-
Notifications
You must be signed in to change notification settings - Fork 175
/
action.yml
178 lines (171 loc) · 8.6 KB
/
action.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
name: 'Publish Unit Test Results'
author: 'EnricoMi'
description: 'A GitHub Action that publishes test results on GitHub'
inputs:
github_token:
description: 'GitHub API Access Token'
default: ${{ github.token }}
required: false
github_retries:
description: 'Requests to the GitHub API are retried this number of times. The value must be a positive integer or zero.'
default: '10'
required: false
commit:
description: 'Commit SHA to which test results are published. Only needed if the value of GITHUB_SHA does not work for you.'
required: false
check_name:
description: 'Name of the created check run'
required: false
default: 'Unit Test Results'
comment_title:
description: 'Title of PR comments, defaults to value of check_name input'
required: false
fail_on:
description: 'The created test result check run has failure state if any test fails or test errors occur. Never fails when set to "nothing", fails only on errors when set to "errors". Default is "test failures".'
required: false
default: 'test failures'
junit_files:
description: 'File patterns of JUnit XML test result files. Supports *, **, ?, and []. Use multiline string for multiple patterns. Patterns starting with ! exclude the matching files. There have to be at least one pattern starting without a `!`.'
required: false
time_unit:
description: 'Time values in the XML files have this unit. Supports "seconds" and "milliseconds".'
default: 'seconds'
required: false
report_individual_runs:
description: 'Individual runs of the same test may see different failures. Reports all individual failures when set "true" or the first only otherwise'
required: false
deduplicate_classes_by_file_name:
description: 'De-duplicates classes with same name by their file name when set "true", combines test results for those classes otherwise'
required: false
ignore_runs:
description: 'Does not process test run information by ignoring <testcase> elements in the XML files, which is useful for very large XML files. This disables any check run annotations'
default: 'false'
required: false
hide_comments:
description: 'Configures which earlier comments of the action to hide: off - no comments, orphaned commits - comments for commits that are removed from the branch, all but latest - all comments but the latest'
required: false
default: 'all but latest'
comment_on_pr:
description: 'Deprecated, please use comment_mode instead!'
required: false
comment_mode:
description: 'Control PR comments: off - disable PR comments, create new - create comments on PRs, each time a new one, update last - create comment on PR, reuse an existing one'
required: false
default: 'update last'
job_summary:
description: 'Set to "true", the results are published as part of the job summary page of the workflow run'
required: false
default: 'true'
compare_to_earlier_commit:
description: 'Test results are compared to results of earlier commits to highlight changes: "false" - disable comparison, "true" - compare across commits'
required: false
default: 'true'
pull_request_build:
description: 'Pull request events build a merge of the branch and the target branch, not just the commit that has been pushed. When your workflow deviates from this behaviour and builds the actual commit, then set this option to "commit". Defaults to "merge".'
required: false
default: 'merge'
event_file:
description: 'An alternative event file to use. Useful to replace a "workflow_run" event file with the actual source event file.'
required: false
event_name:
description: 'An alternative event name to use. Useful to replace a "workflow_run" event name with the actual source event name: github.event.workflow_run.event.'
required: false
test_changes_limit:
description: 'Limits the number of removed or skipped tests listed on PR comments. This can be disabled with a value of 0. The default is 10.'
required: false
check_run_annotations:
description: 'Adds additional information to the check run (comma-separated list): all tests - list all found tests, skipped tests - list all skipped tests, none - no extra annotations at all'
required: false
default: 'all tests, skipped tests'
check_run_annotations_branch:
description: 'Adds check run annotations only on given branches. If not given, this defaults to the default branch of your repository, e.g. main or master. Comma separated list of branch names allowed, asterisk "*" matches all branches.'
required: false
seconds_between_github_reads:
description: 'Sets the number of seconds the action waits between concurrent read requests to the GitHub API. This throttles the API usage to avoid abuse rate limits: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits'
required: false
default: '0.25'
seconds_between_github_writes:
description: 'Sets the number of seconds the action waits between concurrent write requests to the GitHub API. This throttles the API usage to avoid abuse rate limits: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits'
required: false
default: '2.0'
json_file:
description: 'Results are written to this JSON file.'
required: false
outputs:
json:
description: "Test results as JSON"
value: ${{ steps.test-results.outputs.json }}
runs:
using: 'composite'
steps:
- name: Check for Python3
run: |
echo '##[group]Check for Python3'
# we check version here just to execute `python3` with an argument
# on Windows, there is a `python3.exe` that is a proxy to trigger installation from app store
# command `which python3` finds that, but `python3 -V` does not return the version on stdout
if ! which python3 || [[ $(python3 -V) != *"python 3."* && $(python3 -V) != *"Python 3."* ]]
then
if ! which python || [[ $(python -V) != *"python 3."* && $(python -V) != *"Python 3."* ]]
then
echo "::error::No python3 interpreter found. Please setup python before running this action. You could use https://github.com/actions/setup-python."
exit 1
fi
interpreter="$(which python)"
if [[ ! -e "${interpreter}3" ]]
then
mkdir -p "$RUNNER_TEMP/bin/"
ln -s "$interpreter" "$RUNNER_TEMP/bin/python3"
echo "$RUNNER_TEMP/bin" >> $GITHUB_PATH
fi
fi
echo '##[endgroup]'
shell: bash
- name: Install Python dependencies
run: |
echo '##[group]Install Python dependencies'
python3 -m pip install -r $GITHUB_ACTION_PATH/../python/requirements.txt
echo '##[endgroup]'
shell: bash
- name: Publish Test Results
id: test-results
run: |
echo '##[group]Publish Test Results'
python3 $GITHUB_ACTION_PATH/../python/publish_unit_test_results.py
echo '##[endgroup]'
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_RETRIES: ${{ inputs.github_retries }}
COMMIT: ${{ inputs.commit }}
CHECK_NAME: ${{ inputs.check_name }}
COMMENT_TITLE: ${{ inputs.comment_title }}
FAIL_ON: ${{ inputs.fail_on }}
# deprecated
FILES: ${{ inputs.files }}
JUNIT_FILES: ${{ inputs.junit_files }}
TIME_UNIT: ${{ inputs.time_unit }}
REPORT_INDIVIDUAL_RUNS: ${{ inputs.report_individual_runs }}
DEDUPLICATE_CLASSES_BY_FILE_NAME: ${{ inputs.deduplicate_classes_by_file_name }}
IGNORE_RUNS: ${{ inputs.ignore_runs }}
HIDE_COMMENTS: ${{ inputs.hide_comments }}
COMMENT_ON_PR: ${{ inputs.comment_on_pr }}
COMMENT_MODE: ${{ inputs.comment_mode }}
COMPARE_TO_EARLIER_COMMIT: ${{ inputs.compare_to_earlier_commit }}
PULL_REQUEST_BUILD: ${{ inputs.pull_request_build }}
EVENT_FILE: ${{ inputs.event_file }}
EVENT_NAME: ${{ inputs.event_name }}
TEST_CHANGES_LIMIT: ${{ inputs.test_changes_limit }}
CHECK_RUN_ANNOTATIONS: ${{ inputs.check_run_annotations }}
CHECK_RUN_ANNOTATIONS_BRANCH: ${{ inputs.check_run_annotations_branch }}
SECONDS_BETWEEN_GITHUB_READS: ${{ inputs.seconds_between_github_reads }}
SECONDS_BETWEEN_GITHUB_WRITES: ${{ inputs.seconds_between_github_writes }}
JSON_FILE: ${{ inputs.json_file }}
JOB_SUMMARY: ${{ inputs.job_summary }}
# not documented
ROOT_LOG_LEVEL: ${{ inputs.root_log_level }}
# not documented
LOG_LEVEL: ${{ inputs.log_level }}
shell: bash
branding:
icon: 'check-circle'
color: 'green'