Skip to content

Commit 1c75fdf

Browse files
authored
feat!: add Windows Executor and Windows Runner support (#11)
* feat: add runner * refactor: extract the windows runner logic * refactor: extract linux build logic * feat: add OS detection to all commands * refactor: extract prepare env scripts * refactor: change file name * fix: add build name and target as env vars in the container * refactor: remove unecessary params and steps * feat: add cache to runner * feat: add runner executor * chore: change parameter naming from dash to underscore * feat: add windows executors * ci: add tests for all supported platforms without runner * ci: add test job * feat: add test job support for windows * refactor: estabilish container name in prepare-env * feat: extract serial from license file * docs: improve parameters description * fix: replace saxon-b source url * chore: update examples * test: add test builds for several platforms * fix: exit with proper exit code when something fails * ci: remove unsupported tests * chore: add version comment to the windows build command
1 parent 0d18090 commit 1c75fdf

28 files changed

+1392
-385
lines changed

.circleci/test-deploy.yml

+342-33
Large diffs are not rendered by default.

src/@orb.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ description: >
55
Supports Linux x86_64.
66
77
display:
8-
home_url: "https://game.ci/docs"
8+
home_url: "https://game.ci/docs/"
99
source_url: "https://github.com/game-ci/unity-orb"

src/commands/build.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ parameters:
4242
If left to "false" for decompressed WebGL builds, the built project can be run directly from the GameCI dashboard.
4343
4444
steps:
45-
- restore_cache:
46-
keys:
47-
- unity-deps-{{ arch }}-<< parameters.cache-version >>-<<# parameters.include-branch-in-cache-key >>{{ .Branch }}-<</ parameters.include-branch-in-cache-key >>{{ checksum "<< parameters.project-path >>/Packages/packages-lock.json" }}
48-
- unity-deps-{{ arch }}-<< parameters.cache-version >>-<<# parameters.include-branch-in-cache-key >>{{ .Branch }}<</ parameters.include-branch-in-cache-key >>
4945
- run:
5046
name: << parameters.step-name >>
5147
environment:
5248
PARAM_BUILD_NAME: << parameters.build-name >>
5349
PARAM_BUILD_TARGET: << parameters.build-target >>
5450
PARAM_PROJECT_PATH: << parameters.project-path >>
5551
PARAM_COMPRESS: << parameters.compress >>
52+
SCRIPT_BUILD_WINDOWS: << include(scripts/windows/build.sh) >>
53+
SCRIPT_BUILD_LINUX: << include(scripts/linux/build.sh) >>
5654
command: << include(scripts/build.sh) >>
5755
- save_cache:
5856
key: unity-deps-{{ arch }}-<< parameters.cache-version >>-<<# parameters.include-branch-in-cache-key >>{{ .Branch }}-<</ parameters.include-branch-in-cache-key >>{{ checksum "<< parameters.project-path >>/Packages/packages-lock.json" }}

src/commands/prepare-env.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,36 @@ parameters:
77
default: "UNITY_USERNAME"
88
description: |
99
Enter the name of the environment variable containing your Unity username.
10-
This is only necessary if you have a Plus or Pro license.
10+
Required if you have a Plus or Pro license or are using the Windows or Windows Runner executor.
1111
unity-password-var-name:
1212
type: env_var_name
1313
default: "UNITY_PASSWORD"
1414
description: |
1515
Enter the name of the environment variable containing your Unity password.
16-
This is only necessary if you have a Plus or Pro license.
16+
Required if you have a Plus or Pro license or are using the Windows or Windows Runner executor.
1717
unity-serial-var-name:
1818
type: env_var_name
1919
default: "UNITY_SERIAL"
2020
description: |
2121
Enter the name of the environment variable containing your Unity serial number.
22-
This is only necessary if you have a Plus or Pro license.
22+
Required if you have a Plus or Pro license.
2323
unity-license-var-name:
2424
type: env_var_name
2525
default: "UNITY_ENCODED_LICENSE"
2626
description: |
2727
Enter the name of the environment variable containing your Unity license file encoded in base64.
2828
A different license must be provided for every Unity major version.
29-
This is only necessary if you have a Personal license.
29+
Required if you have a Personal license.
30+
cache-version:
31+
type: string
32+
default: "v1"
33+
description: |
34+
Change the default cache version if you need to clear the cache for any reason.
35+
include-branch-in-cache-key:
36+
type: boolean
37+
default: true
38+
description: >
39+
If true, this cache bucket will only apply to jobs within the same branch.
3040
project-path:
3141
type: string
3242
default: "."
@@ -35,6 +45,13 @@ parameters:
3545
This should be the directory that has an "Assets" folder inside it.
3646
3747
steps:
48+
- run:
49+
name: "Detect OS"
50+
command: << include(scripts/detect-os.sh) >>
51+
- restore_cache:
52+
keys:
53+
- unity-deps-{{ arch }}-<< parameters.cache-version >>-<<# parameters.include-branch-in-cache-key >>{{ .Branch }}-<</ parameters.include-branch-in-cache-key >>{{ checksum "<< parameters.project-path >>/Packages/packages-lock.json" }}
54+
- unity-deps-{{ arch }}-<< parameters.cache-version >>-<<# parameters.include-branch-in-cache-key >>{{ .Branch }}<</ parameters.include-branch-in-cache-key >>
3855
- run:
3956
name: Prepare the environment
4057
environment:
@@ -43,4 +60,6 @@ steps:
4360
PARAM_UNITY_SERIAL_VAR_NAME: << parameters.unity-serial-var-name >>
4461
PARAM_UNITY_LICENSE_VAR_NAME: << parameters.unity-license-var-name >>
4562
PARAM_PROJECT_PATH: << parameters.project-path >>
63+
SCRIPT_PREPARE_ENV_LINUX: << include(scripts/linux/prepare-env.sh) >>
64+
SCRIPT_PREPARE_ENV_WINDOWS: << include(scripts/windows/prepare-env.sh) >>
4665
command: << include(scripts/prepare-env.sh) >>

src/commands/test.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ parameters:
3232
If true, this cache bucket will only apply to jobs within the same branch.
3333
3434
steps:
35-
- restore_cache:
36-
keys:
37-
- unity-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>{{ checksum "<<parameters.project-path>>/Packages/packages-lock.json" }}
38-
- unity-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}<</parameters.include-branch-in-cache-key>>
3935
- run:
4036
name: << parameters.step-name >>
4137
environment:
4238
PARAM_PROJECT_PATH: << parameters.project-path >>
4339
PARAM_TEST_PLATFORM: << parameters.test-platform >>
40+
SCRIPT_TEST_LINUX: << include(scripts/linux/test.sh) >>
41+
SCRIPT_TEST_WINDOWS: << include(scripts/windows/test.sh) >>
4442
command: << include(scripts/test.sh) >>
4543
- save_cache:
4644
key: unity-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>{{ checksum "<<parameters.project-path>>/Packages/packages-lock.json" }}
+180-21
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,210 @@
11
description: >
2-
Drop-in solution to automatically run tests and build your Unity project.
2+
Drop-in solution to automatically run tests and build your Unity project using a Personal license.
33
44
usage:
55
version: 2.1
66

77
orbs:
8-
unity: game-ci/unity@1.0.0
8+
unity: game-ci/unity@0.2.0
99

1010
workflows:
11-
test-build:
11+
test-build-with-executors:
1212
jobs:
13+
- checkout
1314
- unity/test:
15+
name: "test-linux"
16+
step-name: "Run tests on Linux"
1417
unity-license-var-name: "UNITY_ENCODED_LICENSE"
15-
test-platform: "playmode"
1618
executor:
17-
name: "unity/ubuntu-2021"
18-
target-platform: "linux-il2cpp"
19+
name: "unity/ubuntu"
20+
target_platform: "linux-il2cpp"
21+
editor_version: "2021.3.1f1"
22+
resource_class: "medium"
23+
project-path: "Unity2D-Demo-Game-CI-CD/src"
24+
test-platform: "playmode"
1925
context: unity-orb # context with the UNITY_ENCODED_LICENSE variable
26+
- unity/test:
27+
name: "test-windows"
28+
step-name: "Run tests on Windows"
29+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
30+
unity-username-var-name: "UNITY_USERNAME"
31+
unity-password-var-name: "UNITY_PASSWORD"
32+
executor:
33+
name: "unity/windows-2019"
34+
size: "large"
35+
editor_version: "2021.3.2f1"
36+
target_platform: "windows-il2cpp"
37+
project-path: "Unity2D-Demo-Game-CI-CD/src"
38+
test-platform: "playmode"
39+
context: unity-orb # context with the UNITY_USERNAME, UNITY_PASSWORD and UNITY_ENCODED_LICENSE variable
2040
- unity/build:
21-
name: "build-linux64"
41+
name: "build-linux64-il2cpp"
42+
step-name: "Build StandaloneLinux64 using IL2CPP"
2243
unity-license-var-name: "UNITY_ENCODED_LICENSE"
44+
executor:
45+
name: "unity/ubuntu"
46+
target_platform: "linux-il2cpp"
47+
editor_version: "2021.3.1f1"
48+
resource_class: "large"
49+
project-path: "Unity2D-Demo-Game-CI-CD/src"
2350
build-target: StandaloneLinux64
2451
compress: true
52+
requires:
53+
- test-linux
54+
context: unity-orb
55+
- unity/build:
56+
name: "build-windows64-il2cpp"
57+
step-name: "Build StandaloneWindows64 using IL2CPP"
58+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
59+
unity-username-var-name: "UNITY_USERNAME"
60+
unity-password-var-name: "UNITY_PASSWORD"
2561
executor:
26-
name: "unity/ubuntu-2021"
27-
target-platform: "linux-il2cpp"
62+
name: "unity/windows-2019"
63+
size: "large"
64+
editor_version: "2021.3.2f1"
65+
target_platform: "windows-il2cpp"
66+
project-path: "Unity2D-Demo-Game-CI-CD/src"
67+
build-target: StandaloneWindows64
68+
compress: true
2869
requires:
29-
- test
30-
context: unity-orb # context with the UNITY_ENCODED_LICENSE variable
70+
- test-windows
71+
context: unity-orb
72+
- unity/build:
73+
name: "build-windows64-il2cpp-cuda"
74+
step-name: "Build StandaloneWindows64 using IL2CPP and CUDA executor"
75+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
76+
unity-username-var-name: "UNITY_USERNAME"
77+
unity-password-var-name: "UNITY_PASSWORD"
78+
executor:
79+
name: "unity/windows-2019-cuda"
80+
size: "medium"
81+
editor_version: "2021.3.2f1"
82+
target_platform: "windows-il2cpp"
83+
project-path: "Unity2D-Demo-Game-CI-CD/src"
84+
build-target: StandaloneWindows64
85+
compress: true
86+
requires:
87+
- test-windows
88+
context: unity-orb
89+
- unity/build:
90+
name: "build-linux64-mono"
91+
step-name: "Build StandaloneLinux64 using Mono"
92+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
93+
executor:
94+
name: "unity/ubuntu"
95+
target_platform: "base"
96+
editor_version: "2021.3.1f1"
97+
resource_class: "large"
98+
project-path: "Unity2D-Demo-Game-CI-CD/src"
99+
build-target: StandaloneLinux64
100+
compress: true
101+
requires:
102+
- test-linux
103+
context: unity-orb
31104
- unity/build:
105+
name: "build-windows64-mono"
106+
step-name: "Build StandaloneWindows64 using Mono"
107+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
108+
executor:
109+
name: "unity/ubuntu"
110+
target_platform: "windows-mono"
111+
editor_version: "2021.3.2f1"
112+
resource_class: "large"
113+
project-path: "Unity2D-Demo-Game-CI-CD/src"
114+
build-target: "StandaloneWindows64"
115+
requires:
116+
- test-linux
117+
context: unity-orb
118+
- unity/build:
119+
name: "build-osx-mono"
120+
step-name: "Build StandaloneOSX using Mono"
121+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
122+
executor:
123+
name: "unity/ubuntu"
124+
target_platform: "mac-mono"
125+
editor_version: "2021.3.2f1"
126+
resource_class: "large"
127+
project-path: "Unity2D-Demo-Game-CI-CD/src"
128+
build-target: "StandaloneOSX"
129+
requires:
130+
- test-linux
131+
context: unity-orb
132+
- build:
32133
name: "build-webgl"
134+
step-name: "Build WebGL"
33135
unity-license-var-name: "UNITY_ENCODED_LICENSE"
136+
executor:
137+
name: "unity/ubuntu"
138+
target_platform: "webgl"
139+
editor_version: "2021.3.1f1"
140+
resource_class: "large"
141+
project-path: "Unity2D-Demo-Game-CI-CD/src"
34142
build-target: "WebGL"
35143
compress: false
144+
requires:
145+
- test-linux
146+
context: unity-orb
147+
- build:
148+
name: "build-android"
149+
step-name: "Build Android"
150+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
36151
executor:
37-
name: "unity/ubuntu-2021"
38-
target-platform: "webgl"
152+
name: "unity/ubuntu"
153+
target_platform: "android"
154+
editor_version: "2021.3.2f1"
155+
resource_class: "large"
156+
project-path: "Unity2D-Demo-Game-CI-CD/src"
157+
build-target: "Android"
39158
requires:
40-
- test
41-
context: unity-orb # context with the UNITY_ENCODED_LICENSE variable
159+
- test-linux
160+
context: unity-orb
161+
- build:
162+
name: "build-ios"
163+
step-name: "Build iOS"
164+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
165+
executor:
166+
name: "unity/ubuntu"
167+
target_platform: "ios"
168+
editor_version: "2021.3.2f1"
169+
resource_class: "large"
170+
project-path: "Unity2D-Demo-Game-CI-CD/src"
171+
build-target: "iOS"
172+
requires:
173+
- test-linux
174+
context: unity-orb
175+
test-build-with-windows-runner:
176+
jobs:
177+
- checkout
178+
- unity/test:
179+
name: "test-windows"
180+
step-name: "Run tests on Windows"
181+
unity-license-var-name: "UNITY_ENCODED_LICENSE"
182+
unity-username-var-name: "UNITY_USERNAME"
183+
unity-password-var-name: "UNITY_PASSWORD"
184+
executor:
185+
name: "unity/windows-runner"
186+
resource_class: "namespace/resource-class-label" # can be found at: https://app.circleci.com/runners/github/<< your namespace >>/inventory
187+
working_directory: "C:\\Users\\circleci\\AppData\\Local\\Temp\\Workdir"
188+
editor_version: "2021.3.2f1"
189+
target_platform: "windows-il2cpp"
190+
project-path: "Unity2D-Demo-Game-CI-CD/src"
191+
test-platform: "playmode"
192+
context: unity-orb # context with the UNITY_USERNAME, UNITY_PASSWORD and UNITY_ENCODED_LICENSE variable
42193
- unity/build:
43-
name: "build-windows64"
194+
name: "build-windows64-il2cpp"
195+
step-name: "Build StandaloneWindows64 using IL2CPP"
44196
unity-license-var-name: "UNITY_ENCODED_LICENSE"
45-
build-target: "StandaloneWindows64"
197+
unity-username-var-name: "UNITY_USERNAME"
198+
unity-password-var-name: "UNITY_PASSWORD"
46199
executor:
47-
name: "unity/ubuntu-2021"
48-
target-platform: "windows-mono"
200+
name: "unity/windows-runner"
201+
resource_class: "namespace/resource-class-label" # can be found at: https://app.circleci.com/runners/github/<< your namespace >>/inventory
202+
working_directory: "C:\\Users\\circleci\\AppData\\Local\\Temp\\Workdir"
203+
editor_version: "2021.3.2f1"
204+
target_platform: "windows-il2cpp"
205+
project-path: "Unity2D-Demo-Game-CI-CD/src"
206+
build-target: StandaloneWindows64
207+
compress: true
49208
requires:
50-
- test
51-
context: unity-orb # context with the UNITY_ENCODED_LICENSE variable
209+
- test-windows
210+
context: unity-orb

0 commit comments

Comments
 (0)