@@ -3,11 +3,6 @@ description: >-
33 Install the required dependencies and execute the necessary Launchable commands for test recording
44
55inputs :
6- report-path :
7- default : launchable_reports.json
8- required : true
9- description : The file path of the test report for uploading to Launchable
10-
116 os :
127 required : true
138 description : The operating system that CI runs on. This value is used in Launchable flavor.
@@ -38,18 +33,21 @@ inputs:
3833 Directory to (re-)checkout source codes. Launchable retrieves the commit information
3934 from the directory.
4035
41- launchable-workspace :
42- required : true
43- default : ${{ github.event.repository.name }}
44- description : >-
45- A workspace name in Launchable
46-
4736 test-task :
48- required : true
37+ required : false
4938 default : ${{ matrix.test_task }}
5039 description : >-
51- A test task that determine which tests are executed.
40+ Specifies a single test task to be executed.
5241 This value is used in the Launchable flavor.
42+ Either 'test-task' or 'multi-test-tasks' must be configured.
43+
44+ test-tasks :
45+ required : false
46+ default : ' []'
47+ description : >-
48+ Specifies an array of multiple test tasks to be executed.
49+ For example: '["test", "test-all"]'.
50+ If you want to run a single test task, use the 'test-task' input instead.
5351
5452runs :
5553 using : composite
@@ -61,11 +59,14 @@ runs:
6159 shell : bash
6260 if : >-
6361 ${{
64- (github.repository == 'ruby/ruby' ||
65- (github.repository != 'ruby/ruby' && env.LAUNCHABLE_TOKEN)) &&
66- (inputs.test-task == 'check' ||
67- inputs.test-task == 'test-all' ||
68- inputs.test-task == 'test')
62+ (github.repository == 'ruby/ruby'
63+ || (github.repository != 'ruby/ruby'
64+ && env.LAUNCHABLE_TOKEN))
65+ && (inputs.test-task == 'check'
66+ || inputs.test-task == 'test-all'
67+ || inputs.test-task == 'test'
68+ || contains(fromJSON(inputs.test-tasks), 'test-all')
69+ || contains(fromJSON(inputs.test-tasks), 'test'))
6970 }}
7071
7172 # Launchable CLI requires Python and Java.
8384 java-version : ' 17'
8485 if : steps.enable-launchable.outputs.enable-launchable
8586
87+ - name : Check test-task
88+ id : test-task
89+ shell : bash
90+ run : |
91+ test_all_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test-all' || contains(fromJSON(inputs.test-tasks), 'test-all') }}"
92+ btest_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test' || contains(fromJSON(inputs.test-tasks), 'test') }}"
93+ echo test_all_enabled="${test_all_enabled}" >> $GITHUB_OUTPUT
94+ echo btest_enabled="${btest_enabled}" >> $GITHUB_OUTPUT
95+ if : steps.enable-launchable.outputs.enable-launchable
96+
8697 - name : Set environment variables for Launchable
8798 shell : bash
8899 run : |
92103 : # The following envs are necessary in Launchable tokenless authentication.
93104 : # https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L20
94105 echo "LAUNCHABLE_ORGANIZATION=${{ github.repository_owner }}" >> $GITHUB_ENV
95- echo "LAUNCHABLE_WORKSPACE=${{ inputs.launchable-workspace }}" >> $GITHUB_ENV
106+ echo "LAUNCHABLE_WORKSPACE=${{ github.event.repository.name }}" >> $GITHUB_ENV
96107 : # https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L71
97108 echo "GITHUB_PR_HEAD_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV
98109 echo "LAUNCHABLE_TOKEN=${{ inputs.launchable-token }}" >> $GITHUB_ENV
@@ -122,8 +133,16 @@ runs:
122133 : # FIXME: Need to fix `WARNING: Failed to process a change to a file`.
123134 : # https://github.com/launchableinc/cli/issues/786
124135 launchable record build --name ${github_ref}_${GITHUB_PR_HEAD_SHA}
125- echo "TESTS=${TESTS} --launchable-test-reports=${{ inputs.report-path }}" >> $GITHUB_ENV
136+ if [ "${test_all_enabled}" = "true" ]; then
137+ echo "TESTS=${TESTS} --launchable-test-reports=launchable_test_all.json" >> $GITHUB_ENV
138+ fi
139+ if [ "${btest_enabled}" = "true" ]; then
140+ echo "BTESTS=${BTESTS} --launchable-test-reports=launchable_bootstraptest.json" >> $GITHUB_ENV
141+ fi
126142 if : steps.enable-launchable.outputs.enable-launchable
143+ env :
144+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
145+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
127146
128147 - name : Variables to report Launchable
129148 id : variables
@@ -142,24 +161,49 @@ runs:
142161 # srcdir must be equal to or under workspace
143162 dir=$(echo ${srcdir:+${srcdir}/} | sed 's:[^/][^/]*/:../:g')
144163 fi
145- report_path="${dir}${builddir:+${builddir}/}${report_path}"
146- echo report-path="${report_path}" >> $GITHUB_OUTPUT
164+ if [ "${test_all_enabled}" = "true" ]; then
165+ test_report_path="${dir}${builddir:+${builddir}/}launchable_test_all.json"
166+ echo test_report_path="${test_report_path}" >> $GITHUB_OUTPUT
167+ fi
168+ if [ "${btest_enabled}" = "true" ]; then
169+ boot_report_path="${dir}${builddir:+${builddir}/}launchable_bootstraptest.json"
170+ echo boot_report_path="${boot_report_path}" >> $GITHUB_OUTPUT
171+ fi
147172 if : steps.enable-launchable.outputs.enable-launchable
148173 env :
149174 srcdir : ${{ inputs.srcdir }}
150175 builddir : ${{ inputs.builddir }}
151- report_path : ${{ inputs.report-path }}
176+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
177+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
152178
153179 - name : Record test results in Launchable
154180 uses : gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
155181 with :
156182 shell : bash
157183 working-directory : ${{ inputs.srcdir }}
158184 post : |
159- : # record
160- launchable record tests --flavor os=${{ inputs.os }} --flavor test_task=${{ inputs.test-task }} --flavor test_opts=${test_opts} raw ${report_path}
161- rm -f ${report_path}
185+ [[ "${test_all_enabled}" = "true" ]] && \
186+ launchable record tests \
187+ --flavor os=${{ inputs.os }} \
188+ --flavor test_task=${{ inputs.test-task }} \
189+ --flavor test_opts=${test_opts} \
190+ --test-suite test-all \
191+ raw ${test_report_path} || true
192+
193+ [[ "${btest_enabled}" = "true" ]] && \
194+ launchable record tests \
195+ --flavor os=${{ inputs.os }} \
196+ --flavor test_task=${{ inputs.test-task }} \
197+ --flavor test_opts=${test_opts} \
198+ --test-suite bootstraptest \
199+ raw ${boot_report_path} || true
200+
201+ rm -f ${test_report_path}
202+ rm -f ${boot_report_path}
162203 if : ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
163204 env :
164205 test_opts : ${{ steps.variables.outputs.test-opts }}
165- report_path : ${{ steps.variables.outputs.report-path }}
206+ test_report_path : ${{ steps.variables.outputs.test_report_path }}
207+ boot_report_path : ${{ steps.variables.outputs.boot_report_path }}
208+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
209+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
0 commit comments