Skip to content

Commit c685f43

Browse files
authored
Fix & Enable full expanded matrix in Integration Test CI (#166)
1 parent aa2ee69 commit c685f43

File tree

6 files changed

+271
-144
lines changed

6 files changed

+271
-144
lines changed

.github/workflows/integration_tests.yml

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ jobs:
6363
platform: ${{ steps.matrix_config.outputs.platform }}
6464
apis: ${{ steps.matrix_config.outputs.apis }}
6565
mobile_test_on: ${{ steps.matrix_config.outputs.mobile_test_on }}
66-
android_device: ${{ steps.matrix_config.outputs.android_device }}
67-
ios_device: ${{ steps.matrix_config.outputs.ios_device }}
66+
mobile_device: ${{ steps.matrix_config.outputs.mobile_device }}
6867
steps:
6968
### Fail the workflow if the user does not have admin access to run the tests.
7069
- name: Check if user has permission to trigger tests
@@ -179,8 +178,7 @@ jobs:
179178
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}}")"
180179
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}}")
181180
echo "::set-output name=mobile_test_on::${mobile_test_on}"
182-
echo "::set-output name=android_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k android_device -t ${mobile_test_on} )"
183-
echo "::set-output name=ios_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k ios_device -t ${mobile_test_on} )"
181+
echo "::set-output name=mobile_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k mobile_device -t ${mobile_test_on} -p ${platform})"
184182
- name: Update PR label and comment
185183
if: steps.set_outputs.outputs.pr_number
186184
run: |
@@ -255,7 +253,6 @@ jobs:
255253
run_id: ${{ github.event.inputs.test_packaged_sdk }}
256254

257255
- name: Build integration tests
258-
timeout-minutes: 220
259256
shell: bash
260257
run: |
261258
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
@@ -271,7 +268,7 @@ jobs:
271268
fi
272269
python scripts/gha/build_testapps.py \
273270
--t ${{ needs.check_and_prepare.outputs.apis }} \
274-
--u $( python scripts/gha/print_matrix_configuration.py -u ${{matrix.unity_version}} -k version ) \
271+
--u $( python scripts/gha/print_matrix_configuration.py -k version -u ${{matrix.unity_version}}) \
275272
--p ${{ needs.check_and_prepare.outputs.platform }} \
276273
--ios_sdk ${{ needs.check_and_prepare.outputs.mobile_test_on }} \
277274
--plugin_dir ~/Downloads/firebase_unity_sdk \
@@ -315,34 +312,54 @@ jobs:
315312
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-Android
316313
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Android
317314
retention-days: ${{ env.artifactRetentionDays }}
315+
- name: Delete Android integration tests artifact
316+
if: contains(needs.check_and_prepare.outputs.platform, 'Android') && ${{ !cancelled() }}
317+
shell: bash
318+
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Android || true
318319
- name: Upload iOS integration tests artifact
319320
uses: actions/[email protected]
320321
if: contains(needs.check_and_prepare.outputs.platform, 'iOS') && ${{ !cancelled() }}
321322
with:
322323
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-iOS
323324
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/iOS
324325
retention-days: ${{ env.artifactRetentionDays }}
326+
- name: Delete iOS integration tests artifact
327+
if: contains(needs.check_and_prepare.outputs.platform, 'iOS') && ${{ !cancelled() }}
328+
shell: bash
329+
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/iOS || true
325330
- name: Upload Linux integration tests artifact
326331
uses: actions/[email protected]
327332
if: contains(needs.check_and_prepare.outputs.platform, 'Linux') && ${{ !cancelled() }}
328333
with:
329334
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-ubuntu-latest
330335
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Linux
331336
retention-days: ${{ env.artifactRetentionDays }}
337+
- name: Delete Linux integration tests artifact
338+
if: contains(needs.check_and_prepare.outputs.platform, 'Linux') && ${{ !cancelled() }}
339+
shell: bash
340+
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Linux || true
332341
- name: Upload macOS integration tests artifact
333342
uses: actions/[email protected]
334343
if: contains(needs.check_and_prepare.outputs.platform, 'macOS') && ${{ !cancelled() }}
335344
with:
336345
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-macos-latest
337346
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/macOS
338347
retention-days: ${{ env.artifactRetentionDays }}
348+
- name: Delete macOS integration tests artifact
349+
if: contains(needs.check_and_prepare.outputs.platform, 'macOS') && ${{ !cancelled() }}
350+
shell: bash
351+
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/macOS || true
339352
- name: Upload Windows integration tests artifact
340353
uses: actions/[email protected]
341354
if: contains(needs.check_and_prepare.outputs.platform, 'Windows') && ${{ !cancelled() }}
342355
with:
343356
name: testapps-${{ matrix.unity_version }}-${{matrix.os}}-windows-latest
344357
path: testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Windows
345358
retention-days: ${{ env.artifactRetentionDays }}
359+
- name: Delete Windows integration tests artifact
360+
if: contains(needs.check_and_prepare.outputs.platform, 'Windows') && ${{ !cancelled() }}
361+
shell: bash
362+
run: rm -rf testapps-${{ matrix.unity_version }}-${{matrix.os}}-${{ needs.check_and_prepare.outputs.platform }}/Windows || true
346363
- name: Download log artifacts
347364
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
348365
uses: actions/[email protected]
@@ -377,9 +394,9 @@ jobs:
377394
strategy:
378395
fail-fast: false
379396
matrix:
397+
unity_version: ${{ fromJson(needs.check_and_prepare.outputs.matrix_unity_versions) }}
380398
build_os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_build_os) }}
381399
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_desktop_os) }}
382-
unity_version: ${{ fromJson(needs.check_and_prepare.outputs.matrix_unity_versions) }}
383400
steps:
384401
- uses: actions/checkout@v2
385402
with:
@@ -428,7 +445,6 @@ jobs:
428445
shell: bash
429446
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
430447
run: |
431-
pushd ${{env.GCS_UPLOAD_DIR}}
432448
python scripts/gha/it_workflow.py --stage progress \
433449
--token ${{github.token}} \
434450
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
@@ -445,31 +461,20 @@ jobs:
445461
fi
446462
447463
test_mobile:
448-
name: test-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}-${{ matrix.mobile_test_on }}
464+
name: test-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile
449465
runs-on: macos-11
450466
if: (contains(needs.check_and_prepare.outputs.platform, 'Android') || contains(needs.check_and_prepare.outputs.platform, 'iOS')) && !cancelled()
451467
needs: [check_and_prepare, build]
452468
strategy:
453469
fail-fast: false
454470
matrix:
455-
build_os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_build_os) }}
456-
platform: ${{ fromJson(needs.check_and_prepare.outputs.matrix_mobile_platform) }}
457471
unity_version: ${{ fromJson(needs.check_and_prepare.outputs.matrix_unity_versions) }}
458-
include:
459-
# TODO(sunmou): include test device that are currently working
460-
- platform: "Android"
461-
mobile_test_on: "real"
462-
- platform: "iOS"
463-
mobile_test_on: "virtual"
472+
build_os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_build_os) }}
473+
mobile_device: ${{ fromJson(needs.check_and_prepare.outputs.mobile_device) }}
464474
steps:
465475
- uses: actions/checkout@v2
466476
with:
467477
ref: ${{needs.check_and_prepare.outputs.github_ref}}
468-
- name: Download Desktop integration tests artifact
469-
uses: actions/[email protected]
470-
with:
471-
path: testapps
472-
name: testapps-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}
473478
- name: Setup python
474479
uses: actions/setup-python@v2
475480
with:
@@ -479,39 +484,52 @@ jobs:
479484
shell: bash
480485
run: |
481486
pip install -r scripts/gha/requirements.txt
487+
- id: device-info
488+
run: |
489+
echo "::set-output name=device_type::$( python scripts/gha/print_matrix_configuration.py -k ${{ matrix.mobile_device }} -get_device_type)"
490+
echo "::set-output name=device_platform::$( python scripts/gha/print_matrix_configuration.py -k ${{ matrix.mobile_device }} -get_device_platform)"
491+
- name: Download Desktop integration tests artifact
492+
uses: actions/[email protected]
493+
with:
494+
path: testapps
495+
name: testapps-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ steps.device-info.outputs.device_platform }}
482496
- name: Install Cloud SDK
483-
if: matrix.mobile_test_on == 'real'
497+
if: steps.device-info.outputs.device_type == 'real'
484498
uses: google-github-actions/setup-gcloud@master
485499
- name: Run Mobile integration tests on Real Device via FTL
486-
if: matrix.mobile_test_on == 'real'
500+
if: steps.device-info.outputs.device_type == 'real'
487501
timeout-minutes: 60
488502
shell: bash
489503
run: |
490504
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
491505
python scripts/gha/test_lab.py --testapp_dir testapps \
492-
--logfile_name "${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}" \
506+
--ios_device "${{ matrix.mobile_device }}" \
507+
--android_device "${{ matrix.mobile_device }}" \
508+
--logfile_name "${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile" \
493509
--code_platform unity \
494510
--key_file scripts/gha-encrypted/gcs_key_file.json
495511
- name: Run Mobile integration tests on virtual device locally
496512
timeout-minutes: 60
497-
if: matrix.mobile_test_on == 'virtual'
513+
if: steps.device-info.outputs.device_type == 'virtual'
498514
run: |
499515
python scripts/gha/test_simulator.py --testapp_dir testapps \
500-
--logfile_name "${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}" \
516+
--ios_device "${{ matrix.mobile_device }}" \
517+
--android_device "${{ matrix.mobile_device }}" \
518+
--logfile_name "${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile" \
501519
--ci
502520
- name: Prepare results summary artifact
503521
if: ${{ !cancelled() }}
504522
shell: bash
505523
run: |
506-
if [ ! -f testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}.log.json ]; then
507-
mkdir -p testapps && echo "__SUMMARY_MISSING__" > testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}.log.json
524+
if [ ! -f testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile.log.json ]; then
525+
mkdir -p testapps && echo "__SUMMARY_MISSING__" > testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile.log.json
508526
fi
509-
- name: Upload Desktop test results artifact
527+
- name: Upload Mobile test results artifact
510528
if: ${{ !cancelled() }}
511529
uses: actions/[email protected]
512530
with:
513531
name: log-artifact
514-
path: testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}*
532+
path: testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile*
515533
retention-days: ${{ env.artifactRetentionDays }}
516534
- name: Download log artifacts
517535
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
@@ -532,7 +550,7 @@ jobs:
532550
if: ${{ !cancelled() }}
533551
shell: bash
534552
run: |
535-
cat testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.platform }}.log
553+
cat testapps/test-results-${{ matrix.unity_version }}-${{ matrix.build_os }}-${{ matrix.mobile_device }}-mobile.log
536554
if [[ "${{ job.status }}" != "success" ]]; then
537555
exit 1
538556
fi

scripts/gha/build_testapps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,9 @@ def _collect_integration_tests_platform(config, testapps, artifact_path, testapp
641641
for testapp in testapps:
642642
if config.get_api(testapp).full_name in path:
643643
if os.path.isfile(path):
644-
shutil.copy(path, os.path.join(artifact_path, platform ,testapp))
644+
shutil.move(path, os.path.join(artifact_path, platform ,testapp))
645645
else:
646-
dir_util.copy_tree(path, os.path.join(artifact_path, platform ,testapp, os.path.basename(path)))
646+
shutil.move(path, os.path.join(artifact_path, platform ,testapp, os.path.basename(path)), copy_function = shutil.copytree)
647647
break
648648

649649

0 commit comments

Comments
 (0)