Skip to content

Commit cb4ff5a

Browse files
authored
NEW: Add CI for Android and iOS (#1167).
1 parent d9a70b0 commit cb4ff5a

26 files changed

Lines changed: 301 additions & 10 deletions

.yamato/config.metadata

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ platforms:
3434
flavor: m1.mac
3535
runtime: StandaloneOSX
3636
scripting-backend: Il2Cpp
37-
installscript: unity-downloader-cli -c editor -c StandaloneSupport-IL2CPP -w -u
37+
installscript: unity-downloader-cli -c editor -c StandaloneSupport-IL2CPP -w -u
38+
scripting_backends:
39+
- name: mono
40+
- name: il2cpp

.yamato/upm-ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{% metadata_file .yamato/config.metadata %}
22
---
3+
34
{% for editor in editors %}
45
{% for platform in platforms %}
56
{{ platform.name }}_{{ editor.version }}:
@@ -26,13 +27,115 @@
2627
{% endfor %}
2728
{% endfor %}
2829

30+
{% for editor in editors %}
31+
build_ios_{{ editor.version }}:
32+
name: Build Tests on {{ editor.version }} on ios
33+
agent:
34+
type: Unity::VM::osx
35+
image: mobile/macos-10.13-testing:stable
36+
flavor: b1.large
37+
commands:
38+
- pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple
39+
- unity-downloader-cli -c Editor -c iOS -u {{ editor.version }} --fast
40+
- curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr --output utr
41+
- chmod +x ./utr
42+
- ./utr --suite=playmode --platform=iOS --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --build-only
43+
artifacts:
44+
players:
45+
paths:
46+
- "build/players/**"
47+
logs:
48+
paths:
49+
- "build/logs/**"
50+
51+
run_ios_{{ editor.version }}:
52+
name: Run Tests on {{ editor.version }} on ios
53+
agent:
54+
type: Unity::mobile::iPhone
55+
image: mobile/macos-10.13-testing:stable
56+
flavor: b1.medium
57+
skip_checkout: true
58+
dependencies:
59+
- .yamato/upm-ci.yml#build_ios_{{ editor.version }}
60+
commands:
61+
# Download standalone UnityTestRunner
62+
- curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr --output utr
63+
# Give UTR execution permissions
64+
- chmod +x ./utr
65+
# Run the test build on the device
66+
- ./utr --suite=playmode --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results
67+
artifacts:
68+
logs:
69+
paths:
70+
- "build/test-results/**"
71+
72+
{% for backend in scripting_backends %}
73+
build_android_{{ editor.version }}_{{ backend.name }}:
74+
name: Build Tests on {{ editor.version }} on android {{ backend.name }}
75+
agent:
76+
type: Unity::VM
77+
image: mobile/android-execution-r19:stable
78+
flavor: b1.xlarge
79+
commands:
80+
- pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple
81+
- unity-downloader-cli -c Editor -c Android -u {{ editor.version }} --fast
82+
- curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat --output utr.bat
83+
- ./utr.bat --suite=playmode --platform=Android --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --scripting-backend={{ backend.name }} --build-only
84+
artifacts:
85+
players:
86+
paths:
87+
- "build/players/**"
88+
logs:
89+
paths:
90+
- "build/logs/**"
91+
run_android_{{ editor.version }}_{{ backend.name }}:
92+
name: Run Tests on {{ editor.version }} on android {{ backend.name }}
93+
agent:
94+
type: Unity::mobile::shield
95+
image: mobile/android-execution-r19:stable
96+
flavor: b1.medium
97+
98+
# Skip repository cloning
99+
skip_checkout: true
100+
# Set a dependency on the build job
101+
dependencies:
102+
- .yamato/upm-ci.yml#build_android_{{ editor.version }}_{{ backend.name }}
103+
commands:
104+
- |
105+
# Download standalone UnityTestRunner
106+
curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat --output utr.bat
107+
# Set the IP of the device. In case device gets lost, UTR will try to recconect to ANDROID_DEVICE_CONNECTION
108+
set ANDROID_DEVICE_CONNECTION=%BOKKEN_DEVICE_IP%
109+
# Establish an ADB connection with the device
110+
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
111+
# List the connected devices
112+
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe devices
113+
{% if editor.version != "2020.1" or backend.name == "mono" %} ./utr --suite=playmode --platform=android --player-load-path=build/players --artifacts_path=build/test-results {% else %}echo "2020.1 Android Debug il2cpp has a bug Case 1252614" {%endif%}
114+
after:
115+
- start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
116+
- if not exist build\test-results mkdir build\test-results
117+
- powershell %ANDROID_SDK_ROOT%\platform-tools\adb.exe logcat -d > build/test-results/device_log.txt
118+
# Set uploadable artifact paths
119+
artifacts:
120+
logs:
121+
paths:
122+
- "build/test-results/**"
123+
{% endfor %}
124+
125+
{% endfor %}
126+
127+
29128
all_tests:
30129
name: All Tests
31130
dependencies:
32131
{% for editor in editors %}
33132
{% for platform in platforms %}
34133
- .yamato/upm-ci.yml#{{ platform.name }}_{{ editor.version }}
35134
{% endfor %}
135+
{% for backend in scripting_backends %}
136+
- .yamato/upm-ci.yml#run_android_{{ editor.version }}_{{ backend.name }}
137+
{% endfor %}
138+
- .yamato/upm-ci.yml#run_ios_{{ editor.version }}
36139
{% endfor %}
37140
triggers:
38141
cancel_old_ci: true

AndroidBuildTests.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM Use this script if you don't want to enable script executions on your system
2+
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& .\AndroidBuildTests.ps1"

AndroidBuildTests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$Env:EDITOR_LOCATION = ""
2+
3+
If (!$Env:EDITOR_LOCATION)
4+
{
5+
Write-Output "Please specify Editor path, for ex., C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor or modify this bat file"
6+
$Env:EDITOR_LOCATION = Read-Host -Prompt 'Editor Location'
7+
}
8+
9+
If (!$Env:EDITOR_LOCATION)
10+
{
11+
Write-Output "Invalid editor location, exiting"
12+
exit
13+
}
14+
15+
Write-Output "Editor location is $Env:EDITOR_LOCATION"
16+
17+
Invoke-WebRequest -Uri "https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat" -OutFile "utr.bat"
18+
./utr.bat --suite=playmode --platform=Android --editor-location="$Env:EDITOR_LOCATION" --testproject=F:/Projects/InputSystem --player-save-path=build/players --artifacts_path=build/logs --scripting-backend=il2cpp --build-only

AndroidRunTests.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM Use this script if you don't want to enable script executions on your system
2+
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& .\AndroidRunTests.ps1"

AndroidRunTests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$Env:ANDROID_SDK_ROOT = ""
2+
3+
If (!$Env:ANDROID_SDK_ROOT)
4+
{
5+
Write-Output "Please specify Android SDK Root path, for ex., C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK or modify this bat file"
6+
$Env:ANDROID_SDK_ROOT = Read-Host -Prompt 'Android SDK ROOT'
7+
}
8+
9+
If (!$Env:ANDROID_SDK_ROOT)
10+
{
11+
Write-Output "Invalid ANDROID_SDK_ROOT location, exiting"
12+
exit
13+
}
14+
15+
Write-Output "ANDROID_SDK_ROOT is $Env:ANDROID_SDK_ROOT"
16+
17+
Invoke-WebRequest -Uri "https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat" -OutFile "utr.bat"
18+
./utr.bat --suite=playmode --platform=android --player-load-path=build/players --artifacts_path=build/test-results

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4375,8 +4375,12 @@ public void Actions_CanPickDevicesThatMatchGivenControlScheme()
43754375

43764376
[Test]
43774377
[Category("Actions")]
4378+
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
4379+
[Ignore("Case 1261423 DualShock4GamepadHID is not implemented on Android/iOS")]
4380+
#endif
43784381
public void Actions_CanPickDevicesThatMatchGivenControlScheme_ReturningAccurateScoreForEachMatch()
43794382
{
4383+
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_WSA
43804384
var genericGamepad = InputSystem.AddDevice<Gamepad>();
43814385
var ps4Gamepad = InputSystem.AddDevice<DualShock4GamepadHID>();
43824386
var mouse = InputSystem.AddDevice<Mouse>();
@@ -4416,6 +4420,7 @@ public void Actions_CanPickDevicesThatMatchGivenControlScheme_ReturningAccurateS
44164420
// from the base PS4 gamepad layout.
44174421
Assert.That(ps4ToPS4.score, Is.EqualTo(1 + 0.5f));
44184422
}
4423+
#endif
44194424
}
44204425

44214426
[Test]
@@ -4472,8 +4477,12 @@ public void Actions_CanFindControlSchemeUsingGivenDevice()
44724477

44734478
[Test]
44744479
[Category("Actions")]
4480+
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
4481+
[Ignore("Case 1261423 DualShock4GamepadHID is not implemented on Android/iOS")]
4482+
#endif
44754483
public void Actions_WhenFindingControlSchemeUsingGivenDevice_MostSpecificControlSchemeIsChosen()
44764484
{
4485+
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_WSA
44774486
var genericGamepadScheme = new InputControlScheme("GenericGamepad")
44784487
.WithRequiredDevice("<Gamepad>");
44794488
var ps4GamepadScheme = new InputControlScheme("PS4")
@@ -4493,6 +4502,7 @@ public void Actions_WhenFindingControlSchemeUsingGivenDevice_MostSpecificControl
44934502
Is.EqualTo(ps4GamepadScheme));
44944503
Assert.That(InputControlScheme.FindControlSchemeForDevice(xboxController, new[] { genericGamepadScheme, ps4GamepadScheme, xboxGamepadScheme, mouseScheme }),
44954504
Is.EqualTo(xboxGamepadScheme));
4505+
#endif
44964506
}
44974507

44984508
// The bindings targeting an action can be masked out such that only specific

Assets/Tests/InputSystem/CoreTests_Controls.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,9 @@ public void Controls_DisplayNameForNestedControls_IncludesNameOfParentControl()
10341034

10351035
[Test]
10361036
[Category("Controls")]
1037+
#if UNITY_ANDROID && !UNITY_EDITOR
1038+
[Ignore("Case 1254559")]
1039+
#endif
10371040
public void Controls_CanTurnControlPathIntoHumanReadableText()
10381041
{
10391042
Assert.That(InputControlPath.ToHumanReadableString("*/{PrimaryAction}"), Is.EqualTo("PrimaryAction [Any]"));

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,6 +2602,9 @@ public void Devices_CanGetStartTimeOfTouches()
26022602

26032603
[Test]
26042604
[Category("Devices")]
2605+
#if UNITY_ANDROID && !UNITY_EDITOR
2606+
[Ignore("Case 1254561")]
2607+
#endif
26052608
public void Devices_CanDetectTouchTaps()
26062609
{
26072610
// Give us known tap settings.
@@ -3833,6 +3836,9 @@ public void Devices_WhenFocusIsLost_DevicesAreForciblyReset_AndResetsAreObservab
38333836

38343837
[Test]
38353838
[Category("Devices")]
3839+
#if UNITY_ANDROID && !UNITY_EDITOR
3840+
[Ignore("Case 1254562")]
3841+
#endif
38363842
public unsafe void Devices_WhenFocusIsLost_DevicesAreForciblyReset_ExceptThoseMarkedAsReceivingInputInBackground()
38373843
{
38383844
// TrackedDevice is all noisy controls. We need at least one non-noisy control to fully

Assets/Tests/InputSystem/CoreTests_Editor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,7 @@ public void Editor_LeavingPlayMode_DestroysAllActionStates()
23952395
Assert.That(InputSystem.s_Manager.m_StateChangeMonitors[0].listeners[0].control, Is.Null); // Won't get removed, just cleared.
23962396
}
23972397

2398+
#if UNITY_STANDALONE // CodeDom API not available in most players.
23982399
[Test]
23992400
[Category("Editor")]
24002401
[TestCase("Mouse", typeof(Mouse))]
@@ -2582,6 +2583,8 @@ internal static Type Compile(string code, string typeName, string options = null
25822583
return type;
25832584
}
25842585

2586+
#endif
2587+
25852588
[Test]
25862589
[Category("Editor")]
25872590
public void Editor_CanRestartEditorThroughReflection()

0 commit comments

Comments
 (0)