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