5fdf2a202a0f30cf23d8a8046afcdb2085ce213f
[platform/upstream/gstreamer.git] / gitlab / ci_template.yml
1 include:
2   - template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
3
4 stages:
5   - 'build docker'
6   - 'preparation'
7   - 'pre-build'
8   - 'build'
9   - 'test'
10   # Use the resulting binaries
11   - 'integrate'
12
13 variables:
14   # Branch to track for modules that have no ref specified in the manifest
15   GST_UPSTREAM_BRANCH: 'master'
16   ORC_UPSTREAM_BRANCH: 'master'
17
18   ###
19   # IMPORTANT
20   # These are the version tags for the docker images the CI runs against.
21   # If you are hacking on them or need a them to rebuild, its enough
22   # to change any part of the string of the image you want.
23   ###
24   FEDORA_TAG:  '2020-09-15.0'
25   CERBERO_TAG: '2020-09-09.2'
26   ANDROID_TAG: '2020-09-09.2'
27   MANIFEST_TAG: '2020-06-25.0'
28   TEST_MANIFEST_TAG: '2020-06-25.0'
29   INDENT_TAG: '2020-06-29.0'
30
31   GST_UPSTREAM_REPO: 'gstreamer/gst-ci'
32
33   FEDORA_AMD64_SUFFIX:  'amd64/fedora'
34   CERBERO_AMD64_SUFFIX: 'amd64/cerbero-fedora'
35   ANDROID_AMD64_SUFFIX: 'amd64/android-fedora'
36   MANIFEST_AMD64_SUFFIX: 'amd64/build-manifest'
37   TEST_MANIFEST_AMD64_SUFFIX: 'amd64/test-manifest'
38   INDENT_AMD64_SUFFIX: 'amd64/gst-indent'
39
40   FEDORA_IMAGE:   "$CI_REGISTRY_IMAGE/$FEDORA_AMD64_SUFFIX:$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
41   FEDORA_DOCS_IMAGE: "registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2020-07-03.0-master"
42   CERBERO_IMAGE:  "$CI_REGISTRY_IMAGE/$CERBERO_AMD64_SUFFIX:$CERBERO_TAG-$GST_UPSTREAM_BRANCH"
43   ANDROID_IMAGE:  "$CI_REGISTRY_IMAGE/$ANDROID_AMD64_SUFFIX:$ANDROID_TAG-$GST_UPSTREAM_BRANCH"
44   MANIFEST_IMAGE: "$CI_REGISTRY_IMAGE/$MANIFEST_AMD64_SUFFIX:$MANIFEST_TAG-$GST_UPSTREAM_BRANCH"
45   TEST_MANIFEST_IMAGE: "$CI_REGISTRY_IMAGE/$TEST_MANIFEST_AMD64_SUFFIX:$TEST_MANIFEST_TAG-$GST_UPSTREAM_BRANCH"
46   INDENT_IMAGE:   "$CI_REGISTRY_IMAGE/$INDENT_AMD64_SUFFIX:$INDENT_TAG-$GST_UPSTREAM_BRANCH"
47
48   WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v12-master'
49
50   # Can't use $CI_* variables since we use this template in all repos, not just gst-ci
51   CERBERO_SCRIPT_URL: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/cerbero_setup.sh"
52
53   GIT_STRATEGY: none
54   MESON_BUILDTYPE_ARGS: --default-library=both
55   DEFAULT_MESON_ARGS: >
56     -Dlibnice:tests=disabled
57     -Dlibnice:examples=disabled
58     -Dopenh264:tests=disabled
59     -Dpygobject:tests=false
60     -Dpython=enabled
61     -Dlibav=enabled
62     -Dugly=enabled
63     -Dbad=enabled
64     -Ddevtools=enabled
65     -Dges=enabled
66     -Drtsp_server=enabled
67     -Dvaapi=enabled
68     -Dsharp=disabled
69
70   MESON_GST_WERROR: >
71     -Dgstreamer:werror=true
72     -Dgst-plugins-base:werror=true
73     -Dgst-plugins-good:werror=true
74     -Dgst-plugins-ugly:werror=true
75     -Dgst-plugins-bad:werror=true
76     -Dgst-rtsp-server:werror=true
77     -Dgst-libav:werror=true
78     -Dgst-examples:werror=true
79     -Dgst-editing-services:werror=true
80     -Dgst-docs:werror=true
81     -Dgst-omx:werror=true
82     -Dgst-devtools:werror=true
83     -Dgst-python:werror=true
84     -Dgstreamer-vaapi:werror=true
85     -Dgstreamer-sharp:werror=true
86
87   DEFAULT_CERBERO_ARGS: >
88     --variants werror
89     --timestamps
90
91 #
92 # Global CI policy
93 #
94 # This can be used to configure global behaviour our our jobs.
95 #
96 default:
97   retry:
98     max: 2
99     when:
100       - 'runner_system_failure'
101       - 'stuck_or_timeout_failure'
102       - 'scheduler_failure'
103       - 'api_failure'
104   interruptible: true
105
106
107 # Script to check if a docker image exists in the upstream registry
108 # and if so copy it to the forked registry so we can use it
109 #
110 # This is copied/adapted from citemplates/templates/fedora.yml
111 # https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
112 .check_image: &check_image_exists |
113   # if-not-exists steps
114   set -x
115
116   if [[ -z "$GST_FORCE_REBUILD" ]]
117   then
118     # disable exit on failure
119     set +e
120
121     # check if our image is already in the current registry
122     # we store the sha of the digest and the layers
123     skopeo inspect docker://$LOCAL_IMAGE | jq '[.Digest, .Layers]' > local_sha
124
125     # check if our image is already in our gst-ci registry fork
126     skopeo inspect docker://$LOCAL_GST_CI_IMAGE | jq '[.Digest, .Layers]' > local_gst_ci_sha
127
128     # check if our image is already in the upstream registry
129     if [[ -z "$GST_UPSTREAM_REPO" ]]
130     then
131       echo "WARNING! Variable \$GST_UPSTREAM_REPO is undefined, cannot check for images"
132     else
133       skopeo inspect docker://$GST_UPSTREAM_IMAGE | jq '[.Digest, .Layers]' > upstream_sha
134     fi
135
136     # reenable exit on failure
137     set -e
138
139     # if the upstream repo has an image, ensure we use the same
140     if [ -s upstream_sha ]
141     then
142
143       echo "Checking if $LOCAL_IMAGE is up to date"
144       # ensure we use the same image from upstream
145       diff upstream_sha local_sha && exit 0 || true
146
147       echo "Copying image from gstreamer/gst-ci to local registry"
148       # copy the original image into the current project registry namespace
149       # we do 2 attempts with skopeo copy at most
150       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
151                   docker://$GST_UPSTREAM_IMAGE \
152                   docker://$LOCAL_IMAGE || \
153       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
154                   docker://$GST_UPSTREAM_IMAGE \
155                   docker://$LOCAL_IMAGE
156
157       exit 0
158     fi
159
160     set +x
161
162     # if the local ci fork repo has an image, ensure we use the same
163     if [ -s local_gst_ci_sha ]
164     then
165       echo "Checking if $LOCAL_GST_CI_IMAGE is up to date"
166       # ensure we use the same image from upstream
167       diff local_gst_ci_sha local_sha && exit 0 || true
168
169       echo "Copying image from $CI_PROJECT_NAMESPACE/gst-ci to local registry"
170       # copy the original image into the current project registry namespace
171       # we do 2 attempts with skopeo copy at most
172       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
173                   docker://$LOCAL_GST_CI_IMAGE \
174                   docker://$LOCAL_IMAGE || \
175       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
176                   docker://$LOCAL_GST_CI_IMAGE \
177                   docker://$LOCAL_IMAGE
178
179       exit 0
180     fi
181
182     # if we have a local image but none in the upstream repo, use our
183     if [ -s local_sha ]
184     then
185       echo "Using $LOCAL_IMAGE"
186       exit 0
187     fi
188   fi
189
190
191 # Build docker images from Dockerfiles
192 #
193 # This is copied/adapted from citemplates/templates/fedora.yml
194 # https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
195 #
196 # CITemplates builds uses buildah run/commit workflow to build the images which doesn't
197 # fit us atm and our images need further adjustment to make use of it. Porting to
198 # ci-templates is the next step though.
199 #
200 # All the documentation from citemplates should be applicable here, so please refer there
201 .base:
202   image: "$CI_REGISTRY/freedesktop/ci-templates/buildah:2020-07-20.1"
203   variables:
204     STORAGE_DRIVER: 'vfs'
205     BUILDAH_FORMAT: 'docker'
206     BUILDAH_ISOLATION: 'chroot'
207
208     GIT_STRATEGY: fetch
209   script:
210     - export LOCAL_IMAGE="$CI_REGISTRY_IMAGE/$REPO_SUFFIX:$TAG"
211     - export LOCAL_GST_CI_IMAGE="$CI_REGISTRY/$CI_PROJECT_NAMESPACE/gst-ci/$REPO_SUFFIX:$TAG"
212     - export GST_UPSTREAM_IMAGE="$CI_REGISTRY/$GST_UPSTREAM_REPO/$REPO_SUFFIX:$TAG"
213
214     # check if the docker registry is enabled, else the variable will be missing
215     - |
216       if [[ -z "$CI_REGISTRY_IMAGE" ]]
217       then
218         echo "ERROR! Looks like your repository/fork has disabled Docker Registries."
219         echo "Pleae enable them by following the documentation from here:"
220         echo "https://docs.gitlab.com/ee/user/packages/container_registry/#enable-the-container-registry-for-your-project"
221         exit 1
222       fi
223
224     # Newer versions of podman/buildah try to set overlayfs mount options when
225     # using the vfs driver, and this causes errors.
226     - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
227
228     - *check_image_exists
229
230     # This part of the job should only ever be possible to be reach in a gst-ci fork
231     - |
232       if [[ "$CI_PROJECT_NAME" != 'gst-ci' ]]
233       then
234         echo "ERROR! Something is wrong!"
235         echo "This part of the job is supposed to be executed only in gst-ci forks, and its probably going to fail else"
236         exit 1
237       fi
238
239     - echo "Building image $LOCAL_IMAGE"
240
241     - >
242       buildah bud
243       --build-arg DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH
244       --label ci.job_id=$CI_JOB_ID
245       --label pipeline.url=$CI_PIPELINE_URL
246       --label git.ref_name=$CI_COMMIT_REF_NAME
247       --label git.sha=$CI_COMMIT_SHA
248       --label gitlab.project_path=$CI_PROJECT_PATH
249       --label gitlab.project_url=$CI_PROJECT_URL
250       --label fdo.upstream-repo=$GST_UPSTREAM_REPO
251       --label fdo.expires-after="3w"
252       -f $DOCKERFILE
253       -t $LOCAL_IMAGE
254       $CONTEXT_DIR
255
256     - buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
257
258     # Sanity check
259     - |
260       if [ "$CI_PROJECT_PATH" = "gstreamer/gst-ci" ]; then
261         if [ "$LOCAL_IMAGE" != "$GST_UPSTREAM_IMAGE" ]; then
262           echo "ERROR!!! AAAAA! THE IMAGE URI DOES NOT MATCH THE EXPECTED UPSTREAM ONE"
263           echo $LOCAL_IMAGE
264           echo $GST_UPSTREAM_IMAGE
265           exit 1
266         fi
267       fi
268
269     -  buildah push $LOCAL_IMAGE
270
271 fedora amd64 docker:
272   stage: "build docker"
273   variables:
274     REPO_SUFFIX: "$FEDORA_AMD64_SUFFIX"
275     TAG: "$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
276
277     CONTEXT_DIR: "./docker/fedora/"
278     DOCKERFILE: "docker/fedora/Dockerfile"
279   extends: .base
280
281 cerbero fedora amd64 docker:
282   stage: "build docker"
283   variables:
284     REPO_SUFFIX: "$CERBERO_AMD64_SUFFIX"
285     TAG: "$CERBERO_TAG-$GST_UPSTREAM_BRANCH"
286
287     CONTEXT_DIR: "docker/cerbero/"
288     DOCKERFILE: "docker/cerbero/Dockerfile-fedora"
289   extends: .base
290
291 android docker:
292   stage: "build docker"
293   variables:
294     REPO_SUFFIX: "$ANDROID_AMD64_SUFFIX"
295     TAG: "$ANDROID_TAG-$GST_UPSTREAM_BRANCH"
296
297     CONTEXT_DIR: "docker/android/"
298     DOCKERFILE: "docker/android/Dockerfile"
299   extends: .base
300
301 alpine amd64 manifest builder docker:
302   stage: "build docker"
303   variables:
304     REPO_SUFFIX: "$MANIFEST_AMD64_SUFFIX"
305     TAG: '$MANIFEST_TAG-$GST_UPSTREAM_BRANCH'
306
307     CONTEXT_DIR: "docker/build_manifest/"
308     DOCKERFILE: "docker/build_manifest/Dockerfile"
309   extends: .base
310
311 gst-indent amd64 docker:
312   stage: "build docker"
313   variables:
314     REPO_SUFFIX: "$INDENT_AMD64_SUFFIX"
315     TAG: "$INDENT_TAG-$GST_UPSTREAM_BRANCH"
316
317     CONTEXT_DIR: "docker/indent/"
318     DOCKERFILE: "docker/indent/Dockerfile"
319   extends: .base
320
321 #
322 # Job to create the manifest.xml to used for our builds
323 #
324 manifest:
325   image: $MANIFEST_IMAGE
326   rules:
327     # Always have automatic pipeline for branchs in cerbero and docs
328     # cause they need to update artifacts, like the docs site or cerbero deps
329     - if: '$CI_PROJECT_PATH == "gstreamer/cerbero"'
330     - if: '$CI_PROJECT_PATH == "gstreamer/gst-docs"'
331
332     # If the user that triggered the Pipeline is the Merge bot and the branch doesn't match
333     # the upstream branch set, run the pipeline
334     - if: '$GITLAB_USER_LOGIN == "gstreamer-merge-bot" && $CI_COMMIT_BRANCH != "$GST_UPSTREAM_BRANCH"'
335     # When the user isn't the merge bot, require an explicit action to trigger the pipeline
336     # to avoid wasting CI resources
337     - if: '$GITLAB_USER_LOGIN != "gstreamer-merge-bot"'
338       when: 'manual'
339     # If this matches, it means the pipeline is running against either the main
340     # or a stable branch, so make it manual
341     - if: '$CI_COMMIT_BRANCH == "$GST_UPSTREAM_BRANCH"'
342       when: 'manual'
343
344   stage: 'preparation'
345   script:
346     - cd /gst-ci
347     - gitlab/build_manifest.py --self-update
348     - gitlab/build_manifest.py ${CI_PROJECT_DIR}/manifest.xml
349     - cat ${CI_PROJECT_DIR}/manifest.xml
350   artifacts:
351     expire_in: "7 days"
352     paths:
353       - "manifest.xml"
354
355 #
356 # gst-indent!!
357 #
358 gst indent:
359   image: $INDENT_IMAGE
360   stage: 'preparation'
361   variables:
362     GIT_STRATEGY: 'fetch'
363   rules:
364     - if: '$CI_PROJECT_NAME !~ /^(gstreamer-sharp|gst-integration-testsuites|cerbero|gst-docs)$/'
365   script:
366     # man indent. grep RETURN VALUE, grab a beer on my behalf...
367     - indent --version || true
368     - |
369       filter_cmd=("cat")
370       if test -f ".indentignore"; then
371           filter_args=()
372           while read -r line; do
373               if test -n "$line"; then
374                   filter_args+=("-e" "$line")
375               fi
376           done < ".indentignore"
377           if [[ ${#filter_args[@]} -gt 0 ]]; then
378               filter_cmd=("grep" "-v" "${filter_args[@]}")
379           fi
380       fi
381       find . -name '*.c' | "${filter_cmd[@]}" | xargs -d '\n' gst-indent
382     - |
383       if git diff --quiet; then
384           echo "Code is properly formatted"
385       else
386           git diff --color=always
387           echo 'style diverges, please run gst-indent first'
388           exit 1
389       fi
390
391 #
392 # gst-build setup templates
393 #
394 .gst_build_template: &gst_build
395   - echo $MESON_ARGS
396   # Sometimes, gitlab-runner want to reuse
397   # existing docker volumes without cleaning them up...
398   # Make sure the docker volume is clean
399   - rm -rf gst-build || true
400   - rm -rf meson-logs || true
401   - rm -rf validate-logs || true
402
403   - curl -L -o clone_manifest_ref.py "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py"
404   - python3 clone_manifest_ref.py --manifest manifest.xml --project gst-build --destination gst-build
405   - cd gst-build/
406   # only copy immediate directories. We don't want to modify .wrap files
407   - find /gst-build/subprojects/ -mindepth 1 -maxdepth 1 -type d -exec cp -r \{\} subprojects/ \;
408   - ./git-update --no-interaction --manifest="${CI_PROJECT_DIR}/manifest.xml"
409   - meson build/ $MESON_ARGS
410   - ninja -C build/
411   - ccache --show-stats
412
413 .gst_build_ccache_vars:
414   variables:
415     CCACHE_COMPILERCHECK: 'content'
416     CCACHE_COMPRESS: 'true'
417     CCACHE_BASEDIR: '/cache/gstreamer/gst-build'
418     CCACHE_DIR: '/cache/gstreamer/gst-build/ccache/'
419     # shared across everything really
420     CCACHE_MAXSIZE: '10G'
421     CARGO_HOME: '/cache/gstreamer/cargo'
422
423 .simple_fedora_build: &simple_build >-
424   ${DEFAULT_MESON_ARGS}
425   -Dsharp=enabled
426   -Domx=enabled
427   -Dgst-omx:target=generic
428   -Ddoc=disabled
429   -Drs=disabled
430   ${MESON_BUILDTYPE_ARGS}
431   ${MESON_GST_WERROR}
432
433 .build:
434   stage: 'build'
435   extends:
436     - '.gst_build_ccache_vars'
437   needs:
438     - "manifest"
439   # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
440   # Also need to take into account I/O of pulling docker images and uploading artifacts
441   timeout: '45min'
442   variables:
443     MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
444   rules:
445     - if: '$CI_PROJECT_NAME != "cerbero"'
446   script:
447     *gst_build
448   after_script:
449     - mv gst-build/build/meson-logs/ meson-logs
450     # Cleanup everything else to reduce the size
451     # of the docker volume we leave behind
452     - rm -rf gst-build
453   artifacts:
454     expire_in: "7 days"
455     when: "always"
456     paths:
457       - 'meson-logs/'
458       - 'manifest.xml'
459
460 .build fedora x86_64:
461   extends: '.build'
462   image: $FEDORA_IMAGE
463   variables:
464     MESON_ARGS: *simple_build
465   rules:
466     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-omx|gst-plugins-rs)$/'
467
468 build nodebug fedora x86_64:
469   extends: '.build'
470   image: $FEDORA_IMAGE
471   variables:
472     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
473   rules:
474     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
475
476 build static fedora x86_64:
477   extends: '.build fedora x86_64'
478   variables:
479     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
480   rules:
481     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
482
483 build static nodebug fedora x86_64:
484   extends: 'build nodebug fedora x86_64'
485   variables:
486     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
487   rules:
488     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
489
490 build clang fedora x86_64:
491   extends: '.build fedora x86_64'
492   variables:
493     CC: 'ccache clang'
494     CXX: 'ccache clang++'
495   rules:
496     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
497
498 .test:
499   stage: 'test'
500   extends:
501     - '.gst_build_ccache_vars'
502   needs:
503     - "manifest"
504   variables:
505     MESON_ARGS: *simple_build
506
507     # Disable colored output to avoid weird rendering issues
508     GST_DEBUG_NO_COLOR: "true"
509     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/validate-logs/"
510     GST_VALIDATE_LAUNCHER_FORCE_COLORS: "true"
511     TIMEOUT_FACTOR: "2"
512     CARGO_HOME: "/cache/gstreamer/cargo"
513     # Enable the fault handler so we get backtraces on segfaults.
514     # any non-empty string will do
515     PYTHONFAULTHANDLER: "enabled"
516   rules:
517     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-examples|gst-docs)$/'
518   script:
519     - *gst_build
520
521     - echo "-> Running ${TEST_SUITE}"
522     - >
523       ./gst-uninstalled.py
524       gst-validate-launcher ${TEST_SUITE}
525       --dump-on-failure
526       --mute
527       --shuffle
528       --no-display
529       --meson-no-rebuild
530       --timeout-factor "${TIMEOUT_FACTOR}"
531       --fail-on-testlist-change
532       -l "${CI_PROJECT_DIR}/validate-logs/"
533       --xunit-file "${CI_PROJECT_DIR}/validate-logs/xunit.xml"
534       ${EXTRA_VALIDATE_ARGS}
535   after_script:
536     - mv gst-build/build/meson-logs/ meson-logs
537     # Cleanup everything else to reduce the size
538     # of the docker volume we leave behind
539     - rm -rf gst-build
540   artifacts:
541     expire_in: '14 days'
542     when: always
543     paths:
544       - 'meson-logs/'
545       - 'validate-logs'
546       - 'manifest.xml'
547     reports:
548       junit:
549         - "validate-logs/*.xml"
550
551 .test fedora x86_64:
552   image: $FEDORA_IMAGE
553   extends: '.test'
554   tags: ['gstreamer']
555
556 check fedora:
557   extends: '.test fedora x86_64'
558   variables:
559     TEST_SUITE: "check.gst*"
560   rules:
561     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
562
563 integration testsuites fedora:
564   extends: '.test fedora x86_64'
565   parallel: 4
566   variables:
567     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --check-bugs --parts=${CI_NODE_TOTAL} --part-index=${CI_NODE_INDEX}"
568     TEST_SUITE: "validate ges"
569   rules:
570     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-examples|gst-omx|gstreamer-sharp|gst-plugins-rs)$/'
571
572 gstreamer-full:
573   extends: 'build static fedora x86_64'
574   stage: integrate
575   variables:
576     MESON_ARGS: >
577       --default-library=static
578       -Dauto_features=disabled
579       -Dgst-plugins-good:alpha=enabled
580       $MESON_GST_WERROR
581   rules:
582     - if: '$CI_PROJECT_NAME =~ /^(gst-build|gst-ci)$/'
583
584   after_script:
585   - cd gst-build/
586   - ninja -C build install
587   - export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib64/gstreamer-1.0/pkgconfig
588   - export LD_LIBRARY_PATH=/usr/local/lib64
589   - cd examples/static-plugins
590   - meson _build
591   - ninja -C _build
592   - meson test -C _build -v
593   artifacts:
594     expire_in: "7 days"
595     when: "always"
596     paths:
597       - 'gst-build/build/meson-logs/'
598       - 'gst-build/build/gstinitstaticplugins.c'
599
600 # Valgrind
601 .valgrind fedora x86_64:
602   extends: '.test fedora x86_64'
603   stage: 'test'
604   variables:
605     EXTRA_VALIDATE_ARGS: "--valgrind"
606
607 valgrind core:
608   extends: '.valgrind fedora x86_64'
609   variables:
610     TEST_SUITE: "check.gstreamer\\..*"
611   rules:
612     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-ci|gst-devtools)$/'
613
614 valgrind base:
615   extends: '.valgrind fedora x86_64'
616   variables:
617     TEST_SUITE: "check.gst-plugins-base\\..*"
618   rules:
619     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-ci|gst-devtools)$/'
620
621 valgrind good:
622   extends: '.valgrind fedora x86_64'
623   variables:
624     TEST_SUITE: "check.gst-plugins-good\\..*"
625     # take longer time due to splitmux unit test
626     TIMEOUT_FACTOR: "4"
627   rules:
628     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good|gst-ci|gst-devtools)$/'
629
630 valgrind ugly:
631   extends: '.valgrind fedora x86_64'
632   variables:
633     TEST_SUITE: "check.gst-plugins-ugly\\..*"
634   rules:
635     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-ugly|gst-ci|gst-devtools)$/'
636
637 valgrind bad:
638   extends: '.valgrind fedora x86_64'
639   variables:
640     TEST_SUITE: "check.gst-plugins-bad\\..*"
641   rules:
642     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good|gst-plugins-bad|gst-ci|gst-devtools)$/'
643
644 valgrind ges:
645   extends: '.valgrind fedora x86_64'
646   variables:
647     TEST_SUITE: "check.gst-editing-services\\..*"
648   rules:
649     - if: '$CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good|gst-editing-services|gst-ci|gst-devtools)$/'
650
651 # Template for Cerbero GStreamer Build
652 #
653 # Parameters:
654 # CONFIG: The name of the configuration file to use
655 # ARCH: The cerbero <os>_<cpu> (used in cache key)
656 #
657 .cerbero:
658   stage: "build"
659   image: $CERBERO_IMAGE
660   rules:
661     - if: '$CI_PROJECT_NAME == "cerbero"'
662   needs:
663     - "manifest"
664   # Ensure that the runners it will be executed on
665   # will have plenty of space for the cache
666   tags: ['gstreamer']
667   timeout: '3h'
668   variables:
669     CCACHE_COMPILERCHECK: "content"
670     CCACHE_COMPRESS: "true"
671     CCACHE_BASEDIR: "/cache/gstreamer/cerbero/"
672     CCACHE_DIR: "/cache/gstreamer/cerbero/ccache/"
673     # shared across everything really
674     CCACHE_MAXSIZE: "50G"
675
676     CERBERO_HOME: "cerbero-build"
677     CERBERO_SOURCES: "cerbero-sources"
678     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS}"
679     CERBERO: "./cerbero-uninstalled -c config/${CONFIG} -c localconf.cbc -m manifest.xml"
680     CERBERO_PACKAGE_ARGS: "-t"
681     CERBERO_RUN_WRAPPER: "" # 'wine' on cross-winXX
682     CERBERO_RUN_SUFFIX: "" # '.exe' on cross-winXX
683     HAVE_CCACHE: "yes"
684     # used by macos packages as we only ever install to a fixed directory
685     CERBERO_OVERRIDDEN_DIST_DIR: ""
686     # location where the cerbero git repo is stored on the image
687     CERBERO_HOST_DIR: "/cerbero/"
688   before_script:
689     - echo "Fetching ${CERBERO_SCRIPT_URL}"
690     - curl -L -o cerbero_script.sh "${CERBERO_SCRIPT_URL}"
691     - chmod +x cerbero_script.sh
692     - ./cerbero_script.sh cerbero_before_script
693   script:
694     - ./cerbero_script.sh cerbero_script
695   cache:
696     key: "${CI_JOB_NAME}"
697     paths:
698       - "${CERBERO_SOURCES}"
699   artifacts:
700     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
701     expire_in: '5 days'
702     when: 'always'
703     paths:
704       - "manifest.xml"
705       - "${CERBERO_HOME}/logs"
706       - "*.tar.*"
707
708 .build windows:
709   image: $WINDOWS_IMAGE
710   stage: 'build'
711   needs:
712     - 'manifest'
713   tags:
714     - 'docker'
715     - 'windows'
716     - '1809'
717   timeout: '45min'
718   variables:
719     MESON_ARGS: >
720       ${DEFAULT_MESON_ARGS}
721       -Dpython=disabled
722       -Dlibav=disabled
723       -Dvaapi=disabled
724       -Ddevtools=disabled
725   rules:
726     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs|gstreamer-vaapi)$/'
727   script:
728     # Sometimes there's seems to be an existing gst-build clone that comes either from the ether or
729     # from a previous job due to some gitlab bug or implicit behavior?
730     # So let's always check and clear it out if its there
731     # https://gitlab.freedesktop.org/tpm/gstreamer-sharp/-/jobs/1672137
732     - if (Test-Path $env:CI_PROJECT_DIR/gst-build) { Remove-Item -Recurse -Force $env:CI_PROJECT_DIR/gst-build }
733
734     # Make sure powershell exists on errors
735     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
736     - $ErrorActionPreference = "Stop"
737
738     - Invoke-WebRequest -Uri "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/$env:GST_UPSTREAM_BRANCH/gitlab/clone_manifest_ref.py" -OutFile $env:CI_PROJECT_DIR/clone_manifest_ref.py
739     - python clone_manifest_ref.py --manifest manifest.xml --project gst-build --destination $env:CI_PROJECT_DIR/gst-build
740     - cd $env:CI_PROJECT_DIR/gst-build
741
742     - cp -r C:/subprojects/* subprojects/
743     # Run the git-update script and feed it the manifest to setup the environment
744     - cd $env:CI_PROJECT_DIR/gst-build;  python git-update --no-interaction --manifest=$env:CI_PROJECT_DIR/manifest.xml
745     # For some reason, options are separated by newline instead of space, so we
746     # have to replace them first.
747     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
748     # Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script.
749     # Environment variables substitutions is done by PowerShell before calling
750     # cmd.exe, that's why we use $env:FOO instead of %FOO%
751     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
752         meson build $env:MESON_ARGS &&
753         ninja -C build"
754   # XXX: Re-enable when uploading stops timing out
755   #artifacts:
756   #  expire_in: "7 days"
757   #  when: "always"
758   #  paths:
759   #    - 'gst-build/build/meson-logs/'
760
761 build vs2017 amd64:
762   extends: '.build windows'
763   variables:
764     ARCH: 'amd64'
765
766 build vs2017 x86:
767   extends: '.build windows'
768   variables:
769     ARCH: 'x86'
770
771 build msys2 :
772   extends: '.build windows'
773   timeout: '60min'
774   rules:
775     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs|gstreamer-vaapi)$/'
776       allow_failure: true
777       when: 'manual'
778   script:
779     # Sometimes there's seems to be an existing gst-build clone that comes either from the ether or
780     # from a previous job due to some gitlab bug or implicit behavior?
781     # So let's always check and clear it out if its there
782     # https://gitlab.freedesktop.org/tpm/gstreamer-sharp/-/jobs/1672137
783     - if (Test-Path $env:CI_PROJECT_DIR/gst-build) { Remove-Item -Recurse -Force $env:CI_PROJECT_DIR/gst-build }
784
785     # Make sure powershell exists on errors
786     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
787     - $ErrorActionPreference = "Stop"
788
789     # For some reason docker build hangs if this is included in the image, needs more troubleshooting
790     - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
791     # Copied from https://github.com/msys2/setup-msys2/blob/master/main.js#L98
792     - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
793     - C:\msys64\usr\bin\bash -c "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
794     - echo "Updating MSYS2"
795     - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm || echo Update failed, ignoring"
796     - echo "Killing all MSYS2 processes"
797     - taskkill /F /FI "MODULES eq msys-2.0.dll"
798     - echo "Completing MSYS2 update"
799     - C:\msys64\usr\bin\bash -c "pacman -Suu --noconfirm"
800     - echo "Installing needed MSYS2 packages"
801     - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
802
803     - Invoke-WebRequest -Uri "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/$env:GST_UPSTREAM_BRANCH/gitlab/clone_manifest_ref.py" -OutFile $env:CI_PROJECT_DIR/clone_manifest_ref.py
804     - python clone_manifest_ref.py --manifest manifest.xml --project gst-build --destination $env:CI_PROJECT_DIR/gst-build
805     - cd $env:CI_PROJECT_DIR/gst-build
806
807     - cp -r C:\subprojects\* subprojects\
808
809     # Run the git-update script and feed it the manifest to setup the environment
810     - cd $env:CI_PROJECT_DIR/gst-build; python git-update --no-interaction --manifest=$env:CI_PROJECT_DIR/manifest.xml
811     # For some reason, options are separated by newline instead of space, so we
812     # have to replace them first.
813     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
814     # Replace forward slashes with backwards so bash doesn't complain
815     - $env:_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
816     - C:\msys64\usr\bin\bash -c "cd $env:_PROJECT_DIR/gst-build &&
817         meson build $env:MESON_ARGS &&
818         ninja -C build"
819
820
821 # Template for Cerbero GStreamer Deps
822 #
823 # This template is used by cerbero/ project to pre-built the GStreamer
824 # dependencies. When available, the .cerbero jobs will download this artifact
825 # in order to speed up the build.
826 #
827 # Parameters:
828 # CONFIG: The name of the configuration file to use
829 # ARCH: The cerbero <os>_<cpu> (used in cache key)
830 #
831 # Produce an artifact with the dist/ and .cache along
832 # with the associated build-tools.
833 .cerbero deps:
834   extends: .cerbero
835   rules:
836     - if: '$CI_PROJECT_NAME == "cerbero"'
837   script:
838     - ./cerbero_script.sh cerbero_deps_script
839
840 #
841 # Cerbero Linux X86_64 build
842 #
843 cerbero deps fedora x86_64:
844   extends: '.cerbero deps'
845   variables:
846     CONFIG: "linux.config"
847     ARCH: "linux_x86_64"
848
849 build cerbero fedora x86_64:
850   extends: '.cerbero'
851   rules:
852     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
853   variables:
854     CONFIG: "linux.config"
855
856 #
857 # Cerbero Android Universal build
858 #
859 .cerbero cross-android universal:
860   variables:
861     CONFIG: "cross-android-universal.cbc"
862     ARCH: "android_universal"
863   artifacts:
864     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
865     expire_in: '5 days'
866     when: 'always'
867     paths:
868       - "manifest.xml"
869       - "${CERBERO_HOME}/logs"
870       - "*[0-9].tar.*"
871
872 cerbero deps cross-android universal:
873   extends:
874     - '.cerbero deps'
875     - '.cerbero cross-android universal'
876
877 build cerbero cross-android universal:
878   extends:
879     - '.cerbero'
880     - '.cerbero cross-android universal'
881   rules:
882     - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME && $CI_PROJECT_NAME == "gst-docs"'
883     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
884
885 #
886 # Cerbero Cross Windows builds
887 #
888 cerbero deps cross-windows x86:
889   extends: '.cerbero deps'
890   variables:
891     CONFIG: "cross-win32.cbc"
892     ARCH: "mingw_x86"
893
894 build cerbero cross win32:
895   extends: '.cerbero'
896   rules:
897     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
898   variables:
899     CONFIG: "cross-win32.cbc"
900     CERBERO_RUN_WRAPPER: "wine"
901     CERBERO_RUN_SUFFIX: ".exe"
902
903
904 cerbero deps cross-windows x86_64:
905   extends: '.cerbero deps'
906   variables:
907     CONFIG: "cross-win64.cbc"
908     ARCH: "mingw_x86_64"
909
910 build cerbero cross win64:
911   extends: '.cerbero'
912   rules:
913     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
914   variables:
915     CONFIG: "cross-win64.cbc"
916     CERBERO_RUN_WRAPPER: "wine"
917     CERBERO_RUN_SUFFIX: ".exe"
918
919 #
920 # Build an Android App using the android binaries
921 #
922 .cross-android universal examples:
923   image: $ANDROID_IMAGE
924   stage: 'integrate'
925   variables:
926     EXAMPLES_HOME: ${CI_PROJECT_DIR}/examples
927     GSTREAMER_ROOT_ANDROID: ${CI_PROJECT_DIR}/examples/cerbero-android-universal
928   script:
929     - mkdir -p ${EXAMPLES_HOME}/outputs
930     - curl -L -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py
931     - chmod +x clone_manifest_ref.py
932     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-examples --destination ${EXAMPLES_HOME}/gst-examples
933     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-docs --destination ${EXAMPLES_HOME}/gst-docs
934     - rm clone_manifest_ref.py
935
936     # extract our binaries
937     - rm -f gstreamer-1.0-android-universal-*-runtime.tar.*
938     - mkdir ${GSTREAMER_ROOT_ANDROID}
939     - time tar -C ${GSTREAMER_ROOT_ANDROID} -xf gstreamer-1.0-android-universal-*.tar.*
940
941     # gst-examples - player
942     - chmod +x ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew
943     - ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/playback/player/android assembleDebug
944     - cp ${EXAMPLES_HOME}/gst-examples/playback/player/android/app/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
945
946     # gst-examples - vulkan
947     - chmod +x ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew
948     - ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/vulkan/android assembleDebug
949     - cp ${EXAMPLES_HOME}/gst-examples/vulkan/android/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
950
951     # gst-docs android tutorials
952     - chmod +x ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew
953     - ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android assembleDebug
954     - cp ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/android-tutorial-*/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
955   after_script:
956     - rm -rf ${GSTREAMER_ROOT_ANDROID}
957     - rm -rf ${EXAMPLES_HOME}/gst-examples ${EXAMPLES_HOME}/gst-docs
958   artifacts:
959     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
960     expire_in: '5 days'
961     when: 'always'
962     paths:
963       - "manifest.xml"
964       - "${EXAMPLES_HOME}/outputs"
965
966 cross-android universal examples:
967   extends: ".cross-android universal examples"
968   rules:
969     - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME && $CI_PROJECT_NAME == "gst-docs"'
970     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
971   needs:
972     - "build cerbero cross-android universal"
973
974 cerbero cross-android universal examples:
975   extends: ".cross-android universal examples"
976   rules:
977     - if: '$CI_PROJECT_NAME == "cerbero"'
978   needs:
979     - "cerbero deps cross-android universal"
980
981 #
982 # Cerbero macOS X86_64 build
983 #
984 .cerbero macos x86_64:
985   variables:
986     ARCH: "darwin_x86_64"
987     CONFIG: "osx-x86-64.cbc"
988     CERBERO_PACKAGE_ARGS: ""
989     HAVE_CCACHE: ""
990     CERBERO_OVERRIDDEN_DIST_DIR: "/Library/Frameworks/GStreamer.framework/Versions/1.0"
991     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
992   tags:
993     - gst-macos-10.15
994   artifacts:
995     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
996     expire_in: '5 days'
997     when: 'always'
998     paths:
999       - "manifest.xml"
1000       - "${CERBERO_HOME}/logs"
1001       - "gstreamer-1.0-1.*.pkg"
1002       - "gstreamer-1.0-devel-1.*.pkg"
1003
1004 cerbero deps macos x86_64:
1005   extends:
1006     - '.cerbero deps'
1007     - '.cerbero macos x86_64'
1008
1009 build cerbero macos x86_64:
1010   extends:
1011     - '.cerbero'
1012     - '.cerbero macos x86_64'
1013   rules:
1014     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gst-sharp|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
1015
1016 #
1017 # Cerbero iOS build
1018 #
1019 .cerbero cross-ios universal:
1020   variables:
1021     ARCH: "ios_universal"
1022     CONFIG: "cross-ios-universal.cbc"
1023     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
1024     CERBERO_PACKAGE_ARGS: ""
1025     HAVE_CCACHE: ""
1026     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
1027   tags:
1028     - gst-ios-13.2
1029   artifacts:
1030     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
1031     expire_in: '5 days'
1032     when: 'always'
1033     paths:
1034       - "manifest.xml"
1035       - "${CERBERO_HOME}/logs"
1036       - "gstreamer-1.0-*-ios-universal.pkg"
1037
1038 cerbero deps cross-ios universal:
1039   extends:
1040     - '.cerbero deps'
1041     - '.cerbero cross-ios universal'
1042
1043 build cerbero cross-ios universal:
1044   extends:
1045     - '.cerbero'
1046     - '.cerbero cross-ios universal'
1047   rules:
1048     - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME && $CI_PROJECT_NAME == "gst-docs"'
1049     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gst-sharp|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
1050
1051 documentation:
1052   image: $FEDORA_DOCS_IMAGE
1053   extends:
1054     - '.gst_build_ccache_vars'
1055   rules:
1056     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-integration-testsuites|gst-plugins-rs|gst-python)$/'
1057   needs:
1058     - "manifest"
1059   stage: integrate
1060   variables:
1061     MESON_ARGS: *simple_build
1062     MESON_BUILDTYPE_ARGS: "-Ddoc=enabled"
1063     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
1064   script:
1065   - pip3 install --upgrade git+https://github.com/hotdoc/hotdoc@28ad9aa59daa49d6b3fd1bc6b144df52af39475b
1066
1067   # FIXME: remove this once the docs image is updated
1068   - rm -rf /gst-build/subprojects/pygobject/
1069
1070   - *gst_build
1071   - ./gst-uninstalled.py ninja -C build/ plugins_doc_caches
1072   - |
1073     python3 -c "import os, subprocess, sys
1074     subprojects = [os.environ['CI_PROJECT_NAME']]
1075     if subprojects[0]  in ['gst-ci', 'gst-build']:
1076         subprojects = ['gstreamer', 'gst-plugins-ugly', 'gst-omx', 'gst-plugins-good', 'gst-plugins-base', 'gstreamer-vaapi', 'gst-libav', 'gst-editing-services', 'gst-rtsp-server', 'gst-plugins-bad',]
1077
1078     diffsdir = '../plugins-cache-diffs'
1079     os.makedirs(diffsdir, exist_ok=True)
1080     res = 0
1081     for subproject in subprojects:
1082         cwd = os.path.join('subprojects', subproject)
1083         try:
1084             subprocess.check_call(['git', 'diff', '--quiet'], cwd=cwd)
1085         except subprocess.CalledProcessError:
1086             diffname = os.path.join(diffsdir, '%s_cache.diff' % subproject)
1087             res += 1
1088             with open(diffname, 'w') as diff:
1089                 subprocess.check_call(['git', 'diff'], stdout=diff, cwd=cwd)
1090                 print('\033[91mYou have a diff in the %s documentation cache. Please update with:\033[0m' % subproject)
1091                 print('     $ curl %s/%s | git apply -' % (os.environ['CI_ARTIFACTS_URL'], diffname.replace('../', '')))
1092     if res != 0:
1093         print('(note that it might take a few minutes for artefacts to be available on the server)\n')
1094         sys.exit(res)"
1095
1096   - ./gst-uninstalled.py hotdoc run --conf-file=build/subprojects/gst-docs/GStreamer-doc.json --fatal-warnings
1097   - cd -
1098   - mv gst-build/build/subprojects/gst-docs/GStreamer-doc/html documentation/
1099
1100   artifacts:
1101     when: always
1102     paths:
1103     - documentation/
1104     - plugins-cache-diffs/
1105
1106 #
1107 # Build an iOS App using the iOS binaries
1108 #
1109 .cross-ios universal examples:
1110   stage: 'integrate'
1111   variables:
1112     EXAMPLES_HOME: ${CI_PROJECT_DIR}/examples
1113     # disable codesigning so we don't need developer identities on the CI
1114     # machines
1115     XCODE_BUILD_ARGS: >
1116       CODE_SIGNING_REQUIRED="NO"
1117       CODE_SIGN_IDENTITY=""
1118       CODE_SIGNING_ALLOWED="NO"
1119       CODE_SIGN_ENTITLEMENTS=""
1120   script:
1121     # install the binaries
1122     - installer -pkg gstreamer-1.0-devel-*-ios-universal.pkg -target CurrentUserHomeDirectory -verbose
1123
1124     - curl -L -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py
1125     - chmod +x clone_manifest_ref.py
1126     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-examples --destination ${EXAMPLES_HOME}/gst-examples
1127     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-docs --destination ${EXAMPLES_HOME}/gst-docs
1128     - rm clone_manifest_ref.py
1129
1130     # dump some useful information
1131     - xcodebuild -version
1132     - xcodebuild -showsdks
1133
1134     # gst-docs ios tutorials
1135     - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj
1136     - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj ${XCODE_BUILD_ARGS}
1137
1138     # gst-examples
1139     - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj
1140     - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj ${XCODE_BUILD_ARGS}
1141   after_script:
1142     - rm -rf ${EXAMPLES_HOME}/gst-examples ${EXAMPLES_HOME}/gst-docs
1143   tags:
1144     - gst-ios-13.2
1145
1146 cross-ios universal examples:
1147   extends: ".cross-ios universal examples"
1148   rules:
1149     - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME && $CI_PROJECT_NAME == "gst-docs"'
1150     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-docs|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
1151   needs:
1152     - "build cerbero cross-ios universal"
1153
1154 cerbero cross-ios universal examples:
1155   extends: ".cross-ios universal examples"
1156   rules:
1157     - if: '$CI_PROJECT_NAME == "cerbero"'
1158   needs:
1159     - "cerbero deps cross-ios universal"
1160
1161 build gst-omx zynq fedora x86_64:
1162   extends: '.build fedora x86_64'
1163   variables:
1164     MESON_ARGS: "-Domx=enabled -Dgst-omx:target=zynqultrascaleplus -Dgst-omx:header_path=${CI_PROJECT_DIR}/vcu-omx-il/omx_header -Dpython=disabled -Dlibav=disabled -Dlibnice=disabled -Dugly=disabled -Dbad=disabled -Ddevtools=disabled -Dges=disabled -Drtsp_server=disabled -Dvaapi=disabled -Dsharp=disabled -Dgst-examples=disabled -Drs=disabled ${MESON_BUILDTYPE_ARGS} $MESON_GST_WERROR"
1165   rules:
1166     - if: '$CI_PROJECT_NAME =~ /^(gst-omx|gst-ci)$/'
1167   before_script:
1168     - git clone https://github.com/Xilinx/vcu-omx-il.git --branch=release-2020.1 ${CI_PROJECT_DIR}/vcu-omx-il
1169
1170 build gst-omx tizonia fedora x86_64:
1171   extends: '.build fedora x86_64'
1172   variables:
1173     MESON_ARGS: "-Domx=enabled -Dgst-omx:target=tizonia -Dpython=disabled -Dlibav=disabled -Dlibnice=disabled -Dugly=disabled -Dbad=disabled -Ddevtools=disabled -Dges=disabled -Drtsp_server=disabled -Dvaapi=disabled -Dsharp=disabled -Dgst-examples=disabled -Drs=disabled ${MESON_BUILDTYPE_ARGS} $MESON_GST_WERROR"
1174     PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}:${CI_PROJECT_DIR}/tizonia-install/lib64/pkgconfig/
1175   rules:
1176     - if: '$CI_PROJECT_NAME =~ /^(gst-omx|gst-ci)$/'
1177   before_script:
1178     - git clone https://github.com/tizonia/tizonia-openmax-il --branch v0.20.2
1179     - cd tizonia-openmax-il
1180     - meson build -Dclients=false -Dplugins='' -Dplayer=false -Dprefix=${CI_PROJECT_DIR}/tizonia-install
1181     - ninja -C build
1182     - ninja -C build install
1183     - cd ..
1184
1185 #
1186 # Cerbero Native Windows builds
1187 #
1188 .cerbero windows native:
1189   needs: ['manifest']
1190   image: $WINDOWS_IMAGE
1191   tags:
1192     - 'docker'
1193     - 'windows'
1194     - 'gstreamer-windows'
1195     - '1809'
1196   variables:
1197     CONFIG: 'win64.cbc'
1198     ARCH: 'msvc_x86_64'
1199     CERBERO_HOST_DIR: "C:/cerbero"
1200     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v visualstudio -v nowerror"
1201     CERBERO_RUN_SUFFIX: ".exe"
1202     HAVE_CCACHE: ""
1203   # FIXME: for some reason the runner is hanging when trying to upload artifacts
1204   artifacts:
1205     paths: []
1206   before_script:
1207     - $env:CI_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\', '/')
1208     - $env:CERBERO_SCRIPTS_PATH = "$env:CI_PROJECT_DIR/cerbero_setup.sh"
1209     - echo "Fetching $env:CERBERO_SCRIPT_URL"
1210     - Invoke-WebRequest -Uri $env:CERBERO_SCRIPT_URL -OutFile $env:CERBERO_SCRIPTS_PATH
1211     - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && $env:CERBERO_SCRIPTS_PATH cerbero_before_script"
1212
1213 cerbero deps msvc x86_64:
1214   extends: ['.cerbero deps', '.cerbero windows native']
1215   script:
1216     - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && $env:CERBERO_SCRIPTS_PATH cerbero_deps_script"
1217
1218 build cerbero msvc x86_64:
1219   extends: ['.cerbero', '.cerbero windows native']
1220   script:
1221     - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && $env:CERBERO_SCRIPTS_PATH cerbero_script"
1222   rules:
1223     - if: '$CI_PROJECT_NAME !~ /^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'