-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
164 lines (149 loc) · 5.06 KB
/
action.yaml
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
name: "Record build and test results action"
author: "launchableinc"
description: "Launchable action for recording build and test results"
branding:
icon: 'circle'
color: 'gray-dark'
inputs:
build_name:
required: false
description: "The build name. Default GitHub SHA."
default: $GITHUB_SHA
max_days:
required: false
description: "The maximum number of days to collect commits retroactively. Default 30."
default: "30"
no_submodules:
required: false
description: "Stop collecting build information from Git Submodules. Default False."
default: "false"
no_build:
required: false
description: "Send test session without recording build. Default False."
default: "false"
python_version:
required: false
description: "Python version >= 3.5 <=3.10. Default 3.10"
default: "3.10"
report_path:
required: true
description: "The test report file path. Default ..."
default: "."
source_path:
required: false
description: "Path to a local Git repository/workspace. Default current directory."
default: "."
test_runner:
required: true
description: "test runner name"
test_session_name:
required: false
description: "The test session name for `--session-name` option of record session command. test-session name value This value needs to be globally unique"
default: ""
flavors:
required: false
description: "The flavors for `--flavor` option of record session command"
default: ""
test_suite:
required: false
description: "Sets a test suite name for seeing and comparing the different test sessions. e.g. e2e-test, integration-test, etc"
default: ""
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ inputs.python_version }}
- name: Set up JDK 1.8
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: 'adopt'
java-version: 8
- id: install
shell: bash
run: pip install "launchable>=1.59.0"
- id: verify
shell: bash
run: |
launchable verify
- id: record_build
shell: bash
if: inputs.no_build != 'true'
run: |
options=(
"--name" "${{ inputs.build_name }}"
"--max-days" "${{ inputs.max_days }}"
"--source" "src=${{ inputs.source_path }}"
)
if [ "${{ inputs.no_submodules }}" == "true" ]; then
options+=("--no-submodules")
fi
launchable record build "${options[@]}"
- id: record_session
if: inputs.no_build != 'true'
shell: bash
run: |
options=(
"--build" "${{ inputs.build_name }}"
)
# Set up flavors options
if [ -n "${{ inputs.flavors }}" ]; then
IFS=', ' read -r -a flavors <<< "${{ inputs.flavors }}"
for flavor in "${flavors[@]}"; do
options+=("--flavor" "$flavor")
done
fi
# Set up test session name option
if [ "${{ inputs.test_session_name }}" ]; then
options+=("--session-name" "${{ inputs.test_session_name }}")
fi
# Set up test suite option
if [ "${{ inputs.test_suite }}" ]; then
options+=("--test-suite" "${{ inputs.test_suite }}")
fi
# In some case (e.g. parallel execution), wants to use the same ses sion name.
# So, allow the case that the session name is already used.
set +e
output=$(launchable record session "${options[@]}" 2>&1)
exit_code=$?
if [[ $output == *"is already used"* ]]; then
echo "INFO: test_session_name: '${{ inputs.test_session_name }}' is already registered. New test session wasn't created."
exit_code=0
else
echo $output
fi
exit $exit_code
- id: record_test
shell: bash
run: |
options=(
"--allow-test-before-build"
)
if [ "${{ inputs.no_build }}" == "true" ]; then
# If this action is called multiple times in a workflow, there is a possibility that .launchable file is already created.
# So, try to remove it to avoid the conflict, just in case.
rm -f .launchable
options+=("--no-build")
# Set up flavors options
if [ -n "${{ inputs.flavors }}" ]; then
IFS=', ' read -r -a flavors <<< "${{ inputs.flavors }}"
for flavor in "${flavors[@]}"; do
options+=("--flavor" "$flavor")
done
fi
fi
if [ "${{ inputs.test_session_name }}" ]; then
options+=(
"--build" "${{ inputs.build_name }}"
"--session-name" "${{ inputs.test_session_name }}"
)
fi
if [ "${{ inputs.test_suite }}" ]; then
options+=("--test-suite" "${{ inputs.test_suite }}")
fi
options+=(
"${{ inputs.test_runner }}"
"${{ inputs.report_path }}"
)
launchable record tests "${options[@]}"