forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
405 lines (373 loc) · 9.41 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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# ------------
# -- STAGES --
# ------------
stages:
- build
- deploy
- postdeploy
variables:
# Dry run is for builds-only mode, no uploading/deploying/notifying, helpful when experimenting with pipelines
CFX_DRY_RUN: 'false'
CFX_RETAIL_BUILD: 'false'
CFX_CLONE_ROOT: $CI_BUILDS_DIR\$CI_PROJECT_PATH_SLUG-$CI_CONCURRENT_PROJECT_ID
workflow:
rules:
- if: $CI_COMMIT_BRANCH =~ /^(master|beta|production)$/
variables:
CFX_RETAIL_BUILD: 'true'
- if: $CI_COMMIT_BRANCH =~ /^feature\//
variables:
CFX_FEATURE_BRANCH_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 public builds
.only_for_public_build:
rules:
- if: $CFX_RETAIL_BUILD == 'true' || $CFX_FEATURE_BRANCH_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: $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"
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:
paths:
# Build files (bin, build, etc.)
- .build-cache
- code/tools/build/prebuild_run.txt
# IDL tool generated files
- code/tools/idl/xpidl/__pycache__
- code/tools/idl/xpidl/xpidllex.py
- code/tools/idl/xpidl/xpidlyacc.py
# IDL generated files to avoid large recompilations
- code/client/citicore/fxcore.h
- code/client/citicore/fxIBase.h
- code/components/citizen-scripting-core/include/fxScripting.h
# Launcher delay list
- code/client/launcher/DelayList.h
# Versioning files
- code/shared/citversion.h
- code/shared/launcher_version.h
# native-doc-gen files
- ext/native-doc-gen/node.exe
# natives files
- ext/natives/inp
- ext/natives/out
# ui files
- ext/ui-build/data/.commit
- ext/ui-build/data.zip
- ext/ui-build/data_big.zip
# Chromium tools precompiled python
- vendor/chromium/**/*.pyc
# V8 binaries
- vendor/v8/**/*.dll
build_client:
extends: [.base_build_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT
CFX_PRODUCT_NAME: fivem
tags:
- release_fivem
- windows
- vs2022
build_client_rdr3:
extends: [.base_build_client]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT
CFX_PRODUCT_NAME: redm
tags:
- release_redm
- windows
- vs2022
build_sdk:
stage: build
tags:
- release_fivem
- windows
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT
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 --
# -------------------
.base_build_server:
rules:
- if: $CI_COMMIT_BRANCH && ($CI_COMMIT_BRANCH != 'beta' && $CI_COMMIT_BRANCH != 'production')
when: always
- when: never
build_server_windows:
extends: [.base_build_windows, .base_build_server]
tags:
- release_fxserver
- windows
- vs2022
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT
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: [.base_build_server]
stage: build
tags:
- linux
image: registry-internal.fivem.net/cfx/fivem/fivem-builder-linux-alpine:latest
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_docker_alpine.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
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
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_RETAIL_BUILD == 'true' && $CI_COMMIT_BRANCH == 'master'
when: on_success
- when: never
fivem_deploy_beta:
extends: [.base_fivem_deploy]
environment:
name: beta
rules:
- if: $CFX_RETAIL_BUILD == 'true' && $CI_COMMIT_BRANCH == 'beta'
when: on_success
- when: never
fivem_deploy_production:
extends: [.base_fivem_deploy]
environment:
name: production
rules:
- if: $CFX_RETAIL_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_RETAIL_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_RETAIL_BUILD == 'true' && $CI_COMMIT_BRANCH == 'master'
when: on_success
- when: never
redm_deploy_beta:
extends: [.base_redm_deploy]
environment:
name: beta
rules:
- if: $CFX_RETAIL_BUILD == 'true' && $CI_COMMIT_BRANCH == 'beta'
when: on_success
- when: never
redm_deploy_production:
extends: [.base_redm_deploy]
environment:
name: production
rules:
- if: $CFX_RETAIL_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_RETAIL_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_public_build]
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
needs:
- job: build_client
artifacts: true
redm_upload_review:
extends: [.base_upload_review]
variables:
GIT_CLONE_PATH: $CFX_CLONE_ROOT
needs:
- job: build_client_rdr3
artifacts: true
prebuild_linux_docker_container:
image: docker:24.0
stage: build
tags:
- linux
services:
- docker:24.0-dind
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: none
DOCKER_IMAGE_NAME: "$CI_REGISTRY_IMAGE/fivem-builder-linux-alpine:latest"
DOCKER_COMMIT_TAG: "$CI_REGISTRY_IMAGE/fivem-builder-linux-alpine:$CI_COMMIT_SHORT_SHA"
before_script:
- docker info
script:
- echo "Building Docker image..."
- docker build -t $DOCKER_IMAGE_NAME -t $DOCKER_COMMIT_TAG -f code/tools/ci/docker-builder/Dockerfile .
- echo "Logging into GitLab Container Registry..."
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- echo "Pushing Docker image to registry with latest tag..."
- docker push $DOCKER_IMAGE_NAME
- echo "Pushing Docker image to registry with commit tag..."
- docker push $DOCKER_COMMIT_TAG
rules:
- when: manual
allow_failure: true