From 16dcdbc7da3b3aa8fe40998fb795511e5906e24a Mon Sep 17 00:00:00 2001 From: Yossi Rizgan Date: Mon, 22 Jul 2019 23:12:08 +0300 Subject: [PATCH 1/4] unity CI POC with genymotion --- .gitignore | 1 + Dockerfile | 11 +++++ Kin Unity/Assets/Kin/Editor/PostProcessor.cs | 4 +- .../ProjectSettings/ProjectSettings.asset | 23 ++-------- Unity_license.ulf.enc | Bin 0 -> 2512 bytes scripts/ci_run_docker.sh | 11 +++++ scripts/ci_run_test.sh | 42 ++++++++++++++++++ travis.yml | 14 ++++++ unity3d.alf | 1 + 9 files changed, 87 insertions(+), 20 deletions(-) create mode 100644 Dockerfile create mode 100644 Unity_license.ulf.enc create mode 100755 scripts/ci_run_docker.sh create mode 100755 scripts/ci_run_test.sh create mode 100644 travis.yml create mode 100644 unity3d.alf diff --git a/.gitignore b/.gitignore index d247157..06b5e34 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ Kin Android/.gradle Kin Android/build Kin Unity/.gradle Kin Unity/Logs +Unity_license.ulf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..97d396a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM gableroux/unity3d:2018.3.14f1-android +# install android sdk +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" +RUN export PATH="/opt/android-sdk-linux/platform-tools/:$PATH" +# install genymotion cloud tool gmsaas +# first install pip3 +RUN apt-get update -y && apt-get install -y python3-pip +# install gmsaas +RUN pip3 install gmsaas +RUN gmsaas config set android-sdk-path /opt/android-sdk-linux/ \ No newline at end of file diff --git a/Kin Unity/Assets/Kin/Editor/PostProcessor.cs b/Kin Unity/Assets/Kin/Editor/PostProcessor.cs index dac144d..1836d87 100644 --- a/Kin Unity/Assets/Kin/Editor/PostProcessor.cs +++ b/Kin Unity/Assets/Kin/Editor/PostProcessor.cs @@ -1,4 +1,5 @@ -using UnityEngine; +#if UNITY_IOS +using UnityEngine; using UnityEditor; using UnityEditor.Callbacks; using UnityEditor.iOS.Xcode; @@ -58,3 +59,4 @@ public static void OnPostProcessBuild( BuildTarget buildTarget, string buildPath } } } +#endif \ No newline at end of file diff --git a/Kin Unity/ProjectSettings/ProjectSettings.asset b/Kin Unity/ProjectSettings/ProjectSettings.asset index c2323f8..6068c90 100644 --- a/Kin Unity/ProjectSettings/ProjectSettings.asset +++ b/Kin Unity/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 16 + serializedVersion: 15 productGUID: 8a65fec08cc234624aafd06df2b2ea24 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -125,6 +125,7 @@ PlayerSettings: m_HolographicPauseOnTrackingLoss: 1 xboxOneDisableKinectGpuReservation: 0 xboxOneEnable7thCore: 0 + isWsaHolographicRemotingEnabled: 0 vrSettings: cardboard: depthFormat: 0 @@ -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 @@ -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: [] @@ -264,7 +254,6 @@ PlayerSettings: AndroidEnableTango: 0 androidEnableBanner: 1 androidUseLowAccuracyLocation: 0 - androidUseCustomKeystore: 0 m_AndroidBanners: - width: 320 height: 180 @@ -468,7 +457,6 @@ PlayerSettings: m_BuildTargetEnableVuforiaSettings: [] openGLRequireES31: 0 openGLRequireES31AEP: 0 - openGLRequireES32: 0 m_TemplateCustomTags: {} mobileMTRendering: Android: 1 @@ -652,7 +640,6 @@ PlayerSettings: ps4DownloadDataSize: 0 ps4GarlicHeapSize: 2048 ps4ProGarlicHeapSize: 2560 - playerPrefsMaxSize: 32768 ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ ps4pnSessions: 1 ps4pnPresence: 1 @@ -700,7 +687,6 @@ PlayerSettings: webGLCompressionFormat: 1 webGLLinkerTarget: 1 webGLThreadsSupport: 0 - webGLWasmStreaming: 0 scriptingDefineSymbols: {} platformArchitecture: {} scriptingBackend: {} @@ -710,8 +696,6 @@ PlayerSettings: allowUnsafeCode: 0 additionalIl2CppArgs: scriptingRuntimeVersion: 0 - gcIncremental: 0 - gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: {} m_RenderingPath: 1 m_MobileRenderingPath: 1 @@ -742,6 +726,7 @@ PlayerSettings: metroFTAName: metroFTAFileTypes: [] metroProtocolName: + metroCompilationOverrides: 1 XboxOneProductId: XboxOneUpdateKey: XboxOneSandboxId: @@ -780,7 +765,7 @@ PlayerSettings: m_PortalFolderPath: luminCert: m_CertPath: - m_SignPackage: 1 + m_PrivateKeyPath: luminIsChannelApp: 0 luminVersion: m_VersionCode: 1 diff --git a/Unity_license.ulf.enc b/Unity_license.ulf.enc new file mode 100644 index 0000000000000000000000000000000000000000..b83f5a078f4d9a5c1723d5d2675898a302a0abc8 GIT binary patch literal 2512 zcmV;>2`}~sZc@&wk7vVr{A&`*i7F26oEM1ez_zZc>evR;3c)nY3sn=05x^`ekzAJ8FRu^7QY-!ioFI14@XBrj_5OQeuEYO(eodp;f8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 index 0000000..30e1fae --- /dev/null +++ b/scripts/ci_run_docker.sh @@ -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" \ No newline at end of file diff --git a/scripts/ci_run_test.sh b/scripts/ci_run_test.sh new file mode 100755 index 0000000..ef807a5 --- /dev/null +++ b/scripts/ci_run_test.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -x + +TEST_RESULT_FILE="/root/project/test_results.xml" + +# copy unity license file +mkdir /root/.local/share/unity3d/Unity +cp /root/project/Unity_license.ulf /root/.local/share/unity3d/Unity/Unity_lic.ulf + +# login to gmsaas (genymotion tool), and create device instance for tests +gmsaas auth login $GENY_USERNAME "$GENY_PASSWORD" +instance_id=$(gmsaas instances start 107d757e-463a-4a18-8667-b8dec6e4c87e ci_test) +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]+') +# use it +adb -s "localhost:$adb_port" forward "tcp:34999" "localabstract:Unity-com.UnityTestRunner.UnityTestRunner" + +# 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 + +cat $TEST_RESULT_FILE |grep test-run | grep "result=" +gmsaas instances stop $instance_id +exit $UNITY_EXIT_CODE \ No newline at end of file diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..2778d23 --- /dev/null +++ b/travis.yml @@ -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 + diff --git a/unity3d.alf b/unity3d.alf new file mode 100644 index 0000000..d60fd98 --- /dev/null +++ b/unity3d.alf @@ -0,0 +1 @@ +en(unset)Linux 4.9 Ubuntu 18.04 64bit409Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz3500221999d937b4488cc1PC2018.3.14f16.x \ No newline at end of file From f1b7606f5c11f4360550f458312cb7b527b3be93 Mon Sep 17 00:00:00 2001 From: Yossi Rizgan Date: Tue, 23 Jul 2019 08:07:00 +0300 Subject: [PATCH 2/4] rename travis file to the correct name --- travis.yml => .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename travis.yml => .travis.yml (100%) diff --git a/travis.yml b/.travis.yml similarity index 100% rename from travis.yml rename to .travis.yml From 69b07c7c9c5703e8c490ac6608adb49c181adbfd Mon Sep 17 00:00:00 2001 From: Yossi Rizgan Date: Tue, 23 Jul 2019 08:25:05 +0300 Subject: [PATCH 3/4] remove unnessacery file --- unity3d.alf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 unity3d.alf diff --git a/unity3d.alf b/unity3d.alf deleted file mode 100644 index d60fd98..0000000 --- a/unity3d.alf +++ /dev/null @@ -1 +0,0 @@ -en(unset)Linux 4.9 Ubuntu 18.04 64bit409Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz3500221999d937b4488cc1PC2018.3.14f16.x \ No newline at end of file From 338418bd9f6c5fad5a0cd1f8b4751be39f607a38 Mon Sep 17 00:00:00 2001 From: Yossi Rizgan Date: Thu, 25 Jul 2019 13:21:13 +0300 Subject: [PATCH 4/4] CR fixes --- Dockerfile | 18 +++++++++--------- scripts/ci_run_test.sh | 13 +++++++++---- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 97d396a..2d4cccc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM gableroux/unity3d:2018.3.14f1-android -# install android sdk + 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" -RUN export PATH="/opt/android-sdk-linux/platform-tools/:$PATH" -# install genymotion cloud tool gmsaas -# first install pip3 -RUN apt-get update -y && apt-get install -y python3-pip -# install gmsaas -RUN pip3 install gmsaas -RUN gmsaas config set android-sdk-path /opt/android-sdk-linux/ \ No newline at end of file + && /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/ \ No newline at end of file diff --git a/scripts/ci_run_test.sh b/scripts/ci_run_test.sh index ef807a5..b3773b2 100755 --- a/scripts/ci_run_test.sh +++ b/scripts/ci_run_test.sh @@ -2,19 +2,24 @@ 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 -# login to gmsaas (genymotion tool), and create device instance for tests +# login to gmsaas (genymotion tool) gmsaas auth login $GENY_USERNAME "$GENY_PASSWORD" -instance_id=$(gmsaas instances start 107d757e-463a-4a18-8667-b8dec6e4c87e ci_test) +# 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]+') -# use it +# 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" # run unity test with remote device (use xvfb to create required virtual screen) @@ -37,6 +42,6 @@ else cat $TEST_RESULT_FILE fi -cat $TEST_RESULT_FILE |grep test-run | grep "result=" +grep test-run $TEST_RESULT_FILE | grep "result=" gmsaas instances stop $instance_id exit $UNITY_EXIT_CODE \ No newline at end of file