Skip to content

test: create job definitions for mobile build and test #1152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .yamato/mobile-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
2021.2_Build_Android_player:
name: 2021.2 Build Android player
agent:
type: Unity::VM
image: package-ci/win10:stable
flavor: b1.large
commands:
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
- |
mkdir C:\TMP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't there a suggestion to use macos in order to avoid this tmp path issue? Did that not end up working out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrews-unity had pointed this weirdness out. The issue goes like this: Android is built on Windows, Windows has path length issues so the default Editor location results in unreadable paths. The suggestion was "don't use Windows" and when I explored Mac and Linux I got feedback from various folks to not use Mac as it was a scarce resource and not to use Linux as most configs for android are set up on Windows and Linux hasn't been set up so there will probably be the need for a custom bokken image for that. So I'm back to the TMP dir on Windows.
I'm not familiar with how to use macros to circumvent this, but it would be great if we could. I just ran around in circles for a while and gave up. @JesseOlmer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also mentioned to using the mobile image :P

https://github.cds.internal.unity3d.com/unity/com.unity.transport/blob/master/.yamato/mobile-playmode-tests.yml#L6

This is how we are doing it on UTP and we use a windows image to build for android. This is also the same setup that dots is using to build their android player and their folder depth is way longer than ours.

cd C:\TMP
unity-downloader-cli -u 2021.2 -c editor -c Android -w --fast
- |
set UTR_VERSION=0.12.0
utr.bat --suite=playmode --platform=Android --editor-location=C:\TMP\.Editor --testproject=testproject --player-save-path=build/players --artifacts_path=build/logs --scripting-backend=il2cpp --build-only --testfilter=Unity.Netcode.RuntimeTests --extra-editor-arg=-nographics --timeout=1800 --extra-editor-arg=-batchmode --reruncount=2
artifacts:
players:
paths:
- "build/players/**"
logs:
paths:
- "build/logs/**"

2021.2_Build_iOS_player:
name: 2021.2 Build iOS player
agent:
type: Unity::VM::osx
image: mobile/macos-10.15-testing:stable
flavor: b1.large
commands:
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
- unity-downloader-cli -u 2021.2 -c editor -c iOS -w --fast
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
- chmod +x ./utr
- export UTR_VERSION=0.12.0
- ./utr --suite=playmode --platform=iOS --editor-location=.Editor --testproject=testproject --player-save-path=build/players --artifacts_path=build/logs --build-only --testfilter=Unity.Netcode.RuntimeTests
artifacts:
players:
paths:
- "build/players/**"
logs:
paths:
- "build/logs/**"


2021.2_Run_iOS_Player_With_Tests:
name: 2021.2 Run iOS player with tests
agent:
type: Unity::mobile::iPhone
model: SE
image: mobile/macos-10.15-testing:stable
flavor: b1.medium
# Set a dependency on the build job
dependencies:
- .yamato/mobile-build-and-test.yml#2021.2_Build_iOS_player
commands:
# Download standalone UnityTestRunner
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
# Give UTR execution permissions
- chmod +x ./utr
# Run the test build on the device
- export UTR_VERSION=0.12.0
- ./utr --suite=playmode --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results --testfilter=Unity.Netcode.RuntimeTests
artifacts:
logs:
paths:
- "build/test-results/**"

2021.2_Run_Android_Player_With_Tests:
name: 2021.2 Run Android player with tests
agent:
type: Unity::mobile::shield
image: mobile/android-execution-r19:stable
flavor: b1.medium
# Skip repository cloning
skip_checkout: true
# Set a dependency on the build job
dependencies:
- .yamato/mobile-build-and-test.yml#2021.2_Build_Android_player
commands:
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
- |
set ANDROID_DEVICE_CONNECTION=%BOKKEN_DEVICE_IP%
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe devices
set UTR_VERSION=0.12.0
./utr --suite=playmode --platform=android --player-load-path=build/players --artifacts_path=build/test-results --testfilter=Unity.Netcode.RuntimeTests
# Set uploadable artifact paths
artifacts:
logs:
paths:
- "build/test-results/**"