53b4c76658a5a9da183fd8505f0a2b1c3d753ad8
[platform/upstream/gstreamer.git] / gitlab / ci_template.yml
1 stages:
2   - 'preparation'
3   - 'pre-build'
4   - 'build'
5   - 'test'
6   # Use the resulting binaries
7   - 'integrate'
8
9 variables:
10   ANDROID_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/android:2020-02-10-1589547-master'
11   CERBERO_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/cerbero-fedora:2020-02-10-1589546-master'
12   FEDORA_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2020-02-24-1712085-master'
13   INDENT_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/gst-indent:6f7e01e1e30a73efa880acdc8e911f1f20c58dbb'
14   MANIFEST_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/build-manifest:2020-02-10-1589542-master'
15   WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v9'
16
17   # Branch to track for modules that have no ref specified in the manifest
18   GST_UPSTREAM_BRANCH: 'master'
19   ORC_UPSTREAM_BRANCH: 'master'
20
21   GIT_STRATEGY: none
22   MESON_BUILDTYPE_ARGS: --default-library=both
23   DEFAULT_MESON_ARGS: >
24     -Dpython=enabled
25     -Dlibav=enabled
26     -Dugly=enabled
27     -Dbad=enabled
28     -Ddevtools=enabled
29     -Dges=enabled
30     -Drtsp_server=enabled
31     -Dvaapi=enabled
32     -Dsharp=disabled
33
34   DEFAULT_CERBERO_ARGS: >
35     --variants werror
36     --timestamps
37
38 #
39 # Global CI policy
40 #
41 # This can be used to configure global behaviour our our jobs. It also
42 # supports some variable to affect the job when:
43 #
44 #   EXCEPT_PROJECT_REGEX: Will mark to never if that regex match
45 #   ONLY_PROJECT_REGEX: Will mark to never if that regex do not match
46 #
47 .global_ci_policy:
48   rules:
49     - if: '$EXCEPT_PROJECT_REGEX && $CI_PROJECT_NAME =~ $EXCEPT_PROJECT_REGEX'
50       when: 'never'
51     - if: '$ONLY_PROJECT_REGEX && $CI_PROJECT_NAME !~ $ONLY_PROJECT_REGEX'
52       when: 'never'
53     - when: 'on_success'
54   retry:
55     max: 2
56     when:
57       - 'runner_system_failure'
58       - 'stuck_or_timeout_failure'
59       - 'scheduler_failure'
60       - 'api_failure'
61   interruptible: true
62
63 manifest:
64   image: $MANIFEST_IMAGE
65   extends:
66     - '.global_ci_policy'
67   stage: 'preparation'
68   script:
69     - cd /gst-ci
70     - gitlab/build_manifest.py --self-update
71     - gitlab/build_manifest.py ${CI_PROJECT_DIR}/manifest.xml
72     - cat ${CI_PROJECT_DIR}/manifest.xml
73   artifacts:
74     expire_in: "7 days"
75     paths:
76       - "manifest.xml"
77
78 gst indent:
79   image: $INDENT_IMAGE
80   extends:
81     - '.global_ci_policy'
82   stage: 'preparation'
83   variables:
84     GIT_STRATEGY: 'fetch'
85     EXCEPT_REGEX: '/^(gstreamer-sharp|gst-integration-testsuites|cerbero|gst-docs)$/'
86   script:
87     # man indent. grep RETURN VALUE, grab a beer on my behalf...
88     - indent --version || true
89     - curl -o gst-indent https://gitlab.freedesktop.org/gstreamer/gstreamer/raw/${GST_UPSTREAM_BRANCH}/tools/gst-indent
90     - chmod +x gst-indent
91     - find . -name '*.c' -exec ./gst-indent {} +
92     - |
93       if git diff --quiet; then
94           echo "Code is properly formatted"
95       else
96           git diff --color=always
97           echo 'style diverges, please run gst-indent first'
98           exit 1
99       fi
100
101 .build:
102   stage: 'build'
103   extends:
104     - '.global_ci_policy'
105   needs:
106     - "manifest"
107   # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
108   # Also need to take into account I/O of pulling docker images and uploading artifacts
109   timeout: '45min'
110   variables:
111     CCACHE_COMPILERCHECK: "content"
112     CCACHE_COMPRESS: "true"
113     CCACHE_BASEDIR: "/cache/gstreamer/gst-build"
114     CCACHE_DIR: "/cache/gstreamer/gst-build/ccache/"
115     # shared across everything really
116     CCACHE_MAXSIZE: "10G"
117     CARGO_HOME: "/cache/gstreamer/cargo"
118
119     MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} --werror"
120     EXCEPT_PROJECT_REGEX: '/^(cerbero)$/'
121
122   script:
123     - ccache --show-stats
124     - curl -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py
125     - chmod +x clone_manifest_ref.py
126     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-build --destination gst-build
127     - cd gst-build/
128     # only copy immediate directories. We don't want to modify .wrap files
129     - find /gst-build/subprojects/ -mindepth 1 -maxdepth 1 -type d -exec cp -r \{\} subprojects/ \;
130     - ./git-update --no-interaction --manifest="${CI_PROJECT_DIR}/manifest.xml"
131     - meson build/ $MESON_ARGS
132     - ninja -C build/
133     - ccache --show-stats
134   after_script:
135     - cd gst-build/
136     # Clean the artifacts packages to avoid copying "useless" build products.
137     - test -d build && find build -name '*.[ao]' -delete
138     # Clean the .git repos since we won't need them anymore
139     - rm -rf subprojects/*/.git/
140     - rm -rf build/subprojects/*/.git/
141
142 build fedora x86_64:
143   extends: '.build'
144   stage: 'build'
145   image: $FEDORA_IMAGE
146   variables:
147     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Domx=enabled -Dgst-omx:target=generic -Ddoc=enabled -Drs=disabled ${MESON_BUILDTYPE_ARGS} --werror"
148     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-plugins-rs)$/'
149   artifacts:
150     expire_in: '5 days'
151     when: always
152     paths:
153       - "manifest.xml"
154       - "gst-build/"
155
156 build nodebug fedora x86_64:
157   extends: '.build'
158   stage: 'build'
159   image: $FEDORA_IMAGE
160   variables:
161     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic -Drs=disabled ${MESON_BUILDTYPE_ARGS} --werror"
162     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
163
164 build static fedora x86_64:
165   extends: 'build fedora x86_64'
166   variables:
167     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
168     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
169
170 build static nodebug fedora x86_64:
171   extends: 'build nodebug fedora x86_64'
172   variables:
173     MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
174     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
175
176 build clang fedora x86_64:
177   extends: 'build fedora x86_64'
178   variables:
179     CC: 'ccache clang'
180     CXX: 'ccache clang++'
181     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
182
183 .test:
184   stage: 'test'
185   extends:
186     - '.global_ci_policy'
187   variables:
188     # Disable colored output to avoid weird rendering issues
189     GST_DEBUG_NO_COLOR: "true"
190     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/validate-logs/"
191     GST_VALIDATE_LAUNCHER_FORCE_COLORS: "true"
192     TIMEOUT_FACTOR: "2"
193     CARGO_HOME: "/cache/gstreamer/cargo"
194     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-examples|gst-docs)$/'
195   script:
196     - cd gst-build/
197     - echo "-> Running ${TEST_SUITE}"
198     - >
199       ./gst-uninstalled.py
200       gst-validate-launcher ${TEST_SUITE}
201       --dump-on-failure
202       --mute
203       --shuffle
204       --no-display
205       --meson-no-rebuild
206       --timeout-factor "${TIMEOUT_FACTOR}"
207       --fail-on-testlist-change
208       -l "${CI_PROJECT_DIR}/validate-logs/"
209       --xunit-file "${CI_PROJECT_DIR}/validate-logs/xunit.xml"
210       ${EXTRA_VALIDATE_ARGS}
211   artifacts:
212     expire_in: '14 days'
213     when: always
214     paths:
215       - 'gst-build/build/meson-logs/'
216       - 'validate-logs'
217     reports:
218       junit:
219         - "validate-logs/*.xml"
220
221 .test fedora x86_64:
222   image: $FEDORA_IMAGE
223   extends: '.test'
224   tags: ['gstreamer']
225   needs:
226     - 'build fedora x86_64'
227
228 check fedora:
229   extends: '.test fedora x86_64'
230   variables:
231     TEST_SUITE: "check.gst*"
232     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-examples|gst-integration-testsuites|gst-omx|gst-plugins-rs)$/'
233
234 integration testsuites fedora:
235   extends: '.test fedora x86_64'
236   parallel: 4
237   variables:
238     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --check-bugs --parts=${CI_NODE_TOTAL} --part-index=${CI_NODE_INDEX}"
239     TEST_SUITE: "validate ges"
240     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-omx|gst-plugins-rs)$/'
241
242 gstreamer-full:
243   extends: 'build static fedora x86_64'
244   stage: integrate
245   variables:
246     MESON_ARGS: >
247       --default-library=static
248       -Dauto_features=disabled
249       -Dgst-plugins-good:alpha=enabled
250   after_script:
251   - cd gst-build/
252   - ninja -C build install
253   - export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib64/gstreamer-1.0/pkgconfig
254   - export LD_LIBRARY_PATH=/usr/local/lib64
255   - cd examples/static-plugins
256   - meson _build
257   - ninja -C _build
258   - meson test -C _build -v
259   artifacts:
260     paths:
261       - 'gst-build/build/meson-logs/'
262       - 'gst-build/build/gstinitstaticplugins.c'
263
264 # Valgrind
265 .valgrind fedora x86_64:
266   extends: '.test fedora x86_64'
267   stage: 'test'
268   variables:
269     EXTRA_VALIDATE_ARGS: "--valgrind"
270     # Some suppression files are missing a newline at the end which messes things
271     # up when concatenating them. awk will add missing newlines (unlike cat)
272     EXCEPT_PROJECT_REGEX: '/^(gstreamer|gst-integration-testsuites)$/'
273
274 valgrind core:
275   extends: '.valgrind fedora x86_64'
276   variables:
277     TEST_SUITE: "check.gstreamer\\..*"
278     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-ci)$/'
279
280 valgrind base:
281   extends: '.valgrind fedora x86_64'
282   variables:
283     TEST_SUITE: "check.gst-plugins-base\\..*"
284     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-plugins-base|gst-ci)$/'
285
286 valgrind good:
287   extends: '.valgrind fedora x86_64'
288   variables:
289     TEST_SUITE: "check.gst-plugins-good\\..*"
290     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-plugins-base|gst-plugins-good|gst-ci)$/'
291
292 valgrind ugly:
293   extends: '.valgrind fedora x86_64'
294   variables:
295     TEST_SUITE: "check.gst-plugins-ugly\\..*"
296     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-plugins-base|gst-plugins-ugly|gst-ci)$/'
297
298 valgrind bad:
299   extends: '.valgrind fedora x86_64'
300   variables:
301     TEST_SUITE: "check.gst-plugins-bad\\..*"
302     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-plugins-base|gst-plugins-good|gst-plugins-bad|gst-ci)$/'
303
304 valgrind ges:
305   extends: '.valgrind fedora x86_64'
306   variables:
307     TEST_SUITE: "check.gst-editing-services\\..*"
308     ONLY_PROJECT_REGEX: '/^(gstreamer|gst-plugins-base|gst-plugins-good|gst-editing-services|gst-ci|gst-devtools)$/'
309
310 # Template for Cerbero GStreamer Build
311 #
312 # Parameters:
313 # CONFIG: The name of the configuration file to use
314 # ARCH: The cerbero <os>_<cpu> (used in cache key)
315 #
316 # Produces runtime and devel tarball packages for linux/android or .pkg for macos
317 .cerbero:
318   stage: "build"
319   image: $CERBERO_IMAGE
320   extends:
321     - '.global_ci_policy'
322   needs:
323     - "manifest"
324   # Ensure that the runners it will be executed on
325   # will have plenty of space for the cache
326   tags: ['gstreamer']
327   timeout: '3h'
328   variables:
329     CCACHE_COMPILERCHECK: "content"
330     CCACHE_COMPRESS: "true"
331     CCACHE_BASEDIR: "/cache/gstreamer/cerbero/"
332     CCACHE_DIR: "/cache/gstreamer/cerbero/ccache/"
333     # shared across everything really
334     CCACHE_MAXSIZE: "50G"
335
336     CERBERO_HOME: "cerbero-build"
337     CERBERO_SOURCES: "cerbero-sources"
338     CERBERO_DEPS: "cerbero-deps.tar.gz"
339     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS}"
340     CERBERO: "./cerbero-uninstalled -c config/${CONFIG} -c localconf.cbc -m manifest.xml"
341     CERBERO_PACKAGE_ARGS: "-t"
342     CERBERO_RUN_WRAPPER: "" # 'wine' on cross-winXX
343     CERBERO_RUN_SUFFIX: "" # '.exe' on cross-winXX
344     HAVE_CCACHE: "yes"
345     # used by macos packages as we only ever install to a fixed directory
346     CERBERO_OVERRIDDEN_DIST_DIR: ""
347     # location where cerbero is cached on the host
348     CERBERO_HOST_DIR: "/cerbero/"
349   before_script:
350     # FIXME Wrong namespace
351     # Workaround build-tools having hardcoded internal path
352     - pwd
353     - mkdir -p ../../gstreamer
354     - ln -sf $(pwd) ../../gstreamer/cerbero
355     - mkdir -p ../../${CI_PROJECT_NAMESPACE}
356     - ln -sf $(pwd) ../../${CI_PROJECT_NAMESPACE}/cerbero
357     - rsync -aH ${CERBERO_HOST_DIR} .
358     - test -f ${CERBERO_DEPS} && tar -C ${CERBERO_HOME} -xf ${CERBERO_DEPS}
359     - echo "home_dir = \"$(pwd)/${CERBERO_HOME}\"" >> localconf.cbc
360     - echo "local_sources = \"$(pwd)/${CERBERO_SOURCES}\"" >> localconf.cbc
361     - ./cerbero-uninstalled --self-update manifest.xml
362   script:
363     - test "x${HAVE_CCACHE}" = "xyes" && ccache --show-stats
364     - $CERBERO $CERBERO_ARGS show-config
365     - $CERBERO $CERBERO_ARGS fetch-bootstrap --build-tools-only
366     - $CERBERO $CERBERO_ARGS fetch-package --deps gstreamer-1.0
367     - $CERBERO $CERBERO_ARGS fetch-cache --branch ${GST_UPSTREAM_BRANCH}
368     - test "x${CERBERO_OVERRIDDEN_DIST_DIR}" != "x"
369           && test -d ${CERBERO_HOME}/dist/${ARCH}
370           && mkdir -p ${CERBERO_OVERRIDDEN_DIST_DIR}
371           && rsync -aH ${CERBERO_HOME}/dist/${ARCH}/ ${CERBERO_OVERRIDDEN_DIST_DIR}
372     - $CERBERO $CERBERO_ARGS bootstrap --offline --build-tools-only
373     - $CERBERO $CERBERO_ARGS package --offline ${CERBERO_PACKAGE_ARGS} -o $(pwd) gstreamer-1.0
374     # Run gst-inspect-1.0 for some basic checks. Can't do this for cross-(android|ios)-universal, of course.
375     - |-
376         [[ $CONFIG == *universal* ]] || $CERBERO $CERBERO_ARGS run $CERBERO_RUN_WRAPPER gst-inspect-1.0$CERBERO_RUN_SUFFIX --version
377     - |-
378         [[ $CONFIG == *universal* ]] || $CERBERO $CERBERO_ARGS run $CERBERO_RUN_WRAPPER gst-inspect-1.0$CERBERO_RUN_SUFFIX
379     - test "x${HAVE_CCACHE}" = "xyes" && ccache -s || true    # eat the return value from the failing test
380   cache:
381     key: "${CI_JOB_NAME}"
382     paths:
383       - "${CERBERO_SOURCES}"
384   artifacts:
385     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
386     expire_in: '5 days'
387     when: 'always'
388     paths:
389       - "manifest.xml"
390       - "${CERBERO_HOME}/logs"
391       - "*.tar.bz2"
392
393 .build windows:
394   image: $WINDOWS_IMAGE
395   extends:
396     - '.global_ci_policy'
397   stage: 'build'
398   needs:
399     - 'manifest'
400   tags:
401     - 'docker'
402     - 'windows'
403     - '1809'
404   timeout: '45min'
405   variables:
406     MESON_ARGS: >
407       ${DEFAULT_MESON_ARGS}
408       -Dpython=disabled
409       -Dlibav=disabled
410       -Dvaapi=disabled
411       -Ddevtools=disabled
412     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-docs|gst-integration-testsuites|gst-omx|gst-plugins-rs|gstreamer-vaapi)$/'
413   script:
414     # Sometimes there's seems to be an existing gst-build clone that comes either from the ether or
415     # from a previous job due to some gitlab bug or implicit behavior?
416     # So let's always check and clear it out if its there
417     # https://gitlab.freedesktop.org/tpm/gstreamer-sharp/-/jobs/1672137
418     - if (Test-Path $env:CI_PROJECT_DIR/gst-build) { Remove-Item -Recurse -Force $env:CI_PROJECT_DIR/gst-build }
419
420     # Make sure powershell exists on errors
421     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
422     - $ErrorActionPreference = "Stop"
423
424     - git clone -b $GST_UPSTREAM_BRANCH https://gitlab.freedesktop.org/gstreamer/gst-build.git $env:CI_PROJECT_DIR\gst-build
425     - cd $env:CI_PROJECT_DIR/gst-build
426     - cp -r C:/subprojects/* subprojects/
427     # Run the git-update script and feed it the manifest to setup the environment
428     - cd $env:CI_PROJECT_DIR/gst-build;  python git-update --no-interaction --manifest=$env:CI_PROJECT_DIR/manifest.xml
429     # For some reason, options are separated by newline instead of space, so we
430     # have to replace them first.
431     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
432     # Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script.
433     # Environment variables substitutions is done by PowerShell before calling
434     # cmd.exe, that's why we use $env:FOO instead of %FOO%
435     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
436         meson build $env:MESON_ARGS &&
437         ninja -C build"
438   # FIXME: extract builddir for tests
439   # There's a bug that prevents us from exporting artifacts with docker-windows
440   # executors. It has since been fixed in gitlab 12.1, but
441   # we are blocked from upgrading currently.
442   #
443   # Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
444   # Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
445   after_script:
446
447 build vs2017 amd64:
448   extends: '.build windows'
449   variables:
450     ARCH: 'amd64'
451
452 build vs2017 x86:
453   extends: '.build windows'
454   variables:
455     ARCH: 'x86'
456
457 build msys2 :
458   extends: '.build windows'
459   timeout: '60min'
460   script:
461     # Sometimes there's seems to be an existing gst-build clone that comes either from the ether or
462     # from a previous job due to some gitlab bug or implicit behavior?
463     # So let's always check and clear it out if its there
464     # https://gitlab.freedesktop.org/tpm/gstreamer-sharp/-/jobs/1672137
465     - if (Test-Path $env:CI_PROJECT_DIR/gst-build) { Remove-Item -Recurse -Force $env:CI_PROJECT_DIR/gst-build }
466
467     # Make sure powershell exists on errors
468     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
469     - $ErrorActionPreference = "Stop"
470
471     # For some reason docker build hangs if this is included in the image, needs more troubleshooting
472     - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
473     - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
474     - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm"
475     - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
476
477     - git clone -b $GST_UPSTREAM_BRANCH https://gitlab.freedesktop.org/gstreamer/gst-build.git $env:CI_PROJECT_DIR\gst-build
478     - cd $env:CI_PROJECT_DIR\gst-build
479     - cp -r C:\subprojects\* subprojects\
480
481     # Run the git-update script and feed it the manifest to setup the environment
482     - cd $env:CI_PROJECT_DIR/gst-build; python git-update --no-interaction --manifest=$env:CI_PROJECT_DIR/manifest.xml
483     # For some reason, options are separated by newline instead of space, so we
484     # have to replace them first.
485     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
486     # Replace forward slashes with backwards so bash doesn't complain
487     - $env:_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
488     - C:\msys64\usr\bin\bash -c "cd $env:_PROJECT_DIR/gst-build &&
489         meson build $env:MESON_ARGS &&
490         ninja -C build"
491
492
493 # Template for Cerbero GStreamer Deps
494 #
495 # This template is used by cerbero/ project to pre-built the GStreamer
496 # dependencies. When available, the .cerbero jobs will download this artifact
497 # in order to speed up the build.
498 #
499 # Parameters:
500 # CONFIG: The name of the configuration file to use
501 # ARCH: The cerbero <os>_<cpu> (used in cache key)
502 #
503 # Produce an artifact with the dist/ and .cache along
504 # with the associated build-tools.
505 .cerbero deps:
506   extends: .cerbero
507   variables:
508     ONLY_PROJECT_REGEX: '/^cerbero$/'
509   stage: "pre-build"
510   script:
511     - $CERBERO $CERBERO_ARGS show-config
512     - $CERBERO $CERBERO_ARGS fetch-bootstrap --build-tools-only
513     - $CERBERO $CERBERO_ARGS fetch-package --deps gstreamer-1.0
514     - $CERBERO $CERBERO_ARGS bootstrap --offline --build-tools-only
515     - $CERBERO $CERBERO_ARGS build-deps --offline
516           gstreamer-1.0 gst-plugins-base-1.0 gst-plugins-good-1.0
517           gst-plugins-bad-1.0 gst-plugins-ugly-1.0 gst-rtsp-server-1.0
518           gst-libav-1.0 gst-validate gst-editing-services-1.0 libnice
519     - $CERBERO $CERBERO_ARGS fetch-cache --branch ${GST_UPSTREAM_BRANCH} --skip-fetch --job-id=${CI_JOB_ID}
520     - test "x${CERBERO_OVERRIDDEN_DIST_DIR}" != "x"
521           && mkdir -p ${CERBERO_HOME}/dist/${ARCH}
522           && rsync -aH ${CERBERO_OVERRIDDEN_DIST_DIR}/ ${CERBERO_HOME}/dist/${ARCH}
523     - tar -C ${CERBERO_HOME} --exclude=var/tmp -czf $CERBERO_DEPS
524               build-tools build-tools.cache
525               dist/${ARCH} ${ARCH}.cache
526   artifacts:
527     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
528     expire_in: '10 days'
529     when: 'always'
530     paths:
531       - "manifest.xml"
532       - "${CERBERO_HOME}/logs"
533       - "${CERBERO_HOME}/cerbero-deps.log"
534       - "${CERBERO_DEPS}"
535
536 #
537 # Cerbero Linux X86_64 build
538 #
539 cerbero deps fedora x86_64:
540   extends: '.cerbero deps'
541   variables:
542     CONFIG: "linux.config"
543     ARCH: "linux_x86_64"
544
545 .cerbero fedora x86_64:
546   extends: '.cerbero'
547   variables:
548     CONFIG: "linux.config"
549
550 cerbero fedora x86_64:
551   extends: '.cerbero fedora x86_64'
552   variables:
553     ONLY_PROJECT_REGEX: '/^cerbero$/'
554   needs:
555     - "cerbero deps fedora x86_64"
556
557 build cerbero fedora x86_64:
558   extends: '.cerbero fedora x86_64'
559   variables:
560     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
561
562 #
563 # Cerbero Android Universal build
564 #
565 cerbero deps cross-android universal:
566   extends: '.cerbero deps'
567   variables:
568     CONFIG: "cross-android-universal.cbc"
569     ARCH: "android_universal"
570
571 .cerbero cross-android universal:
572   extends: '.cerbero'
573   variables:
574     CONFIG: "cross-android-universal.cbc"
575   artifacts:
576     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
577     expire_in: '5 days'
578     when: 'always'
579     paths:
580       - "manifest.xml"
581       - "${CERBERO_HOME}/logs"
582       - "*[0-9].tar.bz2"
583
584 cerbero cross-android universal:
585   extends: '.cerbero cross-android universal'
586   variables:
587     ONLY_PROJECT_REGEX: '/^cerbero$/'
588   needs:
589     - "cerbero deps cross-android universal"
590
591 build cerbero cross-android universal:
592   extends: '.cerbero cross-android universal'
593   variables:
594     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
595
596 #
597 # Cerbero Cross Windows builds
598 #
599 cerbero deps cross-windows x86:
600   extends: '.cerbero deps'
601   variables:
602     CONFIG: "cross-win32.cbc"
603     ARCH: "mingw_x86"
604
605 .cerbero cross win32:
606   extends: '.cerbero'
607   variables:
608     CONFIG: "cross-win32.cbc"
609     CERBERO_RUN_WRAPPER: "wine"
610     CERBERO_RUN_SUFFIX: ".exe"
611
612 cerbero cross win32:
613   extends: '.cerbero cross win32'
614   variables:
615     ONLY_PROJECT_REGEX: '/^cerbero$/'
616   needs:
617     - "cerbero deps cross-windows x86"
618
619 build cerbero cross win32:
620   extends: '.cerbero cross win32'
621   variables:
622     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
623
624 cerbero deps cross-windows x86_64:
625   extends: '.cerbero deps'
626   variables:
627     CONFIG: "cross-win64.cbc"
628     ARCH: "mingw_x86_64"
629
630 .cerbero cross win64:
631   extends: '.cerbero'
632   variables:
633     CONFIG: "cross-win64.cbc"
634     CERBERO_RUN_WRAPPER: "wine"
635     CERBERO_RUN_SUFFIX: ".exe"
636
637 cerbero cross win64:
638   extends: '.cerbero cross win64'
639   variables:
640     ONLY_PROJECT_REGEX: '/^cerbero$/'
641   needs:
642     - "cerbero deps cross-windows x86_64"
643
644 build cerbero cross win64:
645   extends: '.cerbero cross win64'
646   variables:
647     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-docs|gst-integration-testsuites|gst-plugins-rs)$/'
648
649 #
650 # Build an Android App using the android binaries
651 #
652 .cross-android universal examples:
653   image: $ANDROID_IMAGE
654   extends:
655     - '.global_ci_policy'
656   stage: 'integrate'
657   variables:
658     EXAMPLES_HOME: ${CI_PROJECT_DIR}/examples
659     GSTREAMER_ROOT_ANDROID: ${CI_PROJECT_DIR}/examples/cerbero-android-universal
660   script:
661     - mkdir -p ${EXAMPLES_HOME}/outputs
662     - curl -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py
663     - chmod +x clone_manifest_ref.py
664     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-examples --destination ${EXAMPLES_HOME}/gst-examples
665     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-docs --destination ${EXAMPLES_HOME}/gst-docs
666     - rm clone_manifest_ref.py
667
668     # extract our binaries
669     - rm -f gstreamer-1.0-android-universal-*-runtime.tar.bz2
670     - mkdir ${GSTREAMER_ROOT_ANDROID}
671     - tar -C ${GSTREAMER_ROOT_ANDROID} -xf gstreamer-1.0-android-universal-*.tar.bz2
672
673     # gst-examples
674     - chmod +x ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew
675     - ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew --no-search-upward --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/playback/player/android assembleDebug
676     - cp ${EXAMPLES_HOME}/gst-examples/playback/player/android/app/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
677
678     # gst-docs android tutorials
679     - chmod +x ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew
680     - ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew --no-search-upward --no-daemon --project-dir ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android assembleDebug
681     - cp ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/android-tutorial-*/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
682   after_script:
683     - rm -rf ${GSTREAMER_ROOT_ANDROID}
684     - rm -rf ${EXAMPLES_HOME}/gst-examples ${EXAMPLES_HOME}/gst-docs
685   artifacts:
686     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
687     expire_in: '5 days'
688     when: 'always'
689     paths:
690       - "manifest.xml"
691       - "${EXAMPLES_HOME}/outputs"
692
693 cross-android universal examples:
694   extends: ".cross-android universal examples"
695   variables:
696     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
697   needs:
698     - "build cerbero cross-android universal"
699
700 cerbero cross-android universal examples:
701   extends: ".cross-android universal examples"
702   variables:
703     ONLY_PROJECT_REGEX: '/^cerbero$/'
704   needs:
705     - "cerbero cross-android universal"
706
707 #
708 # Cerbero macOS X86_64 build
709 #
710 cerbero deps macos x86_64:
711   extends: '.cerbero deps'
712   variables:
713     ARCH: "darwin_x86_64"
714     CONFIG: "osx-x86-64.cbc"
715     HAVE_CCACHE: ""
716     CERBERO_OVERRIDDEN_DIST_DIR: "/Library/Frameworks/GStreamer.framework/Versions/1.0"
717     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
718   tags:
719     - gst-macos-10.15
720
721 .cerbero macos x86_64:
722   extends: '.cerbero'
723   variables:
724     ARCH: "darwin_x86_64"
725     CONFIG: "osx-x86-64.cbc"
726     CERBERO_PACKAGE_ARGS: ""
727     HAVE_CCACHE: ""
728     CERBERO_OVERRIDDEN_DIST_DIR: "/Library/Frameworks/GStreamer.framework/Versions/1.0"
729     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
730   tags:
731     - gst-macos-10.15
732   artifacts:
733     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
734     expire_in: '5 days'
735     when: 'always'
736     paths:
737       - "manifest.xml"
738       - "${CERBERO_HOME}/logs"
739       - "gstreamer-1.0-1.*.pkg"
740       - "gstreamer-1.0-devel-1.*.pkg"
741
742 cerbero macos x86_64:
743   extends: '.cerbero macos x86_64'
744   variables:
745     ONLY_PROJECT_REGEX: '/^cerbero$/'
746   needs:
747     - "cerbero deps macos x86_64"
748
749 build cerbero macos x86_64:
750   extends: '.cerbero macos x86_64'
751   variables:
752     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-docs|gst-omx|gst-sharp|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
753
754 #
755 # Cerbero iOS build
756 #
757 cerbero deps cross-ios universal:
758   extends: '.cerbero deps'
759   variables:
760     ARCH: "ios_universal"
761     CONFIG: "cross-ios-universal.cbc"
762     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
763     HAVE_CCACHE: ""
764     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
765   tags:
766     - gst-ios-13.2
767
768 .cerbero cross-ios universal:
769   extends: '.cerbero'
770   variables:
771     ARCH: "ios_universal"
772     CONFIG: "cross-ios-universal.cbc"
773     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
774     CERBERO_PACKAGE_ARGS: ""
775     HAVE_CCACHE: ""
776     CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/"
777   tags:
778     - gst-ios-13.2
779   artifacts:
780     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
781     expire_in: '5 days'
782     when: 'always'
783     paths:
784       - "manifest.xml"
785       - "${CERBERO_HOME}/logs"
786       - "gstreamer-1.0-*-ios-universal.pkg"
787
788 cerbero cross-ios universal:
789   extends: '.cerbero cross-ios universal'
790   variables:
791     ONLY_PROJECT_REGEX: '/^cerbero$/'
792   needs:
793     - "cerbero deps cross-ios universal"
794
795 build cerbero cross-ios universal:
796   extends: '.cerbero cross-ios universal'
797   variables:
798     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-docs|gst-omx|gst-sharp|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
799
800 documentation:
801   image: $FEDORA_IMAGE
802   extends:
803     - '.global_ci_policy'
804   variables:
805     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-sharp|gst-integration-testsuites|gst-plugins-rs|gst-python)$/'
806   needs:
807     - "build fedora x86_64"
808   stage: integrate
809
810   script:
811   - pip3 install --upgrade git+https://github.com/hotdoc/hotdoc.git
812   - cd gst-build/
813   - ./gst-uninstalled.py hotdoc run --conf-file=build/subprojects/gst-docs/GStreamer-doc.json --fatal-warnings
814   - cd -
815   - mv gst-build/build/subprojects/gst-docs/GStreamer-doc/html documentation/
816
817   artifacts:
818     paths:
819     - documentation/
820
821 #
822 # Build an iOS App using the iOS binaries
823 #
824 .cross-ios universal examples:
825   stage: 'integrate'
826   extends:
827     - '.global_ci_policy'
828   variables:
829     EXAMPLES_HOME: ${CI_PROJECT_DIR}/examples
830     # disable codesigning so we don't need developer identities on the CI
831     # machines
832     XCODE_BUILD_ARGS: >
833       CODE_SIGNING_REQUIRED="NO"
834       CODE_SIGN_IDENTITY=""
835       CODE_SIGNING_ALLOWED="NO"
836       CODE_SIGN_ENTITLEMENTS=""
837     EXCEPT_PROJECT_REGEX: '/^(cerbero|gst-build|gst-omx|gstreamer-vaapi|gst-integration-testsuites|gst-plugins-rs)$/'
838   script:
839     # install the binaries
840     - installer -pkg gstreamer-1.0-devel-*-ios-universal.pkg -target CurrentUserHomeDirectory -verbose
841
842     - curl -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/clone_manifest_ref.py
843     - chmod +x clone_manifest_ref.py
844     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-examples --destination ${EXAMPLES_HOME}/gst-examples
845     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-docs --destination ${EXAMPLES_HOME}/gst-docs
846     - rm clone_manifest_ref.py
847
848     # dump some useful information
849     - xcodebuild -version
850     - xcodebuild -showsdks
851
852     # gst-docs ios tutorials
853     - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj
854     - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj ${XCODE_BUILD_ARGS}
855
856     # gst-examples
857     - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj
858     - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj ${XCODE_BUILD_ARGS}
859   after_script:
860     - rm -rf ${EXAMPLES_HOME}/gst-examples ${EXAMPLES_HOME}/gst-docs
861   tags:
862     - gst-ios-13.2
863
864 cross-ios universal examples:
865   extends: ".cross-ios universal examples"
866   needs:
867     - "build cerbero cross-ios universal"
868
869 cerbero cross-ios universal examples:
870   extends: ".cross-ios universal examples"
871   variables:
872     ONLY_PROJECT_REGEX: '/^cerbero$/'
873   needs:
874     - "cerbero cross-ios universal"
875
876 build gst-omx zynq fedora x86_64:
877   extends: 'build fedora x86_64'
878   variables:
879     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} --werror"
880     ONLY_PROJECT_REGEX: '/^(gst-omx|gst-ci)$/'
881   before_script:
882     - git clone https://github.com/Xilinx/vcu-omx-il.git --branch=release-2019.2 ${CI_PROJECT_DIR}/vcu-omx-il
883
884 build gst-omx tizonia fedora x86_64:
885   extends: 'build fedora x86_64'
886   variables:
887     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} --werror"
888     PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}:${CI_PROJECT_DIR}/tizonia-install/lib64/pkgconfig/
889     ONLY_PROJECT_REGEX: '/^(gst-omx|gst-ci)$/'
890   before_script:
891     - git clone https://github.com/tizonia/tizonia-openmax-il --branch v0.20.2
892     - cd tizonia-openmax-il
893     - meson build -Dclients=false -Dplugins='' -Dplayer=false -Dprefix=${CI_PROJECT_DIR}/tizonia-install
894     - ninja -C build
895     - ninja -C build install
896     - cd ..
897
898 build rust fedora x86_64:
899   extends: 'build fedora x86_64'
900   variables:
901     MESON_ARGS: "-Domx=disabled -Dpython=disabled -Dlibav=disabled -Dlibnice=disabled -Dugly=disabled -Dbad=disabled -Ddevtools=enabled -Dges=disabled -Drtsp_server=disabled -Dvaapi=disabled -Dsharp=disabled -Dgst-examples=disabled -Drs=enabled -Dgst-plugins-rs:sodium=system ${MESON_BUILDTYPE_ARGS} --werror"
902     ONLY_PROJECT_REGEX: '/^(gst-plugins-rs|gstreamer|gst-plugins-base|gst-ci|gst-build|gst-devtools)$/'
903
904 check rust fedora:
905   extends: '.test fedora x86_64'
906   needs:
907     - 'build rust fedora x86_64'
908   variables:
909     TEST_SUITE: "check.gst-plugins-rs.*"
910     ONLY_PROJECT_REGEX: '/^(gst-plugins-rs|gstreamer|gst-plugins-base|gst-ci|gst-build|gst-devtools)$/'