Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

DP-540 - Unity CI Android POC - DO NOT MERGE #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Kin Android/.gradle
Kin Android/build
Kin Unity/.gradle
Kin Unity/Logs
Unity_license.ulf
14 changes: 14 additions & 0 deletions .travis.yml
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

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM gableroux/unity3d:2018.3.14f1-android
yosriz marked this conversation as resolved.
Show resolved Hide resolved

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/
4 changes: 3 additions & 1 deletion Kin Unity/Assets/Kin/Editor/PostProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
#if UNITY_IOS
yosriz marked this conversation as resolved.
Show resolved Hide resolved
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
Expand Down Expand Up @@ -58,3 +59,4 @@ public static void OnPostProcessBuild( BuildTarget buildTarget, string buildPath
}
}
}
#endif
23 changes: 4 additions & 19 deletions Kin Unity/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 16
serializedVersion: 15
productGUID: 8a65fec08cc234624aafd06df2b2ea24
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
Expand Down Expand Up @@ -125,6 +125,7 @@ PlayerSettings:
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 0
xboxOneEnable7thCore: 0
isWsaHolographicRemotingEnabled: 0
vrSettings:
cardboard:
depthFormat: 0
Expand All @@ -139,17 +140,10 @@ PlayerSettings:
hololens:
depthFormat: 1
depthBufferSharingEnabled: 0
lumin:
depthFormat: 0
frameTiming: 2
enableGLCache: 0
glCacheMaxBlobSize: 524288
glCacheMaxFileSize: 8388608
oculus:
sharedDepthBuffer: 0
dashSupport: 0
enable360StereoCapture: 0
isWsaHolographicRemotingEnabled: 0
protectGraphicsMemory: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
Expand Down Expand Up @@ -201,10 +195,6 @@ PlayerSettings:
iPadHighResPortraitSplashScreen: {fileID: 0}
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
iPhone65inPortraitSplashScreen: {fileID: 0}
iPhone65inLandscapeSplashScreen: {fileID: 0}
iPhone61inPortraitSplashScreen: {fileID: 0}
iPhone61inLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
Expand Down Expand Up @@ -264,7 +254,6 @@ PlayerSettings:
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
m_AndroidBanners:
- width: 320
height: 180
Expand Down Expand Up @@ -468,7 +457,6 @@ PlayerSettings:
m_BuildTargetEnableVuforiaSettings: []
openGLRequireES31: 0
openGLRequireES31AEP: 0
openGLRequireES32: 0
m_TemplateCustomTags: {}
mobileMTRendering:
Android: 1
Expand Down Expand Up @@ -652,7 +640,6 @@ PlayerSettings:
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
playerPrefsMaxSize: 32768
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
Expand Down Expand Up @@ -700,7 +687,6 @@ PlayerSettings:
webGLCompressionFormat: 1
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLWasmStreaming: 0
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend: {}
Expand All @@ -710,8 +696,6 @@ PlayerSettings:
allowUnsafeCode: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 0
gcIncremental: 0
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
Expand Down Expand Up @@ -742,6 +726,7 @@ PlayerSettings:
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
metroCompilationOverrides: 1
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
Expand Down Expand Up @@ -780,7 +765,7 @@ PlayerSettings:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_SignPackage: 1
m_PrivateKeyPath:
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
Expand Down
Binary file added Unity_license.ulf.enc
Binary file not shown.
11 changes: 11 additions & 0 deletions scripts/ci_run_docker.sh
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"
47 changes: 47 additions & 0 deletions scripts/ci_run_test.sh
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