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