This repository was archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
DP-540 - Unity CI Android POC - DO NOT MERGE #19
Open
yosriz
wants to merge
4
commits into
master
Choose a base branch
from
DP-540_unity_ci_android
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ Kin Android/.gradle | |
| Kin Android/build | ||
| Kin Unity/.gradle | ||
| Kin Unity/Logs | ||
| Unity_license.ulf | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| sudo: required | ||
| language: bash | ||
| env: | ||
| global: | ||
| - IMAGE_NAME=yosriz/unity-2018.3.14f1-android-sdk-gmsaas:latest | ||
| services: | ||
| - docker | ||
| before_install: | ||
| - docker pull $IMAGE_NAME | ||
| script: | ||
| # decrypt unity license credentials | ||
| - openssl aes-256-cbc -K $encrypted_2f80d11909ba_key -iv $encrypted_2f80d11909ba_iv -in Unity_license.ulf.enc -out Unity_license.ulf -d | ||
| - scripts/ci_run_docker.sh | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| FROM gableroux/unity3d:2018.3.14f1-android | ||
|
|
||
| RUN touch /root/.android/repositories.cfg \ | ||
| && /opt/android-sdk-linux/tools/bin/sdkmanager --install tools "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "platform-tools" \ | ||
| && export PATH="/opt/android-sdk-linux/platform-tools/:$PATH" \ | ||
| # install genymotion cloud tool gmsaas | ||
| # first install pip3 | ||
| && apt-get update -y && apt-get install -y python3-pip \ | ||
| # install gmsaas | ||
| && pip3 install gmsaas==1.0.0 \ | ||
| && gmsaas config set android-sdk-path /opt/android-sdk-linux/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| set -e #exit on any command failure | ||
| set -x | ||
|
|
||
| docker run -it --rm \ | ||
| -e "GENY_USERNAME=$GENY_USERNAME" \ | ||
| -e "GENY_PASSWORD=$GENY_PASSWORD" \ | ||
| --network=host \ | ||
| -v "$(pwd):/root/project" \ | ||
| $IMAGE_NAME \ | ||
| /bin/bash -c "/root/project/scripts/ci_run_test.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| set -x | ||
|
|
||
| TEST_RESULT_FILE="/root/project/test_results.xml" | ||
| # Google Pixel device with Android 9.0 | ||
| GENY_DEVICE_TEMPLATE_ID="107d757e-463a-4a18-8667-b8dec6e4c87e" | ||
|
|
||
| # copy unity license file | ||
| mkdir /root/.local/share/unity3d/Unity | ||
| cp /root/project/Unity_license.ulf /root/.local/share/unity3d/Unity/Unity_lic.ulf | ||
yosriz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # login to gmsaas (genymotion tool) | ||
| gmsaas auth login $GENY_USERNAME "$GENY_PASSWORD" | ||
| # start the instance | ||
| instance_id=$(gmsaas instances start $GENY_DEVICE_TEMPLATE_ID ci_test) | ||
| # connect insatnce via ADB | ||
| gmsaas instances adbconnect $instance_id | ||
|
|
||
| # extract the port adb is connected to the remote device | ||
| adb_port=$(adb devices |grep localhost: | grep -o -E '[0-9]+') | ||
| # WORKAROUND: expliclty forward adb device port to Unity test runner, from some reason Unity test runner | ||
| # is failed doing that in the build/test process | ||
| adb -s "localhost:$adb_port" forward "tcp:34999" "localabstract:Unity-com.UnityTestRunner.UnityTestRunner" | ||
yosriz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # run unity test with remote device (use xvfb to create required virtual screen) | ||
| ${UNITY_EXECUTABLE:-xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity} \ | ||
| -projectPath /root/project/Kin\ Unity/ \ | ||
| -runTests -buildTarget Android -testPlatform android -logfile \ | ||
| -batchmode -testResults $TEST_RESULT_FILE | ||
| UNITY_EXIT_CODE=$? | ||
|
|
||
| if [ $UNITY_EXIT_CODE -eq 0 ]; then | ||
| echo "Run succeeded, no failures occurred"; | ||
| elif [ $UNITY_EXIT_CODE -eq 2 ]; then | ||
| echo "Run succeeded, some tests failed"; | ||
| cat $TEST_RESULT_FILE | ||
| elif [ $UNITY_EXIT_CODE -eq 3 ]; then | ||
| echo "Run failure (other failure)"; | ||
| cat $TEST_RESULT_FILE | ||
| else | ||
| echo "Unexpected exit code $UNITY_EXIT_CODE"; | ||
| cat $TEST_RESULT_FILE | ||
| fi | ||
|
|
||
| grep test-run $TEST_RESULT_FILE | grep "result=" | ||
| gmsaas instances stop $instance_id | ||
| exit $UNITY_EXIT_CODE | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.