Skip to content

Commit 07d8286

Browse files
authored
chore: Add ability to run mobile tests on all supported unity versions (#2028)
1 parent f6f9ddd commit 07d8286

File tree

3 files changed

+63
-21
lines changed

3 files changed

+63
-21
lines changed

.yamato/_run-all.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ run_all_tests:
55
dependencies:
66
# Pull in package and validate jobs through the badges job
77
- .yamato/_triggers.yml#badges_test_trigger
8-
- .yamato/mobile-build-and-test.yml#2021.2_Run_iOS_Player_With_Tests
9-
- .yamato/mobile-build-and-test.yml#2021.2_Run_Android_Player_With_Tests
8+
- .yamato/mobile-build-and-test.yml#run_{{ projects.first.name }}_tests_{{ mobile_validation_editor }}_iOS
9+
- .yamato/mobile-build-and-test.yml#run_{{ projects.first.name }}_tests_{{ mobile_validation_editor }}_android
1010
# - .yamato/_run-all.yml#all_project_tests_standalone
1111
{% for platform in test_platforms -%}
1212
{% for project in projects -%}
@@ -89,4 +89,16 @@ all_project_tests_standalone:
8989
{% endfor -%}
9090
{% endif -%}
9191
{% endfor -%}
92-
{% endfor -%}
92+
{% endfor -%}
93+
94+
all_project_tests_mobile:
95+
name: Run All Project Tests - Mobile
96+
dependencies:
97+
{% for project in projects -%}
98+
{% if project.name == "testproject" -%}
99+
{% for editor in project.test_editors -%}
100+
- .yamato/mobile-build-and-test.yml#run_{{ project.name }}_tests_{{ editor }}_android
101+
- .yamato/mobile-build-and-test.yml#run_{{ project.name }}_tests_{{ editor }}_iOS
102+
{% endfor -%}
103+
{% endif -%}
104+
{% endfor -%}

.yamato/mobile-build-and-test.yml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
2021.2_Build_Android_player:
2-
name: 2021.2 Build Android player
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
4+
{% for project in projects -%}
5+
{% if project.name == "testproject" -%}
6+
{% for editor in project.test_editors -%}
7+
build_{{ project.name }}_tests_{{ editor }}_android:
8+
name: Build {{ project.name }} Tests - {{ editor }} - Android
39
agent:
410
type: Unity::VM
511
image: desktop/android-execution-r19:v0.1.1-860408
@@ -8,10 +14,10 @@
814
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
915
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
1016
- python .yamato/disable-burst-if-requested.py --project-path testproject --platform Android
11-
- unity-downloader-cli -u 2021.2 -c editor -c Android -w --fast
17+
- unity-downloader-cli -u {{ editor }} -c editor -c Android -w --fast
1218
- |
1319
set UTR_VERSION=0.12.0
14-
utr.bat --artifacts_path=artifacts --timeout=1800 --testproject=testproject --editor-location=.Editor --suite=playmode --platform=android --build-only --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --testfilter=Unity.Netcode.RuntimeTests
20+
utr.bat --artifacts_path=artifacts --timeout=1800 --testproject={{ project.name }} --editor-location=.Editor --suite=playmode --platform=android --build-only --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --testfilter=Unity.Netcode.RuntimeTests
1521
artifacts:
1622
logs:
1723
paths:
@@ -28,20 +34,27 @@
2834
variables:
2935
CI: true
3036
ENABLE_BURST_COMPILATION: False
37+
{% endfor -%}
38+
{% endif -%}
39+
{% endfor -%}
40+
3141

32-
2021.2_Build_iOS_player:
33-
name: 2021.2 Build iOS player
42+
{% for project in projects -%}
43+
{% if project.name == "testproject" -%}
44+
{% for editor in project.test_editors -%}
45+
build_{{ project.name }}_tests_{{ editor }}_iOS:
46+
name: Build {{ project.name }} Tests - {{ editor }} - iOS
3447
agent:
3548
type: Unity::VM::osx
36-
image: mobile/macos-10.15-testing:stable
49+
image: mobile/ios-macos-11:stable
3750
flavor: b1.large
3851
commands:
3952
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
40-
- unity-downloader-cli -u 2021.2 -c editor -c iOS -w --fast
53+
- unity-downloader-cli -u {{ editor }} -c editor -c iOS -w --fast
4154
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
4255
- chmod +x ./utr
4356
- export UTR_VERSION=0.12.0
44-
- ./utr --artifacts_path=artifacts --timeout=1800 --testproject=testproject --editor-location=.Editor --suite=playmode --platform=iOS --build-only --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --testfilter=Unity.Netcode.RuntimeTests
57+
- ./utr --artifacts_path=artifacts --timeout=1800 --testproject={{ project.name }} --editor-location=.Editor --suite=playmode --platform=iOS --build-only --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --testfilter=Unity.Netcode.RuntimeTests
4558
artifacts:
4659
logs:
4760
paths:
@@ -55,26 +68,32 @@
5568
- build/test-results/**
5669
- artifacts/**
5770
- build/players/**
71+
{% endfor -%}
72+
{% endif -%}
73+
{% endfor -%}
5874

5975

60-
2021.2_Run_iOS_Player_With_Tests:
61-
name: 2021.2 Run iOS player with tests
76+
{% for project in projects -%}
77+
{% if project.name == "testproject" -%}
78+
{% for editor in project.test_editors -%}
79+
run_{{ project.name }}_tests_{{ editor }}_iOS:
80+
name: Run {{ project.name }} Tests - {{ editor }} - iOS
6281
agent:
6382
type: Unity::mobile::iPhone
6483
model: SE
65-
image: mobile/macos-10.15-testing:stable
84+
image: mobile/ios-macos-11:stable
6685
flavor: b1.medium
6786
# Set a dependency on the build job
6887
dependencies:
69-
- .yamato/mobile-build-and-test.yml#2021.2_Build_iOS_player
88+
- .yamato/mobile-build-and-test.yml#build_{{ project.name }}_tests_{{ editor }}_iOS
7089
commands:
7190
# Download standalone UnityTestRunner
7291
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
7392
# Give UTR execution permissions
7493
- chmod +x ./utr
7594
# Run the test build on the device
7695
- export UTR_VERSION=0.12.0
77-
- ./utr -artifacts_path=artifacts --testproject=testproject --editor-location=.Editor --reruncount=2 --suite=playmode --platform=iOS --player-load-path=build/players --testfilter=Unity.Netcode.RuntimeTests
96+
- ./utr -artifacts_path=artifacts --testproject={{ project.name }} --editor-location=.Editor --reruncount=2 --suite=playmode --platform=iOS --player-load-path=build/players --testfilter=Unity.Netcode.RuntimeTests
7897
artifacts:
7998
logs:
8099
paths:
@@ -88,9 +107,16 @@
88107
- build/test-results/**
89108
- artifacts/**
90109
- build/players/**
110+
{% endfor -%}
111+
{% endif -%}
112+
{% endfor -%}
113+
91114

92-
2021.2_Run_Android_Player_With_Tests:
93-
name: 2021.2 Run Android player with tests
115+
{% for project in projects -%}
116+
{% if project.name == "testproject" -%}
117+
{% for editor in project.test_editors -%}
118+
run_{{ project.name }}_tests_{{ editor }}_android:
119+
name: Run {{ project.name }} Tests - {{ editor }} - Android
94120
agent:
95121
type: Unity::mobile::shield
96122
image: mobile/android-execution-r19:stable
@@ -99,15 +125,15 @@
99125
skip_checkout: true
100126
# Set a dependency on the build job
101127
dependencies:
102-
- .yamato/mobile-build-and-test.yml#2021.2_Build_Android_player
128+
- .yamato/mobile-build-and-test.yml#build_{{ project.name }}_tests_{{ editor }}_android
103129
commands:
104130
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
105131
- |
106132
set ANDROID_DEVICE_CONNECTION=%BOKKEN_DEVICE_IP%
107133
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
108134
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe devices
109135
set UTR_VERSION=0.12.0
110-
./utr --artifacts_path=artifacts --testproject=testproject --editor-location=.Editor --reruncount=2 --suite=playmode --platform=android --player-connection-ip=%BOKKEN_HOST_IP% --player-load-path=build/players --testfilter=Unity.Netcode.RuntimeTests
136+
./utr --artifacts_path=artifacts --testproject={{ project.name }} --editor-location=.Editor --reruncount=2 --suite=playmode --platform=android --player-connection-ip=%BOKKEN_HOST_IP% --player-load-path=build/players --testfilter=Unity.Netcode.RuntimeTests
111137
# Set uploadable artifact paths
112138
artifacts:
113139
logs:
@@ -122,3 +148,6 @@
122148
- build/test-results/**
123149
- artifacts/**
124150
- build/players/**
151+
{% endfor -%}
152+
{% endif -%}
153+
{% endfor -%}

.yamato/project.metafile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
validation_editor: 2020.3
2+
mobile_validation_editor: 2021.3
23

34
# Platforms that will be tested. The first entry in this array will also
45
# be used for validation

0 commit comments

Comments
 (0)