forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
342 lines (313 loc) · 7.39 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
# ------------
# -- STAGES --
# ------------
stages:
- build
- deploy
- postdeploy
variables:
CFX_RELEASE_BUILD: 'false'
CFX_CLONE_ROOT: $CI_BUILDS_DIR\$CI_PROJECT_PATH_SLUG\$CI_COMMIT_REF_SLUG
workflow:
rules:
- if: $CI_COMMIT_BRANCH && ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beta" || $CI_COMMIT_BRANCH == "production")
variables:
CFX_RELEASE_BUILD: 'true'
# never run pipelines for tags
- if: $CI_COMMIT_TAG
when: never
# never run pipelines for MRs
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
# otherwise, always run pipelines
- when: always
# helper for jobs that are only meant to be run for releases
.only_for_release:
rules:
- if: $CFX_RELEASE_BUILD == 'true'
when: on_success
- when: never
# helper for jobs that are only meant to be run on master branch
.only_for_master:
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'master'
when: on_success
- when: never
# helper for windows builds of clients and server
.base_build_windows:
stage: build
tags:
- windows
variables:
# archives are heavier this way, but much faster to pack/unpack
FF_USE_FASTZIP: "true"
CACHE_COMPRESSION_LEVEL: "fastest"
# using normal CI cache here would significantly slow down the build
CFX_USE_INTER_BUILD_CACHE: "true"
cache:
key: $CI_JOB_NAME--$CI_COMMIT_REF_SLUG
# -------------------
# -- CLIENT BUILDS --
# -------------------
.base_build_client:
extends: [.base_build_windows]
script:
- ".\\code\\tools\\ci\\build_client.ps1"
artifacts:
paths:
- caches
- ext/native-doc-gen/natives_cfx.json
expire_in: 1 month
cache:
untracked: true
paths:
- code/build
- code/shared/citversion.h
- code/shared/launcher_version.h
build_client:
extends: [.base_build_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\fivem
CFX_PRODUCT_NAME: fivem
tags:
- release_fivem
- windows
- vs2022
build_client_rdr3:
extends: [.base_build_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\redm
CFX_PRODUCT_NAME: redm
tags:
- release_redm
- windows
- vs2022
build_sdk:
stage: build
tags:
- release_fivem
- windows
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\fivem-sdk
artifacts:
paths:
- caches
expire_in: 1 month
cache:
key: $CI_JOB_NAME--$CI_COMMIT_REF_SLUG
paths:
- caches
script:
- ".\\code\\tools\\ci\\build_sdk.ps1"
# -------------------
# -- SERVER BUILDS --
# -------------------
build_server_windows:
extends: [.base_build_windows, .only_for_master]
tags:
- release_fxserver
- windows
- vs2022
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\fxserver
CFX_PRODUCT_NAME: fxserver
script:
- ".\\code\\tools\\ci\\build_server_windows.ps1"
artifacts:
paths:
- out/server.zip
- out/server.7z
expire_in: 1 month
cache:
untracked: true
build_proot_linux:
extends: [.only_for_master]
stage: build
tags:
- linux
image: mcr.microsoft.com/dotnet/sdk:6.0-alpine3.15
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_DEPTH: 3
# workaround gitlab-ci-multi-runner#2148
GIT_SSL_CAPATH: /etc/ssl/certs/
DOCKER_TLS_CERTDIR: ""
script:
- sh code/tools/ci/build_server_proot.sh
artifacts:
paths:
- fx.tar.xz
expire_in: 1 month
# -------------------
# -- CLIENT DEPLOY --
# -------------------
.base_deploy_client:
stage: deploy
tags:
- windows
script:
- ".\\code\\tools\\ci\\deploy_client.ps1"
cache:
key: $CI_JOB_NAME--$CI_COMMIT_REF_SLUG
paths:
- .build-cache
.base_fivem_deploy:
extends: [.base_deploy_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\fivem-deploy
CFX_PRODUCT_NAME: fivem
needs:
- job: build_client
artifacts: true
- job: build_sdk
artifacts: true
.base_redm_deploy:
extends: [.base_deploy_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\redm-deploy
CFX_PRODUCT_NAME: redm
needs:
- job: build_client_rdr3
artifacts: true
# FiveM deployments
fivem_deploy_canary:
extends: [.base_fivem_deploy]
environment:
name: canary
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'master'
when: on_success
- when: never
fivem_deploy_beta:
extends: [.base_fivem_deploy]
environment:
name: beta
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'beta'
when: on_success
- when: never
fivem_deploy_production:
extends: [.base_fivem_deploy]
environment:
name: production
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'production'
when: on_success
- when: never
fivem_deploy_specific:
extends: [.base_fivem_deploy]
environment:
name: specific/$CI_COMMIT_BRANCH
rules:
- if: $CFX_RELEASE_BUILD == 'false' && $CI_COMMIT_BRANCH
when: manual
allow_failure: true
- when: never
# RedM deployments
redm_deploy_canary:
extends: [.base_redm_deploy]
environment:
name: canary
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'master'
when: on_success
- when: never
redm_deploy_beta:
extends: [.base_redm_deploy]
environment:
name: beta
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'beta'
when: on_success
- when: never
redm_deploy_production:
extends: [.base_redm_deploy]
environment:
name: production
rules:
- if: $CFX_RELEASE_BUILD == 'true' && $CI_COMMIT_BRANCH == 'production'
when: on_success
- when: never
redm_deploy_specific:
extends: [.base_redm_deploy]
environment:
name: specific/$CI_COMMIT_BRANCH
rules:
- if: $CFX_RELEASE_BUILD == 'false' && $CI_COMMIT_BRANCH
when: manual
allow_failure: true
- when: never
# -------------------
# -- ScRT PACKAGES --
# -------------------
typings_server:
stage: deploy
extends: [.only_for_master]
needs:
- job: build_server_windows
artifacts: true
image: node:alpine
tags:
- linux
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_DEPTH: 3
# workaround gitlab-ci-multi-runner#2148
GIT_SSL_CAPATH: /etc/ssl/certs/
script:
- sh ext/typings/server/build.sh
typings_client:
stage: deploy
extends: [.only_for_master]
needs:
- job: build_client
artifacts: true
tags:
- windows
script:
- "cmd /c ext\\typings\\client\\build.bat"
nuget_client:
stage: deploy
extends: [.only_for_master]
needs:
- job: build_client
artifacts: true
tags:
- windows
script:
- "cmd /c ext\\nuget\\client\\build.bat"
nuget_server:
stage: deploy
extends: [.only_for_master]
needs:
- job: build_server_windows
artifacts: true
tags:
- windows
script:
- "cmd /c ext\\nuget\\server\\build.bat"
# --------------------
# -- UPLOAD REVIEWS --
# --------------------
.base_upload_review:
stage: postdeploy
extends: [.only_for_release]
allow_failure: true
script:
- ".\\code\\tools\\ci\\upload_review.ps1"
tags:
- windows
fivem_upload_review:
extends: [.base_upload_review]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\fivem-review
needs:
- job: build_client
artifacts: true
redm_upload_review:
extends: [.base_upload_review]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT\redm-review
needs:
- job: build_client_rdr3
artifacts: true