-
Notifications
You must be signed in to change notification settings - Fork 68
/
.gitlab-ci.yml
363 lines (274 loc) · 14 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
variables:
# use the strategy set in the project CI settings GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: none
ErrorActionPreference: stop
PROJECT_NAME: "UltraleapTracking"
PROJECT_PATH: "$CI_PROJECT_DIR"
ENGINE_PATH_UE5_1: "C:/Program Files/Epic Games/UE_5.1"
ENGINE_UAT_PATH_UE5_1: "$ENGINE_PATH_UE5_1/Engine/Build/BatchFiles/RunUAT.bat"
ENGINE_PATH_UE5_3: "C:/Program Files/Epic Games/UE_5.3"
ENGINE_UAT_PATH_UE5_3: "$ENGINE_PATH_UE5_3/Engine/Build/BatchFiles/RunUAT.bat"
ENGINE_PATH_UE5_4: "C:/Program Files/Epic Games/UE_5.4"
ENGINE_UAT_PATH_UE5_4: "$ENGINE_PATH_UE5_4/Engine/Build/BatchFiles/RunUAT.bat"
# this holds the unreal version
UNREAL_ENGINE_BUILD_VERSION_FILE: "$ENGINE_PATH_UE5_1/Engine/Build/Build.version"
UNREAL_ENGINE_BUILD_VERSION_FILE_UE5_4: "$ENGINE_PATH_UE5_4/Engine/Build/Build.version"
UNREAL_ENGINE_BUILD_VERSION_FILE_UE5_3: "$ENGINE_PATH_UE5_3/Engine/Build/Build.version"
VERSIONTRUNC: "Unknown"
stages:
- documentation
- build
- deploy
documentation::generate-tracking-documentation:
stage: documentation
tags:
- unreal
- windows
timeout: 30m
script:
# Generate XML documentation using Doxygen
- echo "Generate docs"
# this uses the presets saved in Doxyfile and outputs to DoxyOutput/xml
- doxygen
after_script:
- $DOXY_LOCATION = "$PROJECT_PATH/DoxyOutput"
- echo "$DOXY_LOCATION"
- mv "$DOXY_LOCATION/*" "$CI_PROJECT_DIR"
artifacts:
name: "Artifacts"
paths:
- "xml"
when: always
expire_in: never
needs: []
build:build-project:
stage: build
tags:
- unreal
- windows
when: always
retry: 2
timeout: 1h
allow_failure: false
script:
# Get Unreal version and changeset from the project. from json
- $UNREAL_VERSION_CONTENT_UE5_1 = Get-Content -Raw -Path $UNREAL_ENGINE_BUILD_VERSION_FILE | ConvertFrom-Json
- $UNREAL_VERSION_UE5_1 = $UNREAL_VERSION_CONTENT_UE5_1.MajorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_1.MinorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_1.PatchVersion.ToString()
- $UNREAL_VERSION_CONTENT_UE5_3 = Get-Content -Raw -Path $UNREAL_ENGINE_BUILD_VERSION_FILE_UE5_3 | ConvertFrom-Json
- $UNREAL_VERSION_UE5_3 = $UNREAL_VERSION_CONTENT_UE5_3.MajorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_3.MinorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_3.PatchVersion.ToString()
- $UNREAL_VERSION_CONTENT_UE5_4 = Get-Content -Raw -Path $UNREAL_ENGINE_BUILD_VERSION_FILE_UE5_4 | ConvertFrom-Json
- $UNREAL_VERSION_UE5_4 = $UNREAL_VERSION_CONTENT_UE5_4.MajorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_4.MinorVersion.ToString() + "." + $UNREAL_VERSION_CONTENT_UE5_4.PatchVersion.ToString()
- echo "$UNREAL_VERSION_UE5_1"
- echo "$UNREAL_VERSION_UE5_3"
- echo "$UNREAL_VERSION_UE5_4"
- echo "$ENGINE_PATH_UE5_1"
- echo "$ENGINE_PATH_UE5_3"
- echo "$ENGINE_PATH_UE5_4"
- echo "$PROJECT_PATH"
- echo "$PROJECT_PATH/$PROJECT_NAME.uplugin"
- echo "$ENGINE_UAT_PATH_UE5_1"
- echo "$ENGINE_UAT_PATH_UE5_3"
- echo "$ENGINE_UAT_PATH_UE5_4"
- echo "Working dir"
- pwd
# Build the project.
- echo "==============================================="
- echo "Build with UAT"
- echo "==============================================="
################################## 5.1
- $UE5_PACKAGE_PATH_1 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_1"
- echo "$UE5_PACKAGE_PATH_1"
# Piped to a log file, remove at the end of this line if you want to see the output during build
- $process = Start-Process -Wait -PassThru -NoNewWindow -FilePath "$ENGINE_UAT_PATH_UE5_1" -ArgumentList "BuildPlugin -Plugin=$PROJECT_PATH/$PROJECT_NAME.uplugin -Package=$UE5_PACKAGE_PATH_1 -CreateSubFolder -VS2019 -TargetPlatforms=Win64+Mac -Rocket > ./$PROJECT_NAME.log"
- echo $process.ExitCode
- if (-not ($process.ExitCode -eq 0)) { exit $process.ExitCode }
- echo "Unreal 5.1 build complete."
################################## 5.3
- $UE5_PACKAGE_PATH_3 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_3"
- echo "$UE5_PACKAGE_PATH_3"
- $process = Start-Process -Wait -PassThru -NoNewWindow -FilePath "$ENGINE_UAT_PATH_UE5_3" -ArgumentList "BuildPlugin -Plugin=$PROJECT_PATH/$PROJECT_NAME.uplugin -Package=$UE5_PACKAGE_PATH_3 -CreateSubFolder -VS2022 -TargetPlatforms=Win64+Mac -Rocket >> ./$PROJECT_NAME.log"
- echo $process.ExitCode
- if (-not ($process.ExitCode -eq 0)) { exit $process.ExitCode }
- echo "Unreal 5.3 build complete."
################################## 5.4
- $UE5_PACKAGE_PATH_4 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_4"
- echo "$UE5_PACKAGE_PATH_4"
- $process = Start-Process -Wait -PassThru -NoNewWindow -FilePath "$ENGINE_UAT_PATH_UE5_4" -ArgumentList "BuildPlugin -Plugin=$PROJECT_PATH/$PROJECT_NAME.uplugin -Package=$UE5_PACKAGE_PATH_4 -CreateSubFolder -VS2022 -TargetPlatforms=Win64+Mac -Rocket >> ./$PROJECT_NAME.log"
- echo $process.ExitCode
- if (-not ($process.ExitCode -eq 0)) { exit $process.ExitCode }
- echo "Unreal 5.4 build complete."
after_script:
# Get the project/app version from the uplugin file
# this holds the plugin version
- $UNREAL_PLUGIN_FILE = "$PROJECT_PATH/$PROJECT_NAME.uplugin"
- $BUILD_LOCATION_UE5_1 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_1"
- $BUILD_LOCATION_UE5_3 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_3"
- $BUILD_LOCATION_UE5_4 = "$PROJECT_PATH/$PROJECT_NAME" + "_ue5_4"
- $VERSION = Get-Content $UNREAL_PLUGIN_FILE | Where-Object {$_ -like '*VersionName*'}
- $VERSIONTRUNC = $VERSION.Replace('VersionName','')
- $VERSIONTRUNC = $VERSIONTRUNC.Replace(':','')
- $VERSIONTRUNC = $VERSIONTRUNC.Replace(' ','')
- $VERSIONTRUNC = $VERSIONTRUNC.Replace('",','')
- $VERSIONTRUNC = $VERSIONTRUNC.Replace('"','')
- $VERSIONTRUNC = $VERSIONTRUNC.Replace(' ','')
- echo "$VERSIONTRUNC"
- $BUILD_FULL_VERSION = $VERSIONTRUNC
- $BUILD_PATH_UE5_1 = "./build/$PROJECT_NAME" + "_ue5_1" +"-$BUILD_FULL_VERSION/"
- $BUILD_PATH_UE5_3 = "./build/$PROJECT_NAME" + "_ue5_3" +"-$BUILD_FULL_VERSION/"
- $BUILD_PATH_UE5_4 = "./build/$PROJECT_NAME" + "_ue5_4" +"-$BUILD_FULL_VERSION/"
- mkdir "$BUILD_PATH_UE5_1"
- mkdir "$BUILD_PATH_UE5_3"
- mkdir "$BUILD_PATH_UE5_4"
- echo "$BUILD_PATH_UE5_1"
- echo "$BUILD_PATH_UE5_3"
- echo "$BUILD_PATH_UE5_4"
- echo "$BUILD_LOCATION_UE5_1"
- echo "$BUILD_LOCATION_UE5_3"
- echo "$BUILD_LOCATION_UE5_4"
- mv "$BUILD_LOCATION_UE5_1/*" "$BUILD_PATH_UE5_1"
- mv "$BUILD_LOCATION_UE5_3/*" "$BUILD_PATH_UE5_3"
- mv "$BUILD_LOCATION_UE5_4/*" "$BUILD_PATH_UE5_4"
# pdbs
- Remove-Item "$BUILD_PATH_UE5_1/Binaries/Win64/*.pdb"
- Remove-Item "$BUILD_PATH_UE5_3/Binaries/Win64/*.pdb"
- Remove-Item "$BUILD_PATH_UE5_4/Binaries/Win64/*.pdb"
# Copy the packaged plugin for modifications for the Unreal Marketplace submission
- echo "copying and modifying for the marketplace"
- $BUILD_MARKET_PLACE_PATH_UE5_1 = "./build/MarketPlace_5_1/$PROJECT_NAME"
- $BUILD_MARKET_PLACE_PATH_UE5_3 = "./build/MarketPlace_5_3/$PROJECT_NAME"
- $BUILD_MARKET_PLACE_PATH_UE5_4 = "./build/MarketPlace_5_4/$PROJECT_NAME"
- echo "$BUILD_MARKET_PLACE_PATH_UE5_1"
- echo "$BUILD_MARKET_PLACE_PATH_UE5_3"
- echo "$BUILD_MARKET_PLACE_PATH_UE5_4"
- mkdir "$BUILD_MARKET_PLACE_PATH_UE5_1"
- mkdir "$BUILD_MARKET_PLACE_PATH_UE5_3"
- mkdir "$BUILD_MARKET_PLACE_PATH_UE5_4"
# UE5.1 contents
- Copy-Item "$BUILD_PATH_UE5_1*" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_1" -Recurse
# Copy the FilterPlugin.ini
- echo "$PROJECT_PATH/Config/FilterPlugin.ini"
- Copy-Item "$PROJECT_PATH/Config/FilterPlugin.ini" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_1/Config"
# Clean the binaries folder
# pdbs
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Binaries/Win64/*.pdb"
# modules
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Binaries/Win64/UnrealEditor.modules"
# dlls
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Binaries/Win64/UnrealEditor-BodyState.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Binaries/Win64/UnrealEditor-UltraleapTracking.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Binaries/Win64/UnrealEditor-UltraleapTrackingEditor.dll"
# intermediate folder
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_1/Intermediate" -Recurse
# zip it
- Compress-Archive -Path "$BUILD_MARKET_PLACE_PATH_UE5_1" -DestinationPath "$BUILD_MARKET_PLACE_PATH_UE5_1.zip"
## UE5.3 contents
- Copy-Item "$BUILD_PATH_UE5_3*" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_3" -Recurse
## Copy the FilterPlugin.ini
- echo "$PROJECT_PATH/Config/FilterPlugin.ini"
- Copy-Item "$PROJECT_PATH/Config/FilterPlugin.ini" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_3/Config"
## Clean the binaries folder
## pdbs
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Binaries/Win64/*.pdb"
## modules
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Binaries/Win64/UnrealEditor.modules"
## dlls
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Binaries/Win64/UnrealEditor-BodyState.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Binaries/Win64/UnrealEditor-UltraleapTracking.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Binaries/Win64/UnrealEditor-UltraleapTrackingEditor.dll"
## intermediate folder
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_3/Intermediate" -Recurse
## zip it
- Compress-Archive -Path "$BUILD_MARKET_PLACE_PATH_UE5_3" -DestinationPath "$BUILD_MARKET_PLACE_PATH_UE5_3.zip"
## UE5.4 contents
- Copy-Item "$BUILD_PATH_UE5_4*" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_4" -Recurse
## Copy the FilterPlugin.ini
- echo "$PROJECT_PATH/Config/FilterPlugin.ini"
- Copy-Item "$PROJECT_PATH/Config/FilterPlugin.ini" -Destination "$BUILD_MARKET_PLACE_PATH_UE5_4/Config"
## Clean the binaries folder
## pdbs
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Binaries/Win64/*.pdb"
## modules
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Binaries/Win64/UnrealEditor.modules"
## dlls
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Binaries/Win64/UnrealEditor-BodyState.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Binaries/Win64/UnrealEditor-UltraleapTracking.dll"
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Binaries/Win64/UnrealEditor-UltraleapTrackingEditor.dll"
## intermediate folder
- Remove-Item "$BUILD_MARKET_PLACE_PATH_UE5_4/Intermediate" -Recurse
## zip it
- Compress-Archive -Path "$BUILD_MARKET_PLACE_PATH_UE5_4" -DestinationPath "$BUILD_MARKET_PLACE_PATH_UE5_4.zip"
# repare github zips with bins file
- $GITHUB_PATH_UE5_1 = "./github/$PROJECT_NAME" + "_ue5_1"
- $GITHUB_PATH_UE5_3 = "./github/$PROJECT_NAME" + "_ue5_3"
- $GITHUB_PATH_UE5_4 = "./github/$PROJECT_NAME" + "_ue5_4"
- mkdir "$GITHUB_PATH_UE5_1"
- mkdir "$GITHUB_PATH_UE5_3"
- mkdir "$GITHUB_PATH_UE5_4"
- Compress-Archive -Path "$BUILD_PATH_UE5_1" -DestinationPath "${GITHUB_PATH_UE5_1}/${PROJECT_NAME}_ue5_1.zip"
- Compress-Archive -Path "$BUILD_PATH_UE5_3" -DestinationPath "${GITHUB_PATH_UE5_3}/${PROJECT_NAME}_ue5_3.zip"
- Compress-Archive -Path "$BUILD_PATH_UE5_4" -DestinationPath "${GITHUB_PATH_UE5_4}/${PROJECT_NAME}_ue5_4.zip"
artifacts:
name: "$env:CI_PROJECT_NAME-$env:CI_COMMIT_REF_SLUG-$env:CI_JOB_ID-$env:CI_COMMIT_SHORT_SHA"
paths:
- "./$PROJECT_NAME.log"
- "./build/MarketPlace_5_1/${PROJECT_NAME}.zip"
- "./build/MarketPlace_5_3/${PROJECT_NAME}.zip"
- "./build/MarketPlace_5_4/${PROJECT_NAME}.zip"
# these artifiacts are for github
- "./github/${PROJECT_NAME}_ue5_1/${PROJECT_NAME}_ue5_1.zip"
- "./github/${PROJECT_NAME}_ue5_3/${PROJECT_NAME}_ue5_3.zip"
- "./github/${PROJECT_NAME}_ue5_4/${PROJECT_NAME}_ue5_4.zip"
when: always
expire_in: 2 weeks
needs: []
# Upload build artifacts to an S3 bucket for public access.
# Created by Luke Driffield in the IT team.
# AWS account access managed by the IT team.
# Please raise an IT Support ticket for support; if required.
deploy:upload-to-aws-s3:
tags:
- docker
image:
# Uses official Amazon AWS CLI image from Docker Hub
name: amazon/aws-cli
# Change entrypoint to 'nothing' to allow us to use shell commands
entrypoint: [""]
# Run after the build stage
stage: deploy
# Run manually; can be changed if desired
when: manual
variables:
# Basename for output ZIP used for upload
ZIP_NAME: UltraleapTracking
# CI_BUILDS_DIR provides basepath from CI/CD variables
BUILD_DIR: ${CI_PROJECT_DIR}/build/
# Basename used for output directories
BUILD_DIR_NAME: MarketPlace
# AWS Bucket details
AWS_BUCKET_NAME: ultraleap-public-files
AWS_BUCKET_REGION: eu-west-2
AWS_UPLOAD_TXT: "${CI_PROJECT_DIR}/s3-download-urls.txt"
script:
- yum install -y zip
- touch "${AWS_UPLOAD_TXT}"
- echo "===== Started S3 Upload $(date +'%A %d %b %T %Z %Y') =====" > "${AWS_UPLOAD_TXT}"
- |
for VERSION in "5_1" "5_3" "5_4"; do
export ZIP_OUTPUT_NAME="${ZIP_NAME}_${VERSION}_$(cat /dev/urandom | base64 | tr -dc '0-9a-zA-Z' | head -c12).zip";
mv "${BUILD_DIR}/MarketPlace_${VERSION}/${ZIP_NAME}.zip" "${ZIP_OUTPUT_NAME}"
aws s3 cp "${ZIP_OUTPUT_NAME}" "s3://$AWS_BUCKET_NAME/${ZIP_OUTPUT_NAME}" --acl public-read
echo "${ZIP_OUTPUT_NAME} => https://${AWS_BUCKET_NAME}.s3.${AWS_BUCKET_REGION}.amazonaws.com/${ZIP_OUTPUT_NAME}"
echo "${ZIP_OUTPUT_NAME} => https://${AWS_BUCKET_NAME}.s3.${AWS_BUCKET_REGION}.amazonaws.com/${ZIP_OUTPUT_NAME}" >> "${AWS_UPLOAD_TXT}"
done
after_script:
- echo "===== Finished S3 Upload $(date +'%A %d %b %T %Z %Y') =====" >> "${AWS_UPLOAD_TXT}"
artifacts:
paths: [ "s3-download-urls.txt" ]
expire_in: 1 month
expose_as: File Download URL List
name: s3-download-urls
when: always
# Setup job dependencies
needs:
- job: build:build-project
artifacts: true