summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: e789790f5873109169b67de63679f3fe7bb1e4c3 (plain)
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
include:
  - project: 'freedesktop/ci-templates'
    ref: 'master'
    file: '/templates/fedora.yml'

stages:
  - 'build docker'
  - 'build'
  # Use the resulting binaries
  - 'integrate'

variables:
  # CI_GSTREAMER_* variables are overridden by gstreamer's CI when it triggers cerbero CI.
  CI_GSTREAMER_REF_NAME: '1.22'
  CI_GSTREAMER_URL: 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git'
  CI_GSTREAMER_TRIGGERED: 'false'
  GST_UPSTREAM_BRANCH: '1.22'
  WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-02-01.0-1.22'
  DEFAULT_CERBERO_ARGS: >
    --variants werror
    --timestamps

workflow:
  rules:
    - if: $CI_MERGE_REQUEST_IID
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

#
# Global CI policy
#
# This can be used to configure global behaviour our our jobs.
#
default:
  retry:
    max: 2
    when:
      - 'runner_system_failure'
      - 'stuck_or_timeout_failure'
      - 'scheduler_failure'
      - 'api_failure'
  interruptible: true

.fedora image:
  variables:
    ###
    # IMPORTANT
    # These are the version tags for the docker images the CI runs against.
    # If you are hacking on them or need a them to rebuild, its enough
    # to change any part of the string of the image you want.
    ###
    FDO_DISTRIBUTION_TAG: '2022-12-24.0'
    FDO_DISTRIBUTION_VERSION: '36'
    FDO_DISTRIBUTION_PACKAGES: sudo git-core lbzip2 rsync wine which python3-distro
    FDO_DISTRIBUTION_EXEC: ci/docker_setup.sh
    FDO_UPSTREAM_REPO: gstreamer/cerbero

.android fedora image:
  variables:
    ###
    # IMPORTANT
    # These are the version tags for the docker images the CI runs against.
    # If you are hacking on them or need a them to rebuild, its enough
    # to change any part of the string of the image you want.
    ###
    FDO_DISTRIBUTION_TAG: '2022-12-24.0'
    FDO_DISTRIBUTION_VERSION: '36'
    FDO_DISTRIBUTION_PACKAGES: file git-core java-11-openjdk-devel lbzip2 python3-distro make pkg-config unzip which xz
    FDO_DISTRIBUTION_EXEC: ci/docker_android_setup.sh $ANDROID_HOME $ANDROID_NDK_HOME $GST_UPSTREAM_BRANCH
    FDO_UPSTREAM_REPO: gstreamer/cerbero
    FDO_REPO_SUFFIX: android
    ANDROID_HOME: "/android/sdk"
    ANDROID_NDK_HOME: "/android/ndk"

.manual trigger:
  rules:
    # If this pipeline is triggered from gstreamer, trigger the pipeline automatically
    - if: '$CI_PIPELINE_SOURCE == "pipeline"'
    # If this matches, it means the pipeline is running against either the main
    # or a stable branch, so make it automatic cause they need to update artifacts,
    # like the docs site or cerbero deps
    - if: '$CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
    # If the MR is assigned to the Merge bot, trigger the pipeline automatically
    - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
    # When the assignee isn't the merge bot, require an explicit action to trigger the pipeline
    # to avoid wasting CI resources
    - if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"'
      when: 'manual'

fedora image:
  stage: "build docker"
  extends:
    - .manual trigger
    - .fedora image
    - .fdo.container-build@fedora
  variables:
    GIT_STRATEGY: none

android fedora image:
  stage: "build docker"
  extends:
    - .manual trigger
    - .android fedora image
    - .fdo.container-build@fedora
  variables:
    GIT_STRATEGY: none

# Template for all Cerbero GStreamer builds
#
# Parameters:
# CONFIG: The name of the configuration file to use
# ARCH: The cerbero <os>_<cpu> (used in cache key)
#
.cerbero:
  stage: "build"
  extends:
    - .fedora image
    - .fdo.distribution-image@fedora
  # Ensure that the runners it will be executed on
  # will have plenty of space for the cache
  tags: ['gstreamer']
  timeout: '3h'
  variables:
    CCACHE_COMPILERCHECK: "content"
    CCACHE_COMPRESS: "true"
    CCACHE_BASEDIR: "/cache/gstreamer/cerbero/"
    CCACHE_DIR: "/cache/gstreamer/cerbero/ccache/"
    # shared across everything really
    CCACHE_MAXSIZE: "50G"

    CERBERO_HOME: "cerbero-build"
    CERBERO_SOURCES: "cerbero-sources"
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS}"
    CERBERO: "./cerbero-uninstalled -c config/${CONFIG} -c localconf.cbc"
    CERBERO_PACKAGE_ARGS: "-t"
    CERBERO_RUN_SUFFIX: "" # '.exe' on cross-winXX
    CERBERO_BOOTSTRAP_SYSTEM: "no"
    HAVE_CCACHE: "yes"
    # used by macos packages as we only ever install to a fixed directory
    CERBERO_OVERRIDDEN_DIST_DIR: ""
    # location where the cerbero git repo is stored on the image
    CERBERO_HOST_DIR: "/"
  before_script:
    - echo $CI_PIPELINE_SOURCE
    # cmake takes forever to bootstrap from source
    - test $(uname) = Darwin && pip3 install cmake==3.24.*
    - ./ci/cerbero_setup.sh cerbero_before_script
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - "${CERBERO_SOURCES}"
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "*/logs"
      - "*/sources/*/*/_builddir/meson-logs/meson-log.txt"
      - "*/sources/*/*/_builddir/CMakeFiles/CMakeError.log"
      - "*/sources/*/*/_builddir/CMakeFiles/CMakeLog.log"
      - "*.tar.*"

# Template for Cerbero GStreamer Deps
#
# This template is used by cerbero/ project to pre-built the GStreamer
# dependencies. When available, the .cerbero jobs will download this artifact
# in order to speed up the build.
#
# Parameters:
# CONFIG: The name of the configuration file to use
# ARCH: The cerbero <os>_<cpu> (used in cache key)
#
# Produce an artifact with the dist/ and .cache along
# with the associated build-tools.
.cerbero deps:
  extends: .cerbero
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED != "true" || $CI_PROJECT_NAMESPACE != "gstreamer"'
  script:
    - ./ci/cerbero_setup.sh cerbero_deps_script

# Template for Cerbero GStreamer MR Pipelines
#
# This template is used when a cerbero pipeline is triggered by a merge request
# in another project such as gstreamer running inside the GSTreamer namespace
# which implies that the default cerbero branch is used. In that case, we fetch
# a cache (if available) and use it instead of building from scratch.
.cerbero mr:
  extends: .cerbero
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED == "true" && $CI_PROJECT_NAMESPACE == "gstreamer"'
  script:
    - ./ci/cerbero_setup.sh cerbero_script
  # Don't interrupt gstreamer MR CI when cerbero main gets pushes
  interruptible: false

#
# Cerbero Linux X86_64 build
#
cerbero deps fedora x86_64:
  extends: '.cerbero deps'
  variables:
    CONFIG: "linux.config"
    ARCH: "linux_x86_64"

build cerbero fedora x86_64:
  extends: '.cerbero mr'
  variables:
    CONFIG: "linux.config"

#
# Cerbero Android Universal build
#
.cerbero cross-android universal:
  variables:
    CONFIG: "cross-android-universal.cbc"
    ARCH: "android_universal"
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "*/logs"
      - "*/sources/*/*/*/_builddir/meson-logs/meson-log.txt"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeError.log"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeLog.log"
      - "*[0-9].tar.*"

cerbero deps cross-android universal:
  extends:
    - '.cerbero deps'
    - '.cerbero cross-android universal'

build cerbero cross-android universal:
  extends:
    - '.cerbero mr'
    - '.cerbero cross-android universal'

#
# Cerbero Cross Windows builds
#
cerbero deps cross-windows x86:
  extends: '.cerbero deps'
  variables:
    CONFIG: "cross-win32.cbc"
    ARCH: "mingw_x86"
    CERBERO_RUN_SUFFIX: ".exe"

build cerbero cross win32:
  extends: '.cerbero mr'
  variables:
    CONFIG: "cross-win32.cbc"
    CERBERO_RUN_SUFFIX: ".exe"


cerbero deps cross-windows x86_64:
  extends: '.cerbero deps'
  variables:
    CONFIG: "cross-win64.cbc"
    ARCH: "mingw_x86_64"
    CERBERO_RUN_SUFFIX: ".exe"

build cerbero cross win64:
  extends: '.cerbero mr'
  variables:
    CONFIG: "cross-win64.cbc"
    CERBERO_RUN_SUFFIX: ".exe"

#
# Build an Android App using the android binaries
#
.cross-android universal examples:
  # Ensure that the runners it will be executed on
  # will have plenty of space for the cache
  tags: ['gstreamer']
  extends:
    - .android fedora image
    - .fdo.suffixed-image@fedora
  stage: 'integrate'
  variables:
    EXAMPLES_HOME: ${CI_PROJECT_DIR}/gstreamer/subprojects
    GSTREAMER_ROOT_ANDROID: ${CI_PROJECT_DIR}/cerbero-android-universal
  script:
    # Clone gstreamer repository to get gst-examples and gst-docs
    - rm -rf gstreamer
    - git clone $CI_GSTREAMER_URL -b $CI_GSTREAMER_REF_NAME --depth 1
    - mkdir -p ${EXAMPLES_HOME}/outputs

    # extract our binaries
    - rm -f gstreamer-1.0-android-universal-*-runtime.tar.*
    - mkdir ${GSTREAMER_ROOT_ANDROID}
    - time tar -C ${GSTREAMER_ROOT_ANDROID} -xf gstreamer-1.0-android-universal-*.tar.*

    # gst-examples - player
    - chmod +x ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew
    - ./ci/run_retry.sh ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/playback/player/android assembleDebug
    - cp ${EXAMPLES_HOME}/gst-examples/playback/player/android/app/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/

    # gst-examples - vulkan
    - chmod +x ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew
    - ./ci/run_retry.sh ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/vulkan/android assembleDebug
    - cp ${EXAMPLES_HOME}/gst-examples/vulkan/android/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/

    # gst-docs android tutorials
    - chmod +x ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew
    - ./ci/run_retry.sh ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android assembleDebug
    - cp ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/android-tutorial-*/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
  after_script:
    - rm -rf ${GSTREAMER_ROOT_ANDROID} gstreamer
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "${EXAMPLES_HOME}/outputs"

cross-android universal examples:
  extends: ".cross-android universal examples"
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED == "true" && $CI_PROJECT_NAMESPACE == "gstreamer"'
  needs:
    - "build cerbero cross-android universal"

cerbero cross-android universal examples:
  extends: ".cross-android universal examples"
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED != "true" || $CI_PROJECT_NAMESPACE != "gstreamer"'
  needs:
    - "cerbero deps cross-android universal"

#
# Cerbero macOS Universal build
#
.cerbero cross-macos universal:
  variables:
    ARCH: "darwin_universal"
    CONFIG: "cross-macos-universal.cbc"
    CERBERO_PACKAGE_ARGS: ""
    HAVE_CCACHE: ""
    CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
  tags:
    - gst-macos-13
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "*/logs"
      - "*/sources/*/*/*/_builddir/meson-logs/meson-log.txt"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeError.log"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeLog.log"
      - "gstreamer-1.0-1.*.pkg"
      - "gstreamer-1.0-devel-1.*.pkg"

cerbero deps cross-macos universal:
  extends:
    - '.cerbero deps'
    - '.cerbero cross-macos universal'

build cerbero cross-macos universal:
  extends:
    - '.cerbero mr'
    - '.cerbero cross-macos universal'

#
# Cerbero iOS build
#
.cerbero cross-ios universal:
  variables:
    ARCH: "ios_universal"
    CONFIG: "cross-ios-universal.cbc"
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
    CERBERO_PACKAGE_ARGS: ""
    HAVE_CCACHE: ""
    CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
  tags:
    - gst-ios-16
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "*/logs"
      - "*/sources/*/*/*/_builddir/meson-logs/meson-log.txt"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeError.log"
      - "*/sources/*/*/*/_builddir/CMakeFiles/CMakeLog.log"
      - "gstreamer-1.0-*-ios-universal.pkg"

cerbero deps cross-ios universal:
  extends:
    - '.cerbero deps'
    - '.cerbero cross-ios universal'

build cerbero cross-ios universal:
  extends:
    - '.cerbero mr'
    - '.cerbero cross-ios universal'

#
# Build an iOS App using the iOS binaries
#
.cross-ios universal examples:
  stage: 'integrate'
  variables:
    EXAMPLES_HOME: gstreamer/subprojects
    # disable codesigning so we don't need developer identities on the CI
    # machines
    XCODE_BUILD_ARGS: >
      CODE_SIGNING_REQUIRED="NO"
      CODE_SIGN_IDENTITY=""
      CODE_SIGNING_ALLOWED="NO"
      CODE_SIGN_ENTITLEMENTS=""
  script:
    # install the binaries
    - installer -pkg gstreamer-1.0-devel-*-ios-universal.pkg -target CurrentUserHomeDirectory -verbose

    # Clone gstreamer repository to get gst-examples and gst-docs
    - git clone $CI_GSTREAMER_URL -b $CI_GSTREAMER_REF_NAME --depth 1

    # dump some useful information
    - xcodebuild -version
    - xcodebuild -showsdks

    # gst-docs ios tutorials
    - ./ci/run_retry.sh xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj
    - ./ci/run_retry.sh xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj ${XCODE_BUILD_ARGS}

    # gst-examples
    - ./ci/run_retry.sh xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj
    - ./ci/run_retry.sh xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj ${XCODE_BUILD_ARGS}
  after_script:
    - rm -rf gstreamer
  tags:
    - gst-ios-16

cross-ios universal examples:
  extends: ".cross-ios universal examples"
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED == "true" && $CI_PROJECT_NAMESPACE == "gstreamer"'
  needs:
    - "build cerbero cross-ios universal"

cerbero cross-ios universal examples:
  extends: ".cross-ios universal examples"
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED != "true" || $CI_PROJECT_NAMESPACE != "gstreamer"'
  needs:
    - "cerbero deps cross-ios universal"

#
# Cerbero Native Windows builds
#
.cerbero windows native:
  image: $WINDOWS_IMAGE
  tags:
    - 'docker'
    - 'windows'
    - 'gstreamer-windows'
    - '2022'
  variables:
    CONFIG: 'win64.cbc'
    ARCH: 'msvc_x86_64'
    CERBERO_HOST_DIR: "C:/cerbero"
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v visualstudio -v nowerror"
    CERBERO_RUN_SUFFIX: ".exe"
    CERBERO_BOOTSTRAP_SYSTEM: "no"
    HAVE_CCACHE: ""
  before_script:
    - $env:CI_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\', '/')
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_before_script"

cerbero deps msvc x86_64:
  extends: ['.cerbero deps', '.cerbero windows native']
  script:
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_deps_script"

build cerbero msvc x86_64:
  extends: ['.cerbero mr', '.cerbero windows native']
  script:
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_script"

# FIXME: UWP build is disabled until build issues with latest GLib version are sorted out
cerbero deps uwp universal:
  extends: ['cerbero deps msvc x86_64']
  variables:
    CONFIG: 'cross-uwp-universal.cbc'
    ARCH: 'uwp_universal'
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
  script:
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_deps_script"
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && CERBERO_ARGS='$env:CERBERO_ARGS,vscrt=mdd' && ./ci/cerbero_setup.sh cerbero_deps_script"
  when: 'manual'

# FIXME: UWP build is disabled until build issues with latest GLib version are sorted out
build cerbero uwp universal:
  extends: ['build cerbero msvc x86_64']
  variables:
    CONFIG: 'cross-uwp-universal.cbc'
    ARCH: 'uwp_universal'
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
  script:
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_script"
    - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && CERBERO_ARGS='$env:CERBERO_ARGS,vscrt=mdd' && ./ci/cerbero_setup.sh cerbero_script"
  when: 'manual'