summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 243483bd828c13edeb700269699db65446fbb9aa (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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
include:
  - project: 'freedesktop/ci-templates'
    ref: 'master'
    file: '/templates/fedora.yml'
  - project: 'freedesktop/ci-templates'
    ref: 'master'
    file: '/templates/ubuntu.yml'
  ###
  # 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.
  ###
  - local: '.gitlab-image-tags.yml'

stages:
  - 'build docker'
  - 'check sources'
  - '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: 'main'
  CI_GSTREAMER_URL: 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git'
  CI_GSTREAMER_TRIGGERED: 'false'
  GST_UPSTREAM_BRANCH: 'main'
  DEFAULT_CERBERO_ARGS: >
    --variants werror
    --clocktime
    --timestamps
  MESON_COMMIT:
    description: "Overwrite the meson version installed on the CI images with the specified meson commit"
    value: ""

workflow:
  # https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      variables:
        GIT_FETCH_EXTRA_FLAGS: '--no-tags'
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    - if: '$CI_COMMIT_TAG'
    - if: '$CI_COMMIT_BRANCH'
      variables:
        GIT_FETCH_EXTRA_FLAGS: '--no-tags'

#
# 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:
    FDO_DISTRIBUTION_TAG: "$FEDORA_TAG"
    FDO_DISTRIBUTION_VERSION: '37'
    FDO_DISTRIBUTION_PACKAGES: "sudo git-core lbzip2 rsync wine which python3-distro python3-distro-info"
    FDO_DISTRIBUTION_EXEC: ci/docker_setup.sh
    FDO_UPSTREAM_REPO: gstreamer/cerbero

.checks fedora image:
  variables:
    FDO_DISTRIBUTION_TAG: "$CHECKS_FEDORA_TAG"
    FDO_DISTRIBUTION_VERSION: '37'
    FDO_DISTRIBUTION_PACKAGES: "git-core python3-pip"
    FDO_DISTRIBUTION_EXEC: ci/checks_setup.sh
    FDO_UPSTREAM_REPO: gstreamer/cerbero
    FDO_REPO_SUFFIX: checks

.android fedora image:
  variables:
    FDO_DISTRIBUTION_TAG: "$ANDROID_FEDORA_TAG"
    FDO_DISTRIBUTION_VERSION: '37'
    FDO_DISTRIBUTION_PACKAGES: "file git-core java-11-openjdk-devel lbzip2 python3-distro python3-distro-info 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"

.ubuntu image:
  variables:
    FDO_DISTRIBUTION_TAG: "$UBUNTU_TAG"
    FDO_DISTRIBUTION_VERSION: "22.04"
    FDO_DISTRIBUTION_PACKAGES: >-
      bash
      ca-certificates
      curl
      git
      lbzip2
      python3-distro
      python3-distro-info
      python3-venv
      python3-setuptools
      rsync
      sudo
    FDO_DISTRIBUTION_EXEC: "ci/docker_setup.sh"
    FDO_UPSTREAM_REPO: "gstreamer/cerbero"

.manual trigger:
  rules:
    # If this pipeline is triggered from gstreamer, trigger the pipeline automatically
    - if: '$CI_PIPELINE_SOURCE == "pipeline"'
    # If this pipeline is triggered by a schedule, trigger the pipeline automatically
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
    # 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
  tags: [ 'placeholder-job' ]

checks fedora image:
  stage: "build docker"
  extends:
    - .checks fedora image
    - .fdo.container-build@fedora
  variables:
    GIT_STRATEGY: none
  tags: [ 'placeholder-job' ]

android fedora image:
  stage: "build docker"
  extends:
    - .manual trigger
    - .android fedora image
    - .fdo.container-build@fedora
  variables:
    GIT_STRATEGY: none
  tags: [ 'placeholder-job' ]

ubuntu image:
  stage: "build docker"
  extends:
    - .manual trigger
    - .ubuntu image
    - .fdo.container-build@ubuntu
  variables:
    GIT_STRATEGY: none
  tags: [ 'placeholder-job' ]

# Rules for when to use a specific job

# Used when a GStreamer MR is used using the triggered pipeline
.cerbero mr rules:
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED == "true"'
  # Don't interrupt gstreamer MR CI when cerbero main gets pushes
  interruptible: false

# Used when any other usage is encountered, cerbero MR, branch push, etc
.cerbero not-mr rules:
  rules:
    - if: '$CI_GSTREAMER_TRIGGERED != "true"'

# 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"
  # 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"
    # 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
    - test $(uname) = Linux && cat /proc/self/limits
  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.*"
    exclude:
      - .git
      - .git/**/*

.cerbero fedora base:
  extends:
    - .fedora image
    - .fdo.distribution-image@fedora
  needs:
    - "fedora image"

.cerbero ubuntu base:
  extends:
    - .ubuntu image
    - .fdo.distribution-image@ubuntu
  needs:
    - "ubuntu image"

# 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'
    - '.cerbero not-mr rules'
  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'
    - '.cerbero mr rules'
  script:
    - ./ci/cerbero_setup.sh cerbero_script

pre-commit checks:
  extends:
    - .checks fedora image
    - .fdo.suffixed-image@fedora
  needs:
    - "checks fedora image"
  stage: 'check sources'
  script:
    pre-commit run --all-files --show-diff-on-failure
  variables:
    PRE_COMMIT_HOME: '/cache/${CI_PROJECT_NAMESPACE}/pre-commit'
  tags: [ 'placeholder-job' ]

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

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

cerbero deps ubuntu x86_64:
  extends:
    - '.cerbero ubuntu base'
    - '.cerbero deps'
  variables:
    CONFIG: "linux.config"
    ARCH: "linux_x86_64"

build cerbero ubuntu x86_64:
  extends:
    - '.cerbero ubuntu base'
    - '.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.*"
    exclude:
      - .git
      - .git/**/*

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

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

#
# Cerbero Cross Windows builds
#

.cerbero deps cross-windows:
  extends:
    - '.cerbero fedora base'
    - '.cerbero deps'
  variables:
    CERBERO_RUN_SUFFIX: ".exe"
    CERBERO_PACKAGE_ARGS: ""
  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"
      - "*.msi"
    exclude:
      - .git
      - .git/**/*

cerbero deps cross-windows x86:
  extends: '.cerbero deps cross-windows'
  variables:
    CONFIG: "cross-win32.cbc"
    ARCH: "mingw_x86"

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

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

build cerbero cross win64:
  extends:
    - '.cerbero fedora base'
    - '.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:
    OUTPUT_DIR: ${CI_PROJECT_DIR}/outputs/
    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 gstreamer/
    - mkdir -p ${OUTPUT_DIR}

    # 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 ${OUTPUT_DIR}

    # 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 ${OUTPUT_DIR}

    # 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 ${OUTPUT_DIR}
  after_script:
    - rm -rf ${GSTREAMER_ROOT_ANDROID} gstreamer
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "${OUTPUT_DIR}"

cross-android universal examples:
  extends:
    - '.cross-android universal examples'
    - '.cerbero mr rules'
  needs:
    - "build cerbero cross-android universal"
    - "android fedora image"

cerbero cross-android universal examples:
  extends:
    - '.cross-android universal examples'
    - '.cerbero not-mr rules'
  needs:
    - "cerbero deps cross-android universal"
    - "android fedora image"

#
# 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/"
  cache: []
  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"
    exclude:
      - .git
      - .git/**/*

.cerbero macos arm64 image:
  image: "registry.freedesktop.org/gstreamer/cerbero/macos-arm64/14-sonoma:2023-10-25.2"
  tags:
    - gst-mac-arm

cerbero deps cross-macos universal arm64-host:
  extends:
    - '.cerbero deps'
    - '.cerbero cross-macos universal'
    - '.cerbero macos arm64 image'

build cerbero cross-macos universal arm64-host:
  extends:
    - '.cerbero mr'
    - '.cerbero cross-macos universal'
    - '.cerbero macos arm64 image'

#
# 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/"
  cache: []
  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"
    exclude:
      - .git
      - .git/**/*

cerbero deps cross-ios universal arm64-host:
  extends:
    - '.cerbero deps'
    - '.cerbero cross-ios universal'
    - '.cerbero macos arm64 image'

build cerbero cross-ios universal arm64-host:
  extends:
    - '.cerbero mr'
    - '.cerbero cross-ios universal'
    - '.cerbero macos arm64 image'

#
# 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 gstreamer/

    # dump some useful information
    - xcodebuild -version
    - xcodebuild -showsdks
    - echo ${XCODE_BUILD_ARGS} > xcode_buildargs

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

    # gst-examples
    - ./ci/run_retry.sh xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj $(cat xcode_buildargs)
    - ./ci/run_retry.sh xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj $(cat xcode_buildargs)
  after_script:
    - rm -rf gstreamer
  cache: []

cross-ios universal examples arm64-host:
  extends:
    - '.cross-ios universal examples'
    - '.cerbero macos arm64 image'
    - '.cerbero mr rules'
  needs:
    - "build cerbero cross-ios universal arm64-host"

cerbero cross-ios universal examples arm64-host:
  extends:
    - '.cross-ios universal examples'
    - '.cerbero macos arm64 image'
    - '.cerbero not-mr rules'
  needs:
    - "cerbero deps cross-ios universal arm64-host"

#
# Cerbero Native Windows builds
#
.cerbero windows native:
  image: $WINDOWS_IMAGE
  tags:
    - 'docker'
    - 'windows'
    - 'gstreamer-windows'
    - '2022'
  variables:
    CONFIG: 'win64.cbc'
    CERBERO_HOST_DIR: "C:/cerbero"
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
    CERBERO_RUN_SUFFIX: ".exe"
    CERBERO_BOOTSTRAP_SYSTEM: "no"
    HAVE_CCACHE: ""
  before_script:
    # Test that the powershell script works
    - ./cerbero-uninstalled --help
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_before_script"

cerbero deps msvc x86_64:
  extends: ['.cerbero deps', '.cerbero windows native']
  variables:
    ARCH: 'msvc_x86_64'
  script:
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_deps_script"
  rules:
    # This is an extended rule of .cerbero not-mr rules
    - if: ($CI_GSTREAMER_TRIGGERED != "true") && $CI_PIPELINE_SOURCE != "schedule"
    # Don't run automatically for scheduled pipeline
    - if: ($CI_GSTREAMER_TRIGGERED != "true") && $CI_PIPELINE_SOURCE == "schedule"
      when: 'manual'
      # workaround for gitlab bug where it otherwise blocks the pipeline for manual jobs from rules
      allow_failure: true

cerbero deps mingw x86_64:
  extends: ['.cerbero deps', '.cerbero windows native']
  variables:
    ARCH: 'mingw_x86_64'
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror,mingw"
  script:
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_deps_script"
  when: 'manual'

cerbero deps msvc x86_64 msi package:
  extends: ['.cerbero deps', '.cerbero windows native']
  variables:
    CERBERO_PACKAGE_ARGS: ""
  script:
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_deps_script"
  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"
      - "*.msi"
    exclude:
      - .git
      - .git/**/*
  rules:
    # This is an extended rule of .cerbero not-mr rules
    # Run automatically if it's a scheduled pipeline
    - if: ($CI_GSTREAMER_TRIGGERED != "true") && $CI_PIPELINE_SOURCE == "schedule"
    # Otherwise require manual trigger
    - if: ($CI_GSTREAMER_TRIGGERED != "true") && $CI_PIPELINE_SOURCE != "schedule"
      when: 'manual'
      # workaround for gitlab bug where it otherwise blocks the pipeline for manual jobs from rules
      allow_failure: true

cerbero deps msvc x86 msi package:
  extends: ['cerbero deps msvc x86_64 msi package']
  variables:
    ARCH: 'msvc_x86'
    CONFIG: 'win32.cbc'

build cerbero msvc x86_64:
  extends: ['.cerbero mr', '.cerbero windows native']
  script:
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_script"

build cerbero mingw x86_64:
  extends: ['.cerbero mr', '.cerbero windows native']
  variables:
    ARCH: 'mingw_x86_64'
    CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror,mingw"
  script:
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_script"
  when: 'manual'

# 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:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_deps_script"
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "CERBERO_ARGS='$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:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "./ci/cerbero_setup.sh cerbero_script"
    - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "CERBERO_ARGS='$CERBERO_ARGS,vscrt=mdd' && ./ci/cerbero_setup.sh cerbero_script"
  when: 'manual'