-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
333 lines (310 loc) · 12.5 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
# Recommendation: Place this file in source control.
# Auto-generated by `./dk dksdk.project.new` of DkHelloWorld.
# ----------------------------------------------------------------
# Cost Guide
# ----------------------------------------------------------------
#
# Are you running this in GitLab SaaS? This is an expensive
# workflow to run, so please pay attention to your billable CI minutes.
#
# FIRST, read "Additional costs on GitLab SaaS" at
# https://docs.gitlab.com/ee/ci/pipelines/cicd_minutes.html#additional-costs-on-gitlab-saas
#
# As of 2023-05 (these factors may be out of date):
#
# GitLab SaaS runner type Machine Size CI/CD minutes cost factor
# --- --- --
# Linux OS amd64 small 1
# Linux OS amd64 medium 2
# Linux OS amd64 large 3
# Linux OS amd64 + GPU-enabled medium, GPU standard 7
# macOS M1 Medium 6
#
# with Windows as the same price as Linux (https://docs.gitlab.com/ee/ci/runners/saas/windows_saas_runner.html).
# Since Windows (n1-standard-2 instances with 2 vCPUs and 7.5 GB RAM) matches the Linux small
# specs (2 vCPU, 8 GB RAM), the Windows cost factor _should be_:
#
# Windows small 1
#
# That means running on macOS is 6 times more expensive than the small Linux build machine.
#
# SECOND, understand how these CI pipelines are structured. We use a staged approach
# where the least expensive jobs run first.
stages:
- troubleshoot # Use when a job should be first so troubleshooting easier
- sanity-build # Quick test before running many jobs
- low-cost-build
- high-cost-build
# What those stages mean is that no [stage: high-cost-build] job will run before
# a [stage: low-cost-build] job. And no [stage: low-cost-build] job will run
# before a [stage: sanity-build] job.
#
# So ...
#
# ... someone pushes a commit that breaks your CI pipeline
# ==> one or more of your [stage: low-cost-build] jobs fail
# ==> none of the [stage: high-cost-build] jobs run
# ==> you only spend the costs for the [stage: low-cost-build] jobs
#
# ... someone pushes a commit that passes your CI pipeline
# ==> you wait for all of your [stage: low-cost-build] jobs to pass
# ==> then you wait for all of your [stage: high-cost-build] jobs to pass
# ==> your CI pipeline takes twice as long as it could have
include:
- local: 'ci/setup-dkml/gl/setup-dkml.gitlab-ci.yml'
variables:
SKIP_OPAM_MODIFICATIONS: "true"
# GitLab CI cache prefix.
# Bump whenever opam root or opam variables change, or when DkSDK version changes.
# Format: {Change YYYYMMDD}-{DkSDK Version}
# - 20230315-1_0_0: DkSDK 1.0.0
CACHE_PREFIX: "20230315-1_0_0"
# Allow relative paths in CMakePresets.json to be resolved to absolute paths.
# The trailing directory separator (the slash) is required.
# Important for integration tests that clone the project with
# `./dk dksdk.project.new` and then run presets.
DKSDK_PROJECT_BASE: $CI_PROJECT_DIR/
.common:artifacts:
# Typically use this as the last extension, ie. `-extends: [.xxx:setup-dkml, .common:artifacts]`
# [artifacts.name] is set in .xxx:setup-dkml (ci/setup-dkml/gl/setup-dkml.gitlab-ci.yml)
artifacts:
paths:
- dist/ # Anything we might distribute between jobs or for end-users
- build/Testing/Temporary/Last*.log # Unit test logs
- build/Testing/Temporary/MemoryChecker.*.log # MemCheck (valgrind) logs
# memtrace (memory allocations) files viewable in memtrace_viewer
# described at https://blog.janestreet.com/finding-memory-leaks-with-memtrace/
- build/tests/**/*.ctf
- _build/default/_dn/lwt/ # Inspect how Lwt compiled
- build/CMakeCache.txt # Inspect CMake settings
- build/_bt/p/build/CMakeCache.txt # ... again for build-and-test
- build/src/ # Always grab the src/ artifacts like executables to inspect offline
- build/_bt/p/build/src/ # ... again for build-and-test
- build/_bt/p/build/dependencies/libev/ # (Temporary. Why is libev not part of Lwt in bt?)
- build/_bt/p/_build/default/_dn/lwt/ # (Temporary. Why is libev not part of Lwt in bt?)
- build/DkSDKFiles/cfg-*/o/src/ocaml/config.log # Log for compiling the OCaml compiler
reports:
junit:
- build/cmakespec.xml
- build/tests/build-and-test/proj/build/cmakespec.xml
when: always # Even if build fails, if we have some artifacts make them available
untracked: false
# --------------------------
# Jobs that run every commit
# --------------------------
test-gl-win32:
dependencies: []
extends:
- .win32:setup-dkml
- .common:artifacts
stage: low-cost-build
# stage: troubleshoot
variables:
# Use a short build directory to lessen chance of exceeding 260 char limit
DKSDK_BUILD_DIR: C:/b
# Overridden to use the Windows directory separator
DKSDK_PROJECT_BASE: $CI_PROJECT_DIR\
cache:
- key: "w1_cmake"
paths:
- cmake_bin/bin/cmake.exe
script:
# vcvarsall.bat %vsstudio_arch% 10.0.18362.0 -vcvars_ver=14.26
- .ci/sd4/vsenv.ps1
- ./dk dksdk.ninja.copy
- ./dk dksdk.cmake.copy
- ./dk dksdk.project.get
- echo "-host_arch=$env:vsstudio_hostarch -arch=$env:vsstudio_arch -winsdk=$env:VS_WINSDKVER -vcvars_ver=$env:VS_VCVARSVER"
- CMD /C "`"%VS_DIR%\Common7\Tools\VsDevCmd.bat`" -host_arch=$env:vsstudio_hostarch -arch=$env:vsstudio_arch -winsdk=$env:VS_WINSDKVER -vcvars_ver=$env:VS_VCVARSVER &&
msys64\usr\bin\sh -lc `"ci/build-test.sh -D DKSDK_MSYS2_DIR=msys64`""
# Tests that DKSDK_DEV_TOOLS builds.
# - This is by turned off by default; with the [only:] field
# only https://gitlab.com/diskuv/samples/DkHelloWorld.git can run this job
test-gl-win32-devtools:
dependencies: []
only:
- branches@diskuv/samples/DkHelloWorld
extends:
- .win32-windows_x86_64:setup-dkml-allplusmincache
- .common:setup-dkml-cache # Only Windows 64-bit needed to test devtools
- .common:artifacts
stage: low-cost-build
# stage: troubleshoot
variables:
# Use a short build directory to lessen chance of exceeding 260 char limit
DKSDK_BUILD_DIR: C:/b
# Overridden to use the Windows directory separator
DKSDK_PROJECT_BASE: $CI_PROJECT_DIR\
# Tell ci/build-test.sh to not run ctest
DISABLE_CTEST: 1
# Tell ci/build-test.sh to run the DkSDK_DevTools preset
CMAKE_BUILD_PRESET: ci-devtools
script:
- .ci/sd4/vsenv.ps1
- ./dk dksdk.ninja.copy
- ./dk dksdk.cmake.copy
- ./dk dksdk.project.get
- echo "-host_arch=$env:vsstudio_hostarch -arch=$env:vsstudio_arch -winsdk=$env:VS_WINSDKVER -vcvars_ver=$env:VS_VCVARSVER"
- CMD /C "`"%VS_DIR%\Common7\Tools\VsDevCmd.bat`" -host_arch=$env:vsstudio_hostarch -arch=$env:vsstudio_arch -winsdk=$env:VS_WINSDKVER -vcvars_ver=$env:VS_VCVARSVER &&
msys64\usr\bin\sh -lc `"ci/build-test.sh -D DKSDK_MSYS2_DIR=msys64 -D BUILD_TESTING=OFF -D DKSDK_DEV_TOOLS=ON`""
test-gl-macos:
dependencies: []
extends:
- .macos:setup-dkml
- .common:artifacts
stage: high-cost-build
# stage: troubleshoot
# Images: https://docs.gitlab.com/ee/ci/runners/saas/macos/environment.html
#
# 2023-04-28 and earlier:
# macos-11-xcode-12 (`frozen` status) on tag shared-macos-amd64
image: macos-12-xcode-13 # `maintenance` status
tags: [saas-macos-medium-m1] # Apple Silicon
# Override the matrix to add in Intel cross-compiled from Apple Silicon
#
variables:
HOMEBREW_NO_INSTALL_CLEANUP: 1
dkml_host_os: 'darwin'
opam_root_cacheable: '${CI_PROJECT_DIR}/.ci/o'
bootstrap_opam_version: '2.2.0-alpha-20221228'
dkml_host_abi: 'darwin_arm64'
opam_root: '${CI_PROJECT_DIR}/.ci/o'
# prettier-ignore
parallel:
matrix: [
{ abi_pattern: 'macos-darwin_arm64' },
{ abi_pattern: 'macos-darwin_arm64_X_darwin_x86_64' },
]
script:
# /usr/local/opt/openssl@3 (x86_64) is required for darwin_x86_64
# `dkml-redis` binaries. It is used to enable Redis tests.
- |
if ! brew install openssl@3; then
echo "WARNING: brew install openssl@3 failed: $?" # continue
fi
- ./dk dksdk.ninja.copy
- ./dk dksdk.cmake.copy
- ./dk dksdk.project.get
- sh ci/build-test.sh
test-gl-linux:
dependencies: []
extends:
- .linux:setup-dkml
- .common:artifacts
stage: sanity-build
artifacts:
name: ${abi_pattern}
# Override the matrix so that:
# 1. We have Linux compatible with dkml-redis, so Redis can be tested.
# Confer: https://gitlab.com/diskuv-ocaml/distributions/dkml-redis/-/blob/main/.gitlab-ci.yml
#
variables:
dkml_host_os: 'linux'
opam_root_cacheable: '.ci/o'
bootstrap_opam_version: '2.2.0-alpha-20221228'
opam_root: '.ci/o'
in_docker: 'true'
# prettier-ignore
parallel:
matrix: [
{ abi_pattern: 'manylinux2014-linux_x86',
dkml_host_abi: 'linux_x86',
dockcross_image: 'dockcross/manylinux2014-x86',
dockcross_run_extra_args: '--platform linux/386' },
{ abi_pattern: 'manylinux_2_28-linux_x86_64',
dkml_host_abi: 'linux_x86_64',
dockcross_image: 'dockcross/manylinux_2_28-x64',
dockcross_run_extra_args: '--platform linux/amd64' },
]
script:
- ./dk dksdk.ninja.copy
- ./dk dksdk.cmake.copy
- ./dk dksdk.project.get
- sh ci/build-test.sh
test-gl-android:
dependencies: []
stage: low-cost-build
# Similar to linux CI but do Android cross-compile.
# * We do _not_ need a backwards-compatible Linux Docker image (manylinux); in fact we want
# a modern Linux build container, or we get RPATH problems with CMake during `file(INSTALL)`
# of capnproto. That implies we should turn off Docker-in-Docker.
# * We'll use Debian "stable-slim" as the Docker image, which is the "modern" Linux Docker image
# that Diskuv supports.
# * We use gcc-multilib so dkml_host_abi=linux_x86 can use `gcc -m32` without failing. Ditto
# for g++-multilib which is used (at least) by capnproto.
#
variables:
dkml_host_os: 'linux'
bootstrap_opam_version: '2.2.0-alpha-20221228'
opam_root_cacheable: '.ci/o'
opam_root: '.ci/o'
extends:
- .linux:setup-dkml-no-matrix
- .common:artifacts
# prettier-ignore
parallel:
matrix: [
{ abi_pattern: 'linux-android_arm32v7a',
apt_packages: 'build-essential gcc-multilib g++-multilib',
dkml_host_abi: 'linux_x86' },
{ abi_pattern: 'linux-android_x86_64',
apt_packages: 'build-essential',
dkml_host_abi: 'linux_x86_64' },
{ abi_pattern: 'linux-android_arm64v8a',
apt_packages: 'build-essential',
dkml_host_abi: 'linux_x86_64' },
# Disabled, and probably will never be supported. Android x86 (old Chromebooks, and unoffical Android-x86 on PC)
# will be EOL and the OCaml x86 backend will not be changed to support PIE executables that newer Android
# needs.
# { abi_pattern: 'linux-android_x86',
# apt_packages: 'build-essential gcc-multilib g++-multilib',
# dkml_host_abi: 'linux_x86' },
]
image: debian:stable-slim
script:
- if [ -n "$apt_packages" ]; then apt-get -qq -o=Dpkg::Use-Pty=0 -y install $apt_packages; fi
- ./dk dksdk.ninja.copy
- ./dk dksdk.cmake.copy
- ./dk dksdk.android.ndk.download
- ./dk dksdk.project.get
- sh ci/build-test.sh
# ------------------------------------
# Jobs that report to CDash dashboards
# ------------------------------------
#
# Advanced! You will need to look at the HelloWorld project to enable it.
# 1. They won't run unless CTestConfig.cmake and ci/ctest/Nightly-CTest.cmake
# have been created.
# 2. They won't run unless on the GitLab website you have done
# CI/CD -> Schedules and created a "New Schedule". And just because a
# jobs says "Nightly" ... you can run it weekly to reduce CI spend.
.scheduled:
rules:
- if: $SCHEDULED_CTEST_JOB == "Nightly"
exists:
- CTestConfig.cmake
- ci/ctest/Nightly-CTest.cmake
scheduled-win32:
dependencies: []
stage: low-cost-build
extends:
- test-gl-win32
- .scheduled
scheduled-macos:
dependencies: []
stage: high-cost-build
extends:
- test-gl-macos
- .scheduled
scheduled-linux:
dependencies: []
stage: low-cost-build
extends:
- test-gl-linux
- .scheduled
scheduled-android:
dependencies: []
stage: low-cost-build
extends:
- test-gl-android
- .scheduled