Skip to content

Commit 2aa1be9

Browse files
authored
CI enable parallel building for integration testapps (#158)
1 parent c685f43 commit 2aa1be9

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

.github/workflows/integration_tests.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
github_ref: ${{ steps.set_outputs.outputs.github_ref }}
5858
pr_number: ${{ steps.set_outputs.outputs.pr_number }}
5959
matrix_build_os: ${{ steps.matrix_config.outputs.matrix_build_os }}
60+
matrix_build_platform: ${{ steps.matrix_config.outputs.matrix_build_platform }}
6061
matrix_unity_versions: ${{ steps.matrix_config.outputs.matrix_unity_versions }}
6162
matrix_desktop_os: ${{ steps.matrix_config.outputs.matrix_desktop_os }}
6263
matrix_mobile_platform: ${{ steps.matrix_config.outputs.matrix_mobile_platform }}
@@ -174,6 +175,7 @@ jobs:
174175
echo "::set-output name=platform::${platform}"
175176
echo "::set-output name=matrix_desktop_os::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k "${platform}" -desktop_os=1)"
176177
echo "::set-output name=matrix_mobile_platform::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k "${platform}" -mobile_platform=1)"
178+
echo "::set-output name=matrix_build_platform::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k "${platform}" -build_platform=1)"
177179
echo "::set-output name=matrix_build_os::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k build_os -o "${{github.event.inputs.build_os}}")"
178180
echo "::set-output name=matrix_unity_versions::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k unity_version -o "${{github.event.inputs.unity_versions}}")"
179181
mobile_test_on=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k mobile_test_on -o "${{github.event.inputs.mobile_test_on}}")
@@ -191,14 +193,15 @@ jobs:
191193
--run_id ${{github.run_id}}
192194
193195
build:
194-
name: build-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}
196+
name: build-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}
195197
runs-on: ${{matrix.os}}
196198
needs: check_and_prepare
197199
strategy:
198200
fail-fast: false
199201
matrix:
200202
unity_version: ${{ fromJson(needs.check_and_prepare.outputs.matrix_unity_versions) }}
201203
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_build_os) }}
204+
platform: ${{ fromJson(needs.check_and_prepare.outputs.matrix_build_platform) }}
202205
env:
203206
# LC_ALL, LANG and U3D_PASSWORD are needed for U3D.
204207
LC_ALL: en_US.UTF-8
@@ -227,7 +230,7 @@ jobs:
227230
shell: bash
228231
run: |
229232
python scripts/gha/unity_installer.py --install \
230-
--platforms ${{ needs.check_and_prepare.outputs.platform }} \
233+
--platforms ${{ matrix.platform }} \
231234
--version ${{ matrix.unity_version }}
232235
- name: Activate Unity license
233236
timeout-minutes: 10
@@ -269,11 +272,11 @@ jobs:
269272
python scripts/gha/build_testapps.py \
270273
--t ${{ needs.check_and_prepare.outputs.apis }} \
271274
--u $( python scripts/gha/print_matrix_configuration.py -k version -u ${{matrix.unity_version}}) \
272-
--p ${{ needs.check_and_prepare.outputs.platform }} \
275+
--p ${{ matrix.platform }} \
273276
--ios_sdk ${{ needs.check_and_prepare.outputs.mobile_test_on }} \
274277
--plugin_dir ~/Downloads/firebase_unity_sdk \
275278
--output_directory "${{ github.workspace }}" \
276-
--artifact_name "${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}" \
279+
--artifact_name "${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}" \
277280
--force_latest_runtime \
278281
--ci
279282
- name: Return Unity license
@@ -294,67 +297,67 @@ jobs:
294297
if: ${{ !cancelled() }}
295298
shell: bash
296299
run: |
297-
if [ ! -f build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}.log.json ]; then
300+
if [ ! -f build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}.log.json ]; then
298301
# No summary was created, make a placeholder one.
299-
echo "__SUMMARY_MISSING__" > build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}.log.json
302+
echo "__SUMMARY_MISSING__" > build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}.log.json
300303
fi
301304
- name: Upload build results artifact
302305
uses: actions/[email protected]
303306
if: ${{ !cancelled() }}
304307
with:
305308
name: log-artifact
306-
path: build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}*
309+
path: build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}*
307310
retention-days: ${{ env.artifactRetentionDays }}
308311
- name: Upload Android integration tests artifact
309312
uses: actions/[email protected]
310-
if: contains(needs.check_and_prepare.outputs.platform, 'Android') && ${{ !cancelled() }}
313+
if: contains(matrix.platform, 'Android') && ${{ !cancelled() }}
311314
with:
312315
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-Android
313-
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Android
316+
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}/Android
314317
retention-days: ${{ env.artifactRetentionDays }}
315318
- name: Delete Android integration tests artifact
316319
if: contains(needs.check_and_prepare.outputs.platform, 'Android') && ${{ !cancelled() }}
317320
shell: bash
318321
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Android || true
319322
- name: Upload iOS integration tests artifact
320323
uses: actions/[email protected]
321-
if: contains(needs.check_and_prepare.outputs.platform, 'iOS') && ${{ !cancelled() }}
324+
if: contains(matrix.platform, 'iOS') && ${{ !cancelled() }}
322325
with:
323326
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-iOS
324-
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/iOS
327+
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}/iOS
325328
retention-days: ${{ env.artifactRetentionDays }}
326329
- name: Delete iOS integration tests artifact
327330
if: contains(needs.check_and_prepare.outputs.platform, 'iOS') && ${{ !cancelled() }}
328331
shell: bash
329332
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/iOS || true
330333
- name: Upload Linux integration tests artifact
331334
uses: actions/[email protected]
332-
if: contains(needs.check_and_prepare.outputs.platform, 'Linux') && ${{ !cancelled() }}
335+
if: contains(matrix.platform, 'Linux') && ${{ !cancelled() }}
333336
with:
334337
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-ubuntu-latest
335-
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Linux
338+
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}/Linux
336339
retention-days: ${{ env.artifactRetentionDays }}
337340
- name: Delete Linux integration tests artifact
338341
if: contains(needs.check_and_prepare.outputs.platform, 'Linux') && ${{ !cancelled() }}
339342
shell: bash
340343
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Linux || true
341344
- name: Upload macOS integration tests artifact
342345
uses: actions/[email protected]
343-
if: contains(needs.check_and_prepare.outputs.platform, 'macOS') && ${{ !cancelled() }}
346+
if: contains(matrix.platform, 'macOS') && ${{ !cancelled() }}
344347
with:
345348
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-macos-latest
346-
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/macOS
349+
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}/macOS
347350
retention-days: ${{ env.artifactRetentionDays }}
348351
- name: Delete macOS integration tests artifact
349352
if: contains(needs.check_and_prepare.outputs.platform, 'macOS') && ${{ !cancelled() }}
350353
shell: bash
351354
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/macOS || true
352355
- name: Upload Windows integration tests artifact
353356
uses: actions/[email protected]
354-
if: contains(needs.check_and_prepare.outputs.platform, 'Windows') && ${{ !cancelled() }}
357+
if: contains(matrix.platform, 'Windows') && ${{ !cancelled() }}
355358
with:
356359
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-windows-latest
357-
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Windows
360+
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform}}/Windows
358361
retention-days: ${{ env.artifactRetentionDays }}
359362
- name: Delete Windows integration tests artifact
360363
if: contains(needs.check_and_prepare.outputs.platform, 'Windows') && ${{ !cancelled() }}
@@ -380,7 +383,7 @@ jobs:
380383
if: ${{ !cancelled() }}
381384
shell: bash
382385
run: |
383-
cat build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}.log
386+
cat build-results-${{ matrix.unity_version }}-${{matrix.os}}-${{ matrix.platform }}.log
384387
if [[ "${{ job.status }}" != "success" ]]; then
385388
exit 1
386389
fi

scripts/gha/print_matrix_configuration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
},
6969
"config": {
7070
"platform": "Windows,macOS,Linux,Android,iOS",
71+
"apis": "analytics,auth,crashlytics,database,dynamic_links,functions,installations,messaging,remote_config,storage",
7172
"apis": "analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage",
7273
"mobile_test_on": "real,virtual"
7374
}
@@ -249,6 +250,14 @@ def filter_mobile_platform(platform):
249250
return list(filtered_value)
250251

251252

253+
def filter_build_platform(platform):
254+
platform = platform.split(",")
255+
build_platform = []
256+
build_platform.extend(filter_mobile_platform(platform))
257+
desktop_platform = ','.join(list(filter(lambda p: p in platform, ["Windows", "macOS", "Linux"])))
258+
build_platform.append(desktop_platform)
259+
return build_platform
260+
252261

253262
def print_value(value, config_parms_only=False):
254263
""" Print Json formatted string that can be consumed in Github workflow."""
@@ -288,6 +297,9 @@ def main():
288297
if args.mobile_platform:
289298
print(filter_mobile_platform(platform=args.parm_key))
290299
return
300+
if args.build_platform:
301+
print(filter_build_platform(platform=args.parm_key))
302+
return
291303

292304
if args.override:
293305
# If it is matrix parm, convert CSV string into a list
@@ -327,6 +339,7 @@ def parse_cmdline_args():
327339
parser.add_argument('-get_device_platform', action='store_true', help='Get the device platform, used with -k $device')
328340
parser.add_argument('-desktop_os', type=bool, default=False, help='Get desktop test OS. Use with "-k $build_platform -desktop_os=1"')
329341
parser.add_argument('-mobile_platform', type=bool, default=False, help='Get mobile test platform. Use with "-k $build_platform -mobile_platform=1"')
342+
parser.add_argument('-build_platform', type=bool, default=False, help='Get build platform. Use with "-k $build_platform -build_platform=1"')
330343
args = parser.parse_args()
331344
return args
332345

0 commit comments

Comments
 (0)