docs: Always build documentation on gstreamer/gstreamer main branch
[platform/upstream/gstreamer.git] / .gitlab-ci.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   INDENT_TAG: '2020-10-22.0'
26   WINDOWS_TAG: "2021-09-09.0"
27
28   GST_UPSTREAM_REPO: 'gstreamer/gst-ci'
29
30   FEDORA_AMD64_SUFFIX:  'amd64/fedora'
31   INDENT_AMD64_SUFFIX: 'amd64/gst-indent'
32   WINDOWS_AMD64_SUFFIX: 'amd64/windows'
33   WINDOWS_RUST_AMD64_SUFFIX: 'amd64/windows-rust'
34
35   FEDORA_IMAGE:   "$CI_REGISTRY_IMAGE/$FEDORA_AMD64_SUFFIX:$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
36   FEDORA_DOCS_IMAGE: "registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2020-07-03.0-master"
37   INDENT_IMAGE:   "$CI_REGISTRY_IMAGE/$INDENT_AMD64_SUFFIX:$INDENT_TAG-$GST_UPSTREAM_BRANCH"
38   WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
39   WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
40
41   RUST_MINIMUM_VERSION: '1.54.0'
42   RUST_LATEST_VERSION: '1.55.0'
43
44   WINDOWS_RUST_MINIMUM_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_MINIMUM_VERSION"
45   WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_MINIMUM_VERSION"
46
47   WINDOWS_RUST_LATEST_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_LATEST_VERSION"
48   WINDOWS_RUST_LATEST_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_LATEST_VERSION"
49
50   MESON_BUILDTYPE_ARGS: --default-library=both
51   DEFAULT_MESON_ARGS: >
52     -Dlibnice:tests=disabled
53     -Dlibnice:examples=disabled
54     -Dopenh264:tests=disabled
55     -Dpygobject:tests=false
56     -Dpython=enabled
57     -Dlibav=enabled
58     -Dugly=enabled
59     -Dbad=enabled
60     -Ddevtools=enabled
61     -Dges=enabled
62     -Drtsp_server=enabled
63     -Dvaapi=enabled
64     -Dsharp=disabled
65
66   MESON_GST_WERROR: >
67     -Dgstreamer:werror=true
68     -Dgst-plugins-base:werror=true
69     -Dgst-plugins-good:werror=true
70     -Dgst-plugins-ugly:werror=true
71     -Dgst-plugins-bad:werror=true
72     -Dgst-rtsp-server:werror=true
73     -Dgst-libav:werror=true
74     -Dgst-examples:werror=true
75     -Dgst-editing-services:werror=true
76     -Dgst-docs:werror=true
77     -Dgst-omx:werror=true
78     -Dgst-devtools:werror=true
79     -Dgst-python:werror=true
80     -Dgstreamer-vaapi:werror=true
81     -Dgstreamer-sharp:werror=true
82
83 workflow:
84   rules:
85     - if: $CI_MERGE_REQUEST_IID
86     - if: $CI_COMMIT_TAG
87     - if: $CI_COMMIT_BRANCH
88
89 #
90 # Global CI policy
91 #
92 # This can be used to configure global behaviour our our jobs.
93 #
94 default:
95   retry:
96     max: 2
97     when:
98       - 'runner_system_failure'
99       - 'stuck_or_timeout_failure'
100       - 'scheduler_failure'
101       - 'api_failure'
102   interruptible: true
103
104
105 # Script to check if a docker image exists in the upstream registry
106 # and if so copy it to the forked registry so we can use it
107 #
108 # This is copied/adapted from citemplates/templates/fedora.yml
109 # https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
110 .check_image: &check_image_exists |
111   # if-not-exists steps
112   set -x
113
114   if [[ -z "$GST_FORCE_REBUILD" ]]
115   then
116     # disable exit on failure
117     set +e
118
119     # check if our image is already in the current registry
120     # we store the sha of the digest and the layers
121     skopeo inspect docker://$LOCAL_IMAGE | jq '[.Digest, .Layers]' > local_sha
122
123     # check if our image is already in our gst-ci registry fork
124     skopeo inspect docker://$LOCAL_GST_CI_IMAGE | jq '[.Digest, .Layers]' > local_gst_ci_sha
125
126     # check if our image is already in the upstream registry
127     if [[ -z "$GST_UPSTREAM_REPO" ]]
128     then
129       echo "WARNING! Variable \$GST_UPSTREAM_REPO is undefined, cannot check for images"
130     else
131       skopeo inspect docker://$GST_UPSTREAM_IMAGE | jq '[.Digest, .Layers]' > upstream_sha
132     fi
133
134     # reenable exit on failure
135     set -e
136
137     # if the upstream repo has an image, ensure we use the same
138     if [ -s upstream_sha ]
139     then
140
141       echo "Checking if $LOCAL_IMAGE is up to date"
142       # ensure we use the same image from upstream
143       diff upstream_sha local_sha && exit 0 || true
144
145       echo "Copying image from gstreamer/gst-ci to local registry"
146       # copy the original image into the current project registry namespace
147       # we do 2 attempts with skopeo copy at most
148       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
149                   docker://$GST_UPSTREAM_IMAGE \
150                   docker://$LOCAL_IMAGE || \
151       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
152                   docker://$GST_UPSTREAM_IMAGE \
153                   docker://$LOCAL_IMAGE
154
155       exit 0
156     fi
157
158     set +x
159
160     # if the local ci fork repo has an image, ensure we use the same
161     if [ -s local_gst_ci_sha ]
162     then
163       echo "Checking if $LOCAL_GST_CI_IMAGE is up to date"
164       # ensure we use the same image from upstream
165       diff local_gst_ci_sha local_sha && exit 0 || true
166
167       echo "Copying image from $CI_PROJECT_NAMESPACE/gst-ci to local registry"
168       # copy the original image into the current project registry namespace
169       # we do 2 attempts with skopeo copy at most
170       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
171                   docker://$LOCAL_GST_CI_IMAGE \
172                   docker://$LOCAL_IMAGE || \
173       skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
174                   docker://$LOCAL_GST_CI_IMAGE \
175                   docker://$LOCAL_IMAGE
176
177       exit 0
178     fi
179
180     # if we have a local image but none in the upstream repo, use our
181     if [ -s local_sha ]
182     then
183       echo "Using $LOCAL_IMAGE"
184       exit 0
185     fi
186   fi
187
188
189 # Build docker images from Dockerfiles
190 #
191 # This is copied/adapted from citemplates/templates/fedora.yml
192 # https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
193 #
194 # CITemplates builds uses buildah run/commit workflow to build the images which doesn't
195 # fit us atm and our images need further adjustment to make use of it. Porting to
196 # ci-templates is the next step though.
197 #
198 # All the documentation from citemplates should be applicable here, so please refer there
199 .base:
200   image: "$CI_REGISTRY/freedesktop/ci-templates/buildah:2020-07-20.1"
201   variables:
202     STORAGE_DRIVER: 'vfs'
203     BUILDAH_FORMAT: 'docker'
204     BUILDAH_ISOLATION: 'chroot'
205   script:
206     - export LOCAL_IMAGE="$CI_REGISTRY_IMAGE/$REPO_SUFFIX:$TAG"
207     - export LOCAL_GST_CI_IMAGE="$CI_REGISTRY/$CI_PROJECT_NAMESPACE/gst-ci/$REPO_SUFFIX:$TAG"
208     - export GST_UPSTREAM_IMAGE="$CI_REGISTRY/$GST_UPSTREAM_REPO/$REPO_SUFFIX:$TAG"
209
210     # check if the docker registry is enabled, else the variable will be missing
211     - |
212       if [[ -z "$CI_REGISTRY_IMAGE" ]]
213       then
214         echo "ERROR! Looks like your repository/fork has disabled Docker Registries."
215         echo "Pleae enable them by following the documentation from here:"
216         echo "https://docs.gitlab.com/ee/user/packages/container_registry/#enable-the-container-registry-for-your-project"
217         exit 1
218       fi
219
220     # Newer versions of podman/buildah try to set overlayfs mount options when
221     # using the vfs driver, and this causes errors.
222     - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
223
224     - *check_image_exists
225
226     - echo "Building image $LOCAL_IMAGE"
227
228     - >
229       buildah bud
230       --build-arg DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH
231       --label ci.job_id=$CI_JOB_ID
232       --label pipeline.url=$CI_PIPELINE_URL
233       --label git.ref_name=$CI_COMMIT_REF_NAME
234       --label git.sha=$CI_COMMIT_SHA
235       --label gitlab.project_path=$CI_PROJECT_PATH
236       --label gitlab.project_url=$CI_PROJECT_URL
237       --label fdo.upstream-repo=$GST_UPSTREAM_REPO
238       -f $DOCKERFILE
239       -t $LOCAL_IMAGE
240       $CONTEXT_DIR
241
242     - buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
243
244     # Sanity check
245     - |
246       if [ "$CI_PROJECT_PATH" = "gstreamer/gstreamer" ]; then
247         if [ "$LOCAL_IMAGE" != "$GST_UPSTREAM_IMAGE" ]; then
248           echo "ERROR!!! AAAAA! THE IMAGE URI DOES NOT MATCH THE EXPECTED UPSTREAM ONE"
249           echo $LOCAL_IMAGE
250           echo $GST_UPSTREAM_IMAGE
251           exit 1
252         fi
253       fi
254
255     -  buildah push $LOCAL_IMAGE
256
257 fedora amd64 docker:
258   stage: "build docker"
259   variables:
260     REPO_SUFFIX: "$FEDORA_AMD64_SUFFIX"
261     TAG: "$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
262
263     CONTEXT_DIR: "ci/docker/fedora/"
264     DOCKERFILE: "ci/docker/fedora/Dockerfile"
265   extends: .base
266
267 gst-indent amd64 docker:
268   stage: "build docker"
269   variables:
270     REPO_SUFFIX: "$INDENT_AMD64_SUFFIX"
271     TAG: "$INDENT_TAG-$GST_UPSTREAM_BRANCH"
272
273     CONTEXT_DIR: "ci/docker/indent/"
274     DOCKERFILE: "ci/docker/indent/Dockerfile"
275   extends: .base
276
277 windows amd64 docker:
278   stage: "build docker"
279   variables:
280     # Unlike the buildah/linux jobs, this file
281     # needs to be relative to docker/windows/ subdir
282     # as it makes life easier in the powershell script
283     #
284     # We also don't need a CONTEXT_DIR var as its also
285     # hardcoded to be docker/windows/
286     DOCKERFILE: "ci/docker/windows/Dockerfile"
287   tags:
288     - windows
289     - shell
290     - "1809"
291   script:
292     # We need to pass an array and to resolve the env vars, so we can't use a variable:
293     - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH")
294
295     - "& ci/docker/windows/container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE $DOCKERFILE"
296     - |
297       if (!($?)) {
298         echo "Failed to build the image"
299         Exit 1
300       }
301
302 .windows rust docker build:
303   stage: 'build docker'
304   needs:
305     - job: 'windows amd64 docker'
306       artifacts: false
307   rules:
308     - if: '$CI_PROJECT_NAME == "gst-ci"'
309   variables:
310     # Unlike the buildah/linux jobs, this file
311     # needs to be relative to docker/windows/ subdir
312     # as it makes life easier in the powershell script
313     #
314     # We also don't need a CONTEXT_DIR var as its also
315     # hardcoded to be docker/windows/
316     DOCKERFILE: 'docker/windows/rust.Dockerfile'
317   tags:
318     - 'windows'
319     - 'shell'
320     - '1809'
321   script:
322     # We need to pass an array and to resolve the env vars, so we can't use a variable:
323     - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "BASE_IMAGE=$WINDOWS_IMAGE", "--build-arg", "RUST_VERSION=$RUST_VERSION")
324
325     - $env:WINDOWS_CONTAINER_SCRIPT_PATH = "$env:CI_PROJECT_DIR\container.ps1"
326     - echo "Fetching $env:WINDOWS_CONTAINER_SCRIPT_URL"
327     - Invoke-WebRequest -Uri $env:WINDOWS_CONTAINER_SCRIPT_URL -OutFile $env:WINDOWS_CONTAINER_SCRIPT_PATH
328
329     - "& $env:WINDOWS_CONTAINER_SCRIPT_PATH $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $RUST_IMAGE $RUST_UPSTREAM_IMAGE $DOCKERFILE"
330     - |
331       if (!($?)) {
332         echo "Failed to build the image"
333         Exit 1
334       }
335
336 windows rust amd64 docker latest stable:
337   extends: '.windows rust docker build'
338   variables:
339     RUST_IMAGE: !reference [variables, "WINDOWS_RUST_LATEST_IMAGE"]
340     RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_LATEST_UPSTREAM_IMAGE"]
341     RUST_VERSION: !reference [variables, "RUST_LATEST_VERSION"]
342
343 windows rust amd64 docker minimum supported version:
344   extends: '.windows rust docker build'
345   variables:
346     RUST_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_IMAGE"]
347     RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE"]
348     RUST_VERSION: !reference [variables, "RUST_MINIMUM_VERSION"]
349
350
351
352 # ---- Preparation ----- #
353 #
354 # gst-indent!!
355 #
356 gst indent:
357   image: $INDENT_IMAGE
358   stage: 'preparation'
359   script:
360     # man indent. grep RETURN VALUE, grab a beer on my behalf...
361     - indent --version || true
362     - ./scripts/gst-indent-all
363     - |
364       if git diff --quiet; then
365           echo "Code is properly formatted"
366       else
367           git diff --color=always
368           echo 'style diverges, please run gst-indent first'
369           exit 1
370       fi
371
372   rules:
373     # If the MR is assigned to the Merge bot, trigger the pipeline automatically
374     - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
375     # When the assignee isn't the merge bot, require an explicit action to trigger the pipeline
376     # to avoid wasting CI resources
377     - if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"'
378       when: 'manual'
379       allow_failure: false
380     # If this matches, it means the pipeline is running against either the main
381     # or a stable branch, so make it manual
382     - if: '$CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
383       when: 'manual'
384
385 #
386 # Check "allow-edit" checkbox on merge requests with ci-fairy
387 #
388 check allow-edit:
389   extends: '.fdo.ci-fairy'
390   needs: []
391   stage: 'preparation'
392   script:
393     - ci-fairy check-merge-request --require-allow-collaboration
394   rules:
395     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
396
397 #
398 # build setup templates
399 #
400 .build_template: &build
401   - echo $MESON_ARGS
402
403   - meson build/ $MESON_ARGS
404   - ninja -C build/
405   - ccache --show-stats
406
407 .build_ccache_vars:
408   variables:
409     CCACHE_COMPILERCHECK: 'content'
410     CCACHE_COMPRESS: 'true'
411     CCACHE_BASEDIR: '/cache/gstreamer/gstreamer'
412     CCACHE_DIR: '/cache/gstreamer/gstreamer/ccache/'
413     # shared across everything really
414     CCACHE_MAXSIZE: '10G'
415     CARGO_HOME: '/cache/gstreamer/cargo'
416
417 .simple_fedora_build: &simple_build >-
418   ${DEFAULT_MESON_ARGS}
419   -Dsharp=enabled
420   -Domx=enabled
421   -Dgst-omx:target=generic
422   -Ddoc=disabled
423   -Drs=disabled
424   ${MESON_BUILDTYPE_ARGS}
425   ${MESON_GST_WERROR}
426
427 .build:
428   stage: 'build'
429   extends:
430     - '.build_ccache_vars'
431   needs:
432     - "gst indent"
433   # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
434   # Also need to take into account I/O of pulling docker images and uploading artifacts
435   timeout: '45min'
436   variables:
437     MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
438   script:
439     *build
440   after_script:
441     - mv build/meson-logs/ meson-logs
442   artifacts:
443     expire_in: "7 days"
444     when: "always"
445     paths:
446       - 'meson-logs/'
447
448 .base_modules_changes: &modules_changes
449   - .gitlab-ci.yml
450   - meson.build
451   - subprojects/*.wrap
452   - subprojects/gst-devtools/**/*
453   - subprojects/gst-editing-services/**/*
454   - subprojects/gst-integration-testsuites/**/*
455   - subprojects/gst-libav/**/*
456   - subprojects/gst-omx/**/*
457   - subprojects/gst-plugins-bad/**/*
458   - subprojects/gst-plugins-base/**/*
459   - subprojects/gst-plugins-good/**/*
460   - subprojects/gst-plugins-ugly/**/*
461   - subprojects/gst-python/**/*
462   - subprojects/gstreamer/**/*
463   - subprojects/gstreamer-sharp/**/*
464   - subprojects/gstreamer-vaapi/**/*
465   - subprojects/gst-rtsp-server/**/*
466
467 .simple_fedora_build: &simple_build >-
468   ${DEFAULT_MESON_ARGS}
469   -Dsharp=enabled
470   -Domx=enabled
471   -Dgst-omx:target=generic
472   -Ddoc=disabled
473   -Drs=disabled
474   ${MESON_BUILDTYPE_ARGS}
475   ${MESON_GST_WERROR}
476
477 .build:
478   stage: 'build'
479   extends:
480     - '.build_ccache_vars'
481   # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
482   # Also need to take into account I/O of pulling docker images and uploading artifacts
483   timeout: '45min'
484   variables:
485     MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
486   before_script:
487     - ci/scripts/handle-subprojects-cache.py subprojects/
488     # Update subprojects to respect `.wrap` content
489     - meson subprojects update --reset
490   script:
491     *build
492   after_script:
493     - mv build/meson-logs/ meson-logs
494   artifacts:
495     expire_in: "7 days"
496     when: "always"
497     paths:
498       - 'meson-logs/'
499
500 .build fedora x86_64:
501   extends: '.build'
502   image: $FEDORA_IMAGE
503   variables:
504     MESON_ARGS: *simple_build
505   rules:
506     - changes:
507         *modules_changes
508
509 build nodebug fedora x86_64:
510   extends: '.build'
511   image: $FEDORA_IMAGE
512   variables:
513     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
514
515 build static fedora x86_64:
516   extends: '.build fedora x86_64'
517   variables:
518     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
519
520 build static nodebug fedora x86_64:
521   extends: 'build nodebug fedora x86_64'
522   variables:
523     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
524
525 build clang fedora x86_64:
526   extends: '.build fedora x86_64'
527   variables:
528     CC: 'ccache clang'
529     CXX: 'ccache clang++'
530
531 .build windows:
532   image: $WINDOWS_IMAGE
533   stage: 'build'
534   tags:
535     - 'docker'
536     - 'windows'
537     - '1809'
538   needs:
539     - "gst indent"
540   timeout: '45min'
541   variables:
542     MESON_ARGS: >
543       ${DEFAULT_MESON_ARGS}
544       -Dpython=disabled
545       -Dlibav=disabled
546       -Dvaapi=disabled
547       -Dgst-plugins-base:pango=enabled
548       -Dgst-plugins-good:cairo=enabled
549   rules:
550     - changes:
551         *modules_changes
552   before_script:
553     - ci/scripts/handle-subprojects-cache.py subprojects/
554   script:
555     # For some reason, options are separated by newline instead of space, so we
556     # have to replace them first.
557     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
558     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
559         meson build $env:MESON_ARGS &&
560         ninja -C build"
561   # XXX: Re-enable when uploading stops timing out
562   #artifacts:
563   #  expire_in: "7 days"
564   #  when: "always"
565   #  paths:
566   #    - 'build/meson-logs/'
567
568 build vs2017 amd64:
569   extends: '.build windows'
570   variables:
571     ARCH: 'amd64'
572
573 build vs2017 x86:
574   extends: '.build windows'
575   variables:
576     ARCH: 'x86'
577
578 build msys2 :
579   extends: '.build windows'
580   timeout: '60min'
581   rules:
582     - changes:
583         *modules_changes
584       allow_failure: true
585       when: 'manual'
586   script:
587     # Make sure powershell exists on errors
588     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
589     - $ErrorActionPreference = "Stop"
590
591     # For some reason docker build hangs if this is included in the image, needs more troubleshooting
592     - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
593     # Copied from https://github.com/msys2/setup-msys2/blob/master/main.js#L98
594     - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
595     - C:\msys64\usr\bin\bash -c "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
596     - echo "Updating MSYS2"
597     - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm || echo Update failed, ignoring"
598     - echo "Killing all MSYS2 processes"
599     - taskkill /F /FI "MODULES eq msys-2.0.dll"
600     - echo "Completing MSYS2 update"
601     - C:\msys64\usr\bin\bash -c "pacman -Suu --noconfirm"
602     - echo "Installing needed MSYS2 packages"
603     - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
604
605     # For some reason, options are separated by newline instead of space, so we
606     # have to replace them first.
607     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
608     # Replace forward slashes with backwards so bash doesn't complain
609     - $env:_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
610     - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS && ninja -C build"
611
612 # ---- Tests ----- #
613
614 .test:
615   stage: 'test'
616   extends:
617     - '.build_ccache_vars'
618   needs:
619     - "gst indent"
620   variables:
621     MESON_ARGS: *simple_build
622
623     # Disable colored output to avoid weird rendering issues
624     GST_DEBUG_NO_COLOR: "true"
625     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/validate-logs/"
626     GST_VALIDATE_LAUNCHER_FORCE_COLORS: "true"
627     TIMEOUT_FACTOR: "2"
628     CARGO_HOME: "/cache/gstreamer/cargo"
629     # Enable the fault handler so we get backtraces on segfaults.
630     # any non-empty string will do
631     PYTHONFAULTHANDLER: "enabled"
632   rules:
633     - changes:
634         *modules_changes
635   script:
636     - *build
637
638     - echo "-> Running ${TEST_SUITE}"
639     - >
640       ./gst-env.py
641       gst-validate-launcher ${TEST_SUITE}
642       --dump-on-failure
643       --mute
644       --shuffle
645       --no-display
646       --meson-no-rebuild
647       --timeout-factor "${TIMEOUT_FACTOR}"
648       --fail-on-testlist-change
649       -l "${CI_PROJECT_DIR}/validate-logs/"
650       --xunit-file "${CI_PROJECT_DIR}/validate-logs/xunit.xml"
651       ${EXTRA_VALIDATE_ARGS}
652   after_script:
653     - mv build/meson-logs/ meson-logs
654   artifacts:
655     expire_in: '14 days'
656     when: always
657     paths:
658       - 'meson-logs/'
659       - 'validate-logs'
660     reports:
661       junit:
662         - "validate-logs/*.xml"
663
664 .test fedora x86_64:
665   image: $FEDORA_IMAGE
666   extends: '.test'
667   tags: ['gstreamer']
668
669 check fedora:
670   extends: '.test fedora x86_64'
671   variables:
672     TEST_SUITE: "check.gst*"
673
674 integration testsuites fedora:
675   extends: '.test fedora x86_64'
676   parallel: 4
677   variables:
678     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --check-bugs --parts=${CI_NODE_TOTAL} --part-index=${CI_NODE_INDEX}"
679     TEST_SUITE: "validate ges"
680
681 # gstreamer-full:
682 # introspection has been disabled as the static build does not support it.
683 # See https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/162
684 gstreamer-full:
685   extends: 'build static fedora x86_64'
686   stage: integrate
687   variables:
688     MESON_ARGS: >
689       --default-library=static
690       -Dintrospection=disabled
691       $MESON_GST_WERROR
692   rules:
693     - changes:
694       - "*"
695       - scripts/*
696       - subprojects/gst-ci/**/*
697
698   script:
699   - *build
700   - meson test -C build -v test-gst-full
701   artifacts:
702     expire_in: "7 days"
703     when: "always"
704     paths:
705       - 'meson-logs/'
706
707 gstreamer-full-minimal:
708   extends: 'build static fedora x86_64'
709   stage: integrate
710   variables:
711     MESON_ARGS: >
712       --default-library=static
713       -Dauto_features=disabled
714       -Dgstreamer:check=enabled
715       -Dtests=enabled
716       -Dgst-plugins-base:alsa=enabled
717       -Dgst-plugins-base:typefind=enabled
718       -Dgst-plugins-base:pbtypes=enabled
719       -Dgst-full-elements=coreelements:filesrc,fakesink,identity,input-selector
720       -Dgst-full-typefind-functions=typefindfunctions:wav,flv
721       -Dgst-full-device-providers=alsa:alsadeviceprovider
722       -Dgst-full-dynamic-types=pbtypes:video_multiview_flagset
723       $MESON_GST_WERROR
724   rules:
725     - if: '$CI_PROJECT_NAME =~ /^(gst-build|gst-ci)$/'
726
727   script:
728   - *build
729   - meson test -C build -v test-gst-full
730   - 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"
731   - strip build/libgstreamer-full-1.0.so
732   - ls -l build/libgstreamer-full-1.0.so
733   artifacts:
734     expire_in: "7 days"
735     when: "always"
736     paths:
737       - 'meson-logs/'
738
739 # Valgrind
740 .valgrind fedora x86_64:
741   extends: '.test fedora x86_64'
742   stage: 'test'
743   variables:
744     EXTRA_VALIDATE_ARGS: "--valgrind"
745
746 valgrind core:
747   extends: '.valgrind fedora x86_64'
748   variables:
749     TEST_SUITE: "check.gstreamer\\..*"
750   rules:
751     - changes:
752       - "*"
753       - scripts/*
754       - subprojects/gst-ci/**/*
755       - subprojects/gst-devtools/**/*
756       - subprojects/gstreamer/**/*
757
758 valgrind base:
759   extends: '.valgrind fedora x86_64'
760   variables:
761     TEST_SUITE: "check.gst-plugins-base\\..*"
762   rules:
763     - changes:
764       - "*"
765       - scripts/*
766       - subprojects/gst-ci/**/*
767       - subprojects/gst-devtools/**/*
768       - subprojects/gstreamer/**/*
769       - subprojects/gst-plugins-base/**/*
770
771 valgrind good:
772   extends: '.valgrind fedora x86_64'
773   variables:
774     TEST_SUITE: "check.gst-plugins-good\\..*"
775     # take longer time due to splitmux unit test
776     TIMEOUT_FACTOR: "4"
777   rules:
778     - changes:
779       - "*"
780       - scripts/*
781       - subprojects/gst-ci/**/*
782       - subprojects/gst-devtools/**/*
783       - subprojects/gstreamer/**/*
784       - subprojects/gst-plugins-base/**/*
785       - subprojects/gst-plugins-good/**/*
786
787 valgrind ugly:
788   extends: '.valgrind fedora x86_64'
789   variables:
790     TEST_SUITE: "check.gst-plugins-ugly\\..*"
791   rules:
792     - changes:
793       - "*"
794       - scripts/*
795       - subprojects/gst-ci/**/*
796       - subprojects/gst-devtools/**/*
797       - subprojects/gstreamer/**/*
798       - subprojects/gst-plugins-base/**/*
799       - subprojects/gst-plugins-good/**/*
800       - subprojects/gst-plugins-ugly/**/*
801
802 valgrind bad:
803   extends: '.valgrind fedora x86_64'
804   variables:
805     TEST_SUITE: "check.gst-plugins-bad\\..*"
806   rules:
807     - changes:
808       - "*"
809       - scripts/*
810       - subprojects/gst-ci/**/*
811       - subprojects/gst-devtools/**/*
812       - subprojects/gstreamer/**/*
813       - subprojects/gst-plugins-base/**/*
814       - subprojects/gst-plugins-good/**/*
815       - subprojects/gst-plugins-bad/**/*
816
817 valgrind ges:
818   extends: '.valgrind fedora x86_64'
819   variables:
820     TEST_SUITE: "check.gst-editing-services\\..*"
821   rules:
822     - changes:
823       - "*"
824       - scripts/*
825       - subprojects/gst-ci/**/*
826       - subprojects/gst-devtools/**/*
827       - subprojects/gstreamer/**/*
828       - subprojects/gst-plugins-base/**/*
829       - subprojects/gst-plugins-good/**/*
830       - subprojects/gst-plugins-bad/**/*
831       - subprojects/gst-editing-services/**/*
832
833 # ---- Integration ----- #
834
835 .documentation:
836   image: $FEDORA_DOCS_IMAGE
837   extends:
838     - '.build_ccache_vars'
839   variables:
840     MESON_ARGS: *simple_build
841     MESON_BUILDTYPE_ARGS: "-Ddoc=enabled"
842     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
843   script:
844   - pip3 install --upgrade hotdoc
845   - *build
846   - ./gst-env.py ninja -C build/ plugins_doc_caches
847   - ./ci/scripts/check-documentation-diff.py
848   - ./gst-env.py hotdoc run --conf-file=build/subprojects/gst-docs/GStreamer-doc.json --fatal-warnings
849   - mv build/subprojects/gst-docs/GStreamer-doc/html documentation/
850
851   artifacts:
852     when: always
853     expire_in: "7 days"
854     paths:
855     - documentation/
856     - plugins-cache-diffs/
857
858 documentation:
859   stage: integrate
860   extends:
861     - '.documentation'
862   needs: []
863   rules:
864     - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
865
866 build documentation:
867   extends:
868     - '.documentation'
869   stage: build
870   needs:
871     - "gst indent"
872
873   stage: build
874   rules:
875     - changes:
876       - .gitlab-ci.yml
877       - ci/gitlab/freedesktop_doc_importer.sh
878       - subprojects/*.wrap
879       - subprojects/gst-docs/**/*
880       - subprojects/gst-devtools/**/*
881       - subprojects/gst-editing-services/**/*
882       - subprojects/gst-libav/**/*
883       - subprojects/gst-omx/**/*
884       - subprojects/gst-plugins-bad/**/*
885       - subprojects/gst-plugins-base/**/*
886       - subprojects/gst-plugins-good/**/*
887       - subprojects/gst-plugins-ugly/**/*
888       - subprojects/gstreamer/**/*
889       - subprojects/gstreamer-vaapi/**/*
890       - subprojects/gst-rtsp-server/**/*
891
892 # FIXME: Using trigger: causes permission issues, workaround using old REST API.
893 # https://gitlab.com/gitlab-org/gitlab/-/issues/341737
894 cerbero trigger:
895   stage: build
896   image: $FEDORA_IMAGE
897   script:
898     - python3 -m pip install --user python-gitlab
899     - ci/gitlab/trigger_cerbero_pipeline.py
900
901   variables:
902     # Use GST_UPSTREAM_BRANCH
903     UPSTREAM_BRANCH: 'main'
904
905   rules:
906     - changes:
907       - .gitlab-ci.yml
908       - ci/gitlab/tigger_cerbero_pipeline.py
909       - subprojects/gst-devtools/**/*
910       - subprojects/gst-editing-services/**/*
911       - subprojects/gst-libav/**/*
912       - subprojects/gst-plugins-bad/**/*
913       - subprojects/gst-plugins-base/**/*
914       - subprojects/gst-plugins-good/**/*
915       - subprojects/gst-plugins-ugly/**/*
916       - subprojects/gst-python/**/*
917       - subprojects/gstreamer/**/*
918       - subprojects/gst-rtsp-server/**/*
919       - subprojects/gst-examples/**/*