-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
130 lines (113 loc) · 3.79 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
# Project ODIN :: Unity PUN 2 Multiplayer Sample CI/CD
#
# Unity Editor command line arguments:
# https://docs.unity3d.com/Manual/EditorCommandLineArguments.html
stages:
- test
- build
- package
variables:
PRODUCT_NAME: ODIN-SampleProject
GIT_SUBMODULE_STRATEGY: recursive
GIT_SSL_NO_VERIFY: 1
### Testing
.job_template: &common_test
stage: test
except: [tags]
image: $CI_REGISTRY/odin/builders/unity-editor
cache:
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME"
paths:
- $PRODUCT_NAME/Library
artifacts:
expire_in: 7 days
paths:
- $PRODUCT_NAME/Logs
test:editor:
<<: *common_test
script: unity-editor -2021 -projectPath ${CI_PROJECT_DIR}/${PRODUCT_NAME} -runEditorTests
### Building
.job_template: &common_build
stage: build
only: [tags]
image: $CI_REGISTRY/odin/builders/unity-editor
before_script:
- mkdir -p ${PRODUCT_NAME}/Assets/Photon/PhotonUnityNetworking/Resources
- echo "$PHOTON_50CCU_CONFIG" > ${PRODUCT_NAME}/Assets/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset
- mkdir -p bin
cache:
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME"
paths:
- $PRODUCT_NAME/Library
artifacts:
expire_in: 30 minutes
paths:
- bin
build:windows:
<<: *common_build
script:
- unity-editor -2021 -logfile -batchmode -quit -projectPath ${CI_PROJECT_DIR}/${PRODUCT_NAME} -buildTarget Win64 -buildWindows64Player "${CI_PROJECT_DIR}/bin/${PRODUCT_NAME}.exe"
build:macos:
<<: *common_build
script:
- unity-editor -2021 -logfile -batchmode -quit -projectPath ${CI_PROJECT_DIR}/${PRODUCT_NAME} -buildTarget OSXUniversal -buildOSXUniversalPlayer "${CI_PROJECT_DIR}/bin/${PRODUCT_NAME}"
build:linux:
<<: *common_build
script:
- unity-editor -2021 -logfile -batchmode -quit -projectPath ${CI_PROJECT_DIR}/${PRODUCT_NAME} -buildTarget Linux64 -buildLinux64Player "${CI_PROJECT_DIR}/bin/${PRODUCT_NAME}"
build:android:
<<: *common_build
script:
- unity-editor -2021 -logfile -batchmode -quit -projectPath ${CI_PROJECT_DIR}/${PRODUCT_NAME} -buildTarget Android -executeMethod ODIN_Sample.Scripts.Editor.Builder.BuildAndroid "${CI_PROJECT_DIR}/bin/${PRODUCT_NAME}.apk"
### Packaging
.job_template: &common_package
stage: package
only: [tags]
before_script:
- mkdir -p dist
artifacts:
name: '${PRODUCT_NAME}_${PRODUCT_OS}_${CI_COMMIT_REF_SLUG}'
expire_in: 30 minutes
paths:
- dist
package:windows:
<<: *common_package
tags: [windows]
variables:
PRODUCT_OS: "windows"
needs:
- build:windows
script:
- signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin/${PRODUCT_NAME}.exe"
- iscc InnoSetup.iss
- signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 "dist/${PRODUCT_NAME}_Setup.exe"
package:macos:
<<: *common_package
tags: [macos]
variables:
PRODUCT_OS: "macos"
needs:
- build:macos
script:
- cp PlayerIcon.icns "bin/${PRODUCT_NAME}.app/Contents/Resources/"
- codesign --force --sign "Developer ID Application" --options runtime --entitlements Entitlements.plist --deep "bin/${PRODUCT_NAME}.app"
- create-dmg --overwrite "bin/${PRODUCT_NAME}.app" dist && mv dist/*.dmg "dist/${PRODUCT_NAME}.dmg"
- export BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" bin/${PRODUCT_NAME}.app/Contents/Info.plist)
- notarize-cli --file "dist/${PRODUCT_NAME}.dmg" --bundle-id ${BUNDLE_ID} --username ${APPLE_DEV_USERNAME} --password ${APPLE_DEV_PASSWORD}
package:linux:
<<: *common_package
variables:
PRODUCT_OS: "linux"
needs:
- build:linux
script:
- mv bin ${PRODUCT_NAME}
- tar -czvf dist/${PRODUCT_NAME}.tar.gz ${PRODUCT_NAME}
package:android:
<<: *common_package
variables:
PRODUCT_OS: "android"
needs:
- build:android
script:
- mv bin/*.apk dist