Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit f4ee7bb

Browse files
authored
Basic CI (#5)
1 parent 3a1f508 commit f4ee7bb

File tree

4 files changed

+93
-1
lines changed

4 files changed

+93
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ workers/unity/Assets/Plugins/Improbable.meta
4747

4848
# Schema from Unity Package Manager Packages (Copied via tools/CopySchema)
4949
schema/from_gdk_packages
50-
_ReSharper.Caches
50+
_ReSharper.Caches
51+
52+
.shared-ci/

ci/UnityEditorHash.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ae1180820377

ci/bootstrap.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
set -e -u -x -o pipefail
3+
4+
cd "$(dirname "$0")/../"
5+
6+
SHARED_CI_DIR="$(pwd)/.shared-ci"
7+
CLONE_URL="[email protected]:spatialos/gdk-for-unity-shared-ci.git"
8+
9+
# Clone the HEAD of the shared CI repo into ".shared-ci"
10+
11+
if [ -d "${SHARED_CI_DIR}" ]; then
12+
rm -rf "${SHARED_CI_DIR}"
13+
fi
14+
15+
git clone "${CLONE_URL}" "${SHARED_CI_DIR}"
16+
17+
18+
# Clone the GDK for Unity repository
19+
20+
CLONE_URI="[email protected]:spatialos/gdk-for-unity.git"
21+
TARGET_DIRECTORY="$(realpath $(pwd)/../gdk-for-unity)"
22+
PINNED_VERSION=$(cat ./gdk.pinned)
23+
24+
rm -rf "${TARGET_DIRECTORY}"
25+
26+
git clone ${CLONE_URI} "${TARGET_DIRECTORY}"
27+
pushd "${TARGET_DIRECTORY}"
28+
git checkout "${PINNED_VERSION}"
29+
popd

ci/build.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
set -e -u -x -o pipefail
3+
4+
cd "$(dirname "$0")/../"
5+
6+
ci/bootstrap.sh
7+
.shared-ci/scripts/prepare-unity.sh
8+
9+
source .shared-ci/scripts/pinned-tools.sh
10+
source .shared-ci/scripts/profiling.sh
11+
12+
UNITY_PROJECT_DIR="$(pwd)/workers/unity"
13+
14+
# The asset cache ip cannot be hardcoded and so is stored in an environment variable on the build agent.
15+
# This is bash shorthand syntax for if-else predicated on the existance of the environment variable
16+
# where the else branch assigns an empty string.
17+
# i.e. -
18+
# if [ -z ${UNITY_ASSET_CACHE_IP} ]; then
19+
# ASSET_CACHE_ARG="-CacheServerIPAddress ${UNITY_ASSET_CACHE_IP}"
20+
# else
21+
# ASSET_CACHE_ARG=""
22+
# fi
23+
24+
ASSET_CACHE_ARG=${UNITY_ASSET_CACHE_IP:+-CacheServerIPAddress "${UNITY_ASSET_CACHE_IP}"}
25+
26+
markStartOfBlock "$0"
27+
28+
markStartOfBlock "Building UnityClient"
29+
30+
pushd "${UNITY_PROJECT_DIR}"
31+
dotnet run -p ../../.shared-ci/tools/RunUnity/RunUnity.csproj -- \
32+
-projectPath "${UNITY_PROJECT_DIR}" \
33+
-batchmode \
34+
-quit \
35+
-logfile "$(pwd)/../../logs/UnityClientBuild.log" \
36+
-executeMethod "Improbable.Gdk.BuildSystem.WorkerBuilder.Build" \
37+
${ASSET_CACHE_ARG} \
38+
+buildWorkerTypes "UnityClient" \
39+
+buildTarget "cloud"
40+
popd
41+
42+
markEndOfBlock "Building UnityClient"
43+
44+
markStartOfBlock "Building UnityGameLogic"
45+
46+
pushd "${UNITY_PROJECT_DIR}"
47+
dotnet run -p ../../.shared-ci/tools/RunUnity/RunUnity.csproj -- \
48+
-projectPath "${UNITY_PROJECT_DIR}" \
49+
-batchmode \
50+
-quit \
51+
-logfile "$(pwd)/../../logs/UnityGameLogicBuild.log" \
52+
-executeMethod "Improbable.Gdk.BuildSystem.WorkerBuilder.Build" \
53+
${ASSET_CACHE_ARG} \
54+
+buildWorkerTypes "UnityGameLogic" \
55+
+buildTarget "cloud"
56+
popd
57+
58+
markEndOfBlock "Building UnityGameLogic"
59+
60+
markEndOfBlock "$0"

0 commit comments

Comments
 (0)