@@ -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.
@@ -24,6 +19,12 @@ inputs:
2419 description : >-
2520 Launchable token is needed if you want to run Launchable on your forked repository.
2621 See https://github.com/ruby/ruby/wiki/CI-Servers#launchable-ci for details.
22+
23+ launchable-url :
24+ required : false
25+ description : >-
26+ Launchable token is needed if you want to run Launchable on your forked repository.
27+ See https://github.com/ruby/ruby/wiki/CI-Servers#launchable-ci for details.
2728
2829 builddir :
2930 required : false
@@ -38,18 +39,21 @@ inputs:
3839 Directory to (re-)checkout source codes. Launchable retrieves the commit information
3940 from the directory.
4041
41- launchable-workspace :
42- required : true
43- default : ${{ github.event.repository.name }}
44- description : >-
45- A workspace name in Launchable
46-
4742 test-task :
48- required : true
43+ required : false
4944 default : ${{ matrix.test_task }}
5045 description : >-
51- A test task that determine which tests are executed.
46+ Specifies a single test task to be executed.
5247 This value is used in the Launchable flavor.
48+ Either 'test-task' or 'multi-test-tasks' must be configured.
49+
50+ test-tasks :
51+ required : false
52+ default : ' []'
53+ description : >-
54+ Specifies an array of multiple test tasks to be executed.
55+ For example: '["test", "test-all"]'.
56+ If you want to run a single test task, use the 'test-task' input instead.
5357
5458runs :
5559 using : composite
@@ -61,11 +65,11 @@ runs:
6165 shell : bash
6266 if : >-
6367 ${{
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')
68+ (inputs.test-task == 'check'
69+ || inputs.test-task == 'test-all'
70+ || inputs.test-task == 'test'
71+ || contains(fromJSON( inputs.test-tasks), 'test-all')
72+ || contains(fromJSON( inputs.test-tasks), 'test') )
6973 }}
7074
7175 # Launchable CLI requires Python and Java.
8387 java-version : ' 17'
8488 if : steps.enable-launchable.outputs.enable-launchable
8589
90+ - name : Check test-task
91+ id : test-task
92+ shell : bash
93+ run : |
94+ test_all_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test-all' || contains(fromJSON(inputs.test-tasks), 'test-all') }}"
95+ btest_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test' || contains(fromJSON(inputs.test-tasks), 'test') }}"
96+ echo test_all_enabled="${test_all_enabled}" >> $GITHUB_OUTPUT
97+ echo btest_enabled="${btest_enabled}" >> $GITHUB_OUTPUT
98+ if : steps.enable-launchable.outputs.enable-launchable
99+
86100 - name : Set environment variables for Launchable
87101 shell : bash
88102 run : |
@@ -92,10 +106,11 @@ runs:
92106 : # The following envs are necessary in Launchable tokenless authentication.
93107 : # https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L20
94108 echo "LAUNCHABLE_ORGANIZATION=${{ github.repository_owner }}" >> $GITHUB_ENV
95- echo "LAUNCHABLE_WORKSPACE=${{ inputs.launchable-workspace }}" >> $GITHUB_ENV
109+ echo "LAUNCHABLE_WORKSPACE=${{ github.event.repository.name }}" >> $GITHUB_ENV
96110 : # https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L71
97111 echo "GITHUB_PR_HEAD_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV
98112 echo "LAUNCHABLE_TOKEN=${{ inputs.launchable-token }}" >> $GITHUB_ENV
113+ echo "LAUNCHABLE_BASE_URL=${{ inputs.launchable-url }}" >> $GITHUB_ENV
99114 if : steps.enable-launchable.outputs.enable-launchable
100115
101116 - name : Set up path
@@ -122,8 +137,16 @@ runs:
122137 : # FIXME: Need to fix `WARNING: Failed to process a change to a file`.
123138 : # https://github.com/launchableinc/cli/issues/786
124139 launchable record build --name ${github_ref}_${GITHUB_PR_HEAD_SHA}
125- echo "TESTS=${TESTS} --launchable-test-reports=${{ inputs.report-path }}" >> $GITHUB_ENV
140+ if [ "${test_all_enabled}" = "true" ]; then
141+ echo "TESTS=${TESTS} --launchable-test-reports=launchable_test_all.json" >> $GITHUB_ENV
142+ fi
143+ if [ "${btest_enabled}" = "true" ]; then
144+ echo "BTESTS=${BTESTS} --launchable-test-reports=launchable_bootstraptest.json" >> $GITHUB_ENV
145+ fi
126146 if : steps.enable-launchable.outputs.enable-launchable
147+ env :
148+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
149+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
127150
128151 - name : Variables to report Launchable
129152 id : variables
@@ -142,24 +165,49 @@ runs:
142165 # srcdir must be equal to or under workspace
143166 dir=$(echo ${srcdir:+${srcdir}/} | sed 's:[^/][^/]*/:../:g')
144167 fi
145- report_path="${dir}${builddir:+${builddir}/}${report_path}"
146- echo report-path="${report_path}" >> $GITHUB_OUTPUT
168+ if [ "${test_all_enabled}" = "true" ]; then
169+ test_report_path="${dir}${builddir:+${builddir}/}launchable_test_all.json"
170+ echo test_report_path="${test_report_path}" >> $GITHUB_OUTPUT
171+ fi
172+ if [ "${btest_enabled}" = "true" ]; then
173+ boot_report_path="${dir}${builddir:+${builddir}/}launchable_bootstraptest.json"
174+ echo boot_report_path="${boot_report_path}" >> $GITHUB_OUTPUT
175+ fi
147176 if : steps.enable-launchable.outputs.enable-launchable
148177 env :
149178 srcdir : ${{ inputs.srcdir }}
150179 builddir : ${{ inputs.builddir }}
151- report_path : ${{ inputs.report-path }}
180+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
181+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
152182
153183 - name : Record test results in Launchable
154184 uses : gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
155185 with :
156186 shell : bash
157187 working-directory : ${{ inputs.srcdir }}
158188 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}
189+ [[ "${test_all_enabled}" = "true" ]] && \
190+ launchable record tests \
191+ --flavor os=${{ inputs.os }} \
192+ --flavor test_task=${{ inputs.test-task }} \
193+ --flavor test_opts=${test_opts} \
194+ --test-suite test-all \
195+ raw ${test_report_path} || true
196+
197+ [[ "${btest_enabled}" = "true" ]] && \
198+ launchable record tests \
199+ --flavor os=${{ inputs.os }} \
200+ --flavor test_task=${{ inputs.test-task }} \
201+ --flavor test_opts=${test_opts} \
202+ --test-suite bootstraptest \
203+ raw ${boot_report_path} || true
204+
205+ rm -f ${test_report_path}
206+ rm -f ${boot_report_path}
162207 if : ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
163208 env :
164209 test_opts : ${{ steps.variables.outputs.test-opts }}
165- report_path : ${{ steps.variables.outputs.report-path }}
210+ test_report_path : ${{ steps.variables.outputs.test_report_path }}
211+ boot_report_path : ${{ steps.variables.outputs.boot_report_path }}
212+ test_all_enabled : ${{ steps.test-task.outputs.test_all_enabled }}
213+ btest_enabled : ${{ steps.test-task.outputs.btest_enabled }}
0 commit comments