Add support for building the doc
[platform/upstream/gstreamer.git] / gitlab / ci_template.yml
1 stages:
2   - 'preparation'
3   # Test just one basic build, if it succeeds proceed to test the rest
4   - 'build'
5   - 'test'
6   # Run multiple builds and tests, multi-distro, multi-arch
7   - 'full builds'
8   - 'full tests'
9   # build some apps to check that cross-platform binaries are usable
10   - 'apps'
11   - 'deploy'
12
13 variables:
14   ANDROID_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/android:2019-03-26-196225'
15   CERBERO_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/cerbero-fedora:7ed820aa1fcf95938cc161e397b1bf455f1f5b74'
16   FEDORA_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2019-05-13-295487'
17   INDENT_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/gst-indent:6f7e01e1e30a73efa880acdc8e911f1f20c58dbb'
18   MANIFEST_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/build-manifest:d19082b72667fb3382bdc3621520c4d26e258b2e'
19
20   GIT_STRATEGY: none
21   DEFAULT_MESON_ARGS: >
22     --werror
23     -Dpython=enabled
24     -Dlibav=enabled
25     -Dugly=enabled
26     -Dbad=enabled
27     -Ddevtools=enabled
28     -Dges=enabled
29     -Drtsp_server=enabled
30     -Dvaapi=enabled
31     -Dsharp=disabled
32
33   DEFAULT_CERBERO_ARGS: >
34     --variants werror
35     --timestamps
36
37 manifest:
38   image: $MANIFEST_IMAGE
39   stage: 'preparation'
40   script:
41     - cd /gst-ci
42     - gitlab/build_manifest.py --self-update
43     - gitlab/build_manifest.py ${CI_PROJECT_DIR}/manifest.xml
44     - cat ${CI_PROJECT_DIR}/manifest.xml
45   artifacts:
46     expire_in: "7 days"
47     paths:
48       - "manifest.xml"
49
50 gst indent:
51   image: $INDENT_IMAGE
52   stage: 'preparation'
53   variables:
54     GIT_STRATEGY: 'fetch'
55   script:
56     # man indent. grep RETURN VALUE, grab a beer on my behalf...
57     - indent --version || true
58     - curl -o gst-indent https://gitlab.freedesktop.org/gstreamer/gstreamer/raw/master/tools/gst-indent
59     - chmod +x gst-indent
60     - find . -name '*.c' -exec ./gst-indent {} +
61     - |
62       if git diff --quiet; then
63           echo "Code is properly formatted"
64       else
65           git diff --color=always
66           echo 'style diverges, please run gst-indent first'
67           exit 1
68       fi
69   except:
70     variables:
71       # No point on trying to format C files in those repositories
72       - $CI_PROJECT_NAME == "gstreamer-sharp"
73       - $CI_PROJECT_NAME == "gst-integration-testsuites"
74       - $CI_PROJECT_NAME == "cerbero"
75       - $CI_PROJECT_NAME == "gst-docs"
76
77 .build:
78   stage: 'full builds'
79   dependencies:
80     - "manifest"
81   variables:
82     CC: "ccache gcc"
83     CXX: "ccache g++"
84     CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
85     CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"
86     MESON_ARGS: "${DEFAULT_MESON_ARGS}"
87
88   script:
89     - ccache -z
90     # Not sure why, but permission errors else
91     # https://gitlab.freedesktop.org/alatiera/gstreamer/-/jobs/41441
92     - cp -r /gst-build/ . && cd gst-build
93     - ./git-update --no-interaction --manifest="${CI_PROJECT_DIR}/manifest.xml"
94     - meson build/ $MESON_ARGS
95     - ninja -C build/
96     - ccache -s
97   after_script:
98     - cd gst-build/
99     # Clean the artifacts packages to avoid copying "useless" build products.
100     - test -d build && find build -name '*.[ao]' -delete
101     # Clean the .git repos since we won't need them anymore
102     - rm -rf subprojects/*/.git/
103     - rm -rf build/subprojects/*/.git/
104   cache:
105     key: "${CI_JOB_NAME}"
106     paths:
107       - "${CCACHE_DIR}"
108   artifacts:
109     expire_in: '5 days'
110     when: always
111     paths:
112       - "manifest.xml"
113       - "gst-build/"
114   except:
115     variables:
116       - $CI_PROJECT_NAME == "cerbero"
117
118 build fedora x86_64:
119   extends: '.build'
120   stage: 'build'
121   image: $FEDORA_IMAGE
122   variables:
123     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Domx=enabled -Dgst-omx:target=generic -Ddoc=enabled"
124
125 build nodebug fedora x86_64:
126   extends: '.build'
127   stage: 'build'
128   image: $FEDORA_IMAGE
129   variables:
130     MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic"
131
132 .test:
133   stage: 'test'
134   variables:
135     # Disable colored output to avoid weird rendering issues
136     GST_DEBUG_NO_COLOR: "true"
137     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/validate-logs/"
138     GST_VALIDATE_LAUNCHER_FORCE_COLORS: "true"
139   script:
140     - cd gst-build/
141     - echo "-> Running ${TEST_SUITE}"
142     - >
143       ./gst-uninstalled.py
144       gst-validate-launcher ${TEST_SUITE}
145       --dump-on-failure
146       --mute
147       --shuffle
148       --no-display
149       --meson-no-rebuild
150       --fail-on-testlist-change
151       -l "${CI_PROJECT_DIR}/validate-logs/"
152       --xunit-file "${CI_PROJECT_DIR}/validate-logs/xunit.xml"
153       ${EXTRA_VALIDATE_ARGS}
154   artifacts:
155     expire_in: '14 days'
156     when: always
157     paths:
158       - 'gst-build/build/meson-logs/'
159       - 'validate-logs'
160     reports:
161       junit:
162         - "validate-logs/*.xml"
163   # We disable the .build above, which this job usually depends upon for cerbero
164   except:
165     variables:
166       - $CI_PROJECT_NAME == "cerbero"
167       - $CI_PROJECT_NAME == "gst-examples"
168       - $CI_PROJECT_NAME == "gst-docs"
169
170 .test fedora x86_64:
171   image: $FEDORA_IMAGE
172   extends: '.test'
173   dependencies:
174     - build fedora x86_64
175
176 check fedora:
177   extends: '.test fedora x86_64'
178   variables:
179     TEST_SUITE: "check.gst*"
180   except:
181     variables:
182       - $CI_PROJECT_NAME == "gst-integration-testsuites"
183       - $CI_PROJECT_NAME == "cerbero"
184       - $CI_PROJECT_NAME == "gst-examples"
185       - $CI_PROJECT_NAME == "gst-omx"
186       - $CI_PROJECT_NAME == "gst-docs"
187
188 integration testsuites fedora:
189   extends: '.test fedora x86_64'
190   before_script:
191     - rm -f gst-build/build/subprojects/gstreamer-vaapi/gst/vaapi/libgstvaapi.so
192   variables:
193     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --check-bugs"
194     TEST_SUITE: "validate ges"
195   except:
196     variables:
197       - $CI_PROJECT_NAME == "gst-omx"
198       - $CI_PROJECT_NAME == "gstreamer-vaapi"
199       - $CI_PROJECT_NAME == "cerbero"
200       - $CI_PROJECT_NAME == "gst-docs"
201
202 # Valgrind
203 .valgrind fedora x86_64:
204   extends: '.test fedora x86_64'
205   stage: 'full tests'
206   variables:
207     EXTRA_VALIDATE_ARGS: "--valgrind"
208   # Some suppression files are missing a newline at the end which messes things
209   # up when concatenating them. awk will add missing newlines (unlike cat)
210
211 valgrind core:
212   extends: '.valgrind fedora x86_64'
213   variables:
214     TEST_SUITE: "check.gstreamer\\..*"
215   only:
216     variables:
217       - $CI_PROJECT_NAME == "gstreamer"
218
219 valgrind base:
220   extends: '.valgrind fedora x86_64'
221   variables:
222     TEST_SUITE: "check.gst-plugins-base\\..*"
223   only:
224     variables:
225       - $CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base)$/
226
227 valgrind good:
228   extends: '.valgrind fedora x86_64'
229   variables:
230     TEST_SUITE: "check.gst-plugins-good\\..*"
231   only:
232     variables:
233       - $CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good)$/
234
235 valgrind ugly:
236   extends: '.valgrind fedora x86_64'
237   variables:
238     TEST_SUITE: "check.gst-plugins-ugly\\..*"
239   only:
240     variables:
241       - $CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-ugly)$/
242
243 valgrind bad:
244   extends: '.valgrind fedora x86_64'
245   variables:
246     TEST_SUITE: "check.gst-plugins-bad\\..*"
247   only:
248     variables:
249       - $CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good|gst-plugins-bad)$/
250
251 valgrind ges:
252   extends: '.valgrind fedora x86_64'
253   variables:
254     TEST_SUITE: "check.gst-editing-services\\..*"
255   only:
256     variables:
257       - $CI_PROJECT_NAME =~ /^(gstreamer|gst-plugins-base|gst-plugins-good|gst-editing-services)$/
258
259 # Template for Cerbero GStreamer Build
260 #
261 # Parameters:
262 # CONFIG: The name of the configuration file to use
263 #
264 # Produces runtime and devel tarball packages.
265 .cerbero:
266   stage: "full builds"
267   image: $CERBERO_IMAGE
268   dependencies:
269     - "manifest"
270   variables:
271     CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
272     CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"
273     CCACHE_MAXSIZE: "1.7G"
274     CERBERO_HOME: "${CI_PROJECT_DIR}/cerbero-build"
275     CERBERO_SOURCES: "${CI_PROJECT_DIR}/cerbero-sources"
276     CERBERO_DEPS: "cerbero-deps.tar.gz"
277     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS}"
278     CERBERO: "./cerbero-uninstalled -c config/${CONFIG} -c localconf.cbc -m manifest.xml"
279   before_script:
280     # FIXME Wrong namespace
281     # Workaround build-tools having hardcoded internal path
282     - mkdir -p /builds/gstreamer
283     - ln -sf ${CI_PROJECT_DIR} /builds/gstreamer/cerbero
284     - rsync -aH /cerbero/ .
285     - test -f ${CERBERO_DEPS} && tar -C ${CERBERO_HOME} -xf ${CERBERO_DEPS}
286     - echo "home_dir = \"${CERBERO_HOME}\"" >> localconf.cbc
287     - echo "local_sources = \"${CERBERO_SOURCES}\"" >> localconf.cbc
288     - ./cerbero-uninstalled --self-update manifest.xml
289     - ccache -z
290   script:
291     - $CERBERO $CERBERO_ARGS show-config
292     - $CERBERO $CERBERO_ARGS fetch-bootstrap --build-tools-only
293     - $CERBERO $CERBERO_ARGS fetch-package --deps gstreamer-1.0
294     - $CERBERO $CERBERO_ARGS fetch-cache
295     - $CERBERO $CERBERO_ARGS bootstrap --offline --build-tools-only
296     - $CERBERO $CERBERO_ARGS package --offline -t -o ${CI_PROJECT_DIR} gstreamer-1.0
297     - ccache -s
298   except:
299     variables:
300       - $CI_PROJECT_NAME == "gst-build"
301       - $CI_PROJECT_NAME == "gst-docs"
302   cache:
303     key: "${CI_JOB_NAME}"
304     paths:
305       - "${CCACHE_DIR}"
306       - "${CERBERO_SOURCES}"
307   artifacts:
308     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
309     expire_in: '5 days'
310     when: 'always'
311     paths:
312       - "manifest.xml"
313       - "cerbero-build/logs"
314       - "*.tar.bz2"
315
316 # Template for Cerbero GStreamer Deps
317 #
318 # This template is used by cerbero/ project to pre-built the GStreamer
319 # depedencies. When available, the .cerbero jobs will download this artifact
320 # in order to speed up the build.
321 #
322 # Parameters:
323 # CONFIG: The name of the configuration file to use
324 # ARCH: The cerbero <os>_<cpu> (used in cache key)
325 #
326 # Produce an artifact with the dist/ and .cache along
327 # with the associated build-tools.
328 .cerbero deps:
329   extends: .cerbero
330   stage: "build"
331   script:
332     - $CERBERO $CERBERO_ARGS show-config
333     - $CERBERO $CERBERO_ARGS fetch-bootstrap --build-tools-only
334     - $CERBERO $CERBERO_ARGS fetch-package --deps gstreamer-1.0
335     - $CERBERO $CERBERO_ARGS bootstrap --offline --build-tools-only
336     - $CERBERO $CERBERO_ARGS build-deps --offline
337           gstreamer-1.0 gst-plugins-base-1.0 gst-plugins-good-1.0
338           gst-plugins-bad-1.0 gst-plugins-ugly-1.0 gst-rtsp-server-1.0
339           gst-libav-1.0 gst-validate gst-editing-services-1.0 libnice
340     - $CERBERO $CERBERO_ARGS fetch-cache --skip-fetch --job-id=${CI_JOB_ID}
341     - tar -C ${CERBERO_HOME} -czf $CERBERO_DEPS
342               build-tools build-tools.cache
343               dist/${ARCH} ${ARCH}.cache
344     - ccache -s
345   only:
346     variables:
347       - $CI_PROJECT_NAME == "cerbero"
348   artifacts:
349     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
350     expire_in: '10 days'
351     when: 'always'
352     paths:
353       - "manifest.xml"
354       - "cerbero-build/logs"
355       - "cerbero-build/cerbero-deps.log"
356       - "${CERBERO_DEPS}"
357
358 #
359 # Cerbero Linux X86_64 build
360 #
361 cerbero deps fedora x86_64:
362   extends: '.cerbero deps'
363   variables:
364     CONFIG: "linux.config"
365     ARCH: "linux_x86_64"
366
367 .cerbero fedora x86_64:
368   extends: '.cerbero'
369   variables:
370     CONFIG: "linux.config"
371
372 cerbero fedora x86_64:
373   extends: '.cerbero fedora x86_64'
374   dependencies:
375     - "cerbero deps fedora x86_64"
376   only:
377     variables:
378       - $CI_PROJECT_NAME == "cerbero"
379
380 build cerbero fedora x86_64:
381   extends: '.cerbero fedora x86_64'
382   except:
383     variables:
384       - $CI_PROJECT_NAME == "cerbero"
385       - $CI_PROJECT_NAME == "gst-build"
386       - $CI_PROJECT_NAME == "gst-omx"
387       - $CI_PROJECT_NAME == "gstreamer-vaapi"
388       - $CI_PROJECT_NAME == "gst-docs"
389
390 #
391 # Cerbero Android Universal build
392 #
393 cerbero deps android universal:
394   extends: '.cerbero deps'
395   variables:
396     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
397     CONFIG: "cross-android-universal.cbc"
398     ARCH: "android_universal"
399
400 .cerbero android universal:
401   extends: '.cerbero'
402   variables:
403     CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror"
404     CONFIG: "cross-android-universal.cbc"
405
406 cerbero android universal:
407   extends: '.cerbero android universal'
408   dependencies:
409     - "cerbero deps android universal"
410   only:
411     variables:
412       - $CI_PROJECT_NAME == "cerbero"
413
414 build cerbero android universal:
415   extends: '.cerbero android universal'
416   except:
417     variables:
418       - $CI_PROJECT_NAME == "cerbero"
419       - $CI_PROJECT_NAME == "gst-build"
420       - $CI_PROJECT_NAME == "gst-omx"
421       - $CI_PROJECT_NAME == "gstreamer-vaapi"
422       - $CI_PROJECT_NAME == "gst-docs"
423
424 #
425 # Cerbero Cross Windows builds
426 #
427 cerbero deps windows x86:
428   extends: '.cerbero deps'
429   variables:
430     CONFIG: "cross-win32.cbc"
431     ARCH: "windows_x86"
432
433 .cerbero cross win32:
434   extends: '.cerbero'
435   variables:
436     CONFIG: "cross-win32.cbc"
437
438 cerbero cross win32:
439   extends: '.cerbero cross win32'
440   dependencies:
441     - "cerbero deps windows x86"
442   only:
443     variables:
444       - $CI_PROJECT_NAME == "cerbero"
445
446 build cerbero cross win32:
447   extends: '.cerbero cross win32'
448   except:
449     variables:
450       - $CI_PROJECT_NAME == "cerbero"
451       - $CI_PROJECT_NAME == "gst-build"
452       - $CI_PROJECT_NAME == "gst-omx"
453       - $CI_PROJECT_NAME == "gstreamer-vaapi"
454       - $CI_PROJECT_NAME == "gst-docs"
455
456 cerbero deps windows x86_64:
457   extends: '.cerbero deps'
458   variables:
459     CONFIG: "cross-win64.cbc"
460     ARCH: "windows_x86_64"
461
462 .cerbero cross win64:
463   extends: '.cerbero'
464   variables:
465     CONFIG: "cross-win64.cbc"
466
467 cerbero cross win64:
468   extends: '.cerbero cross win64'
469   dependencies:
470     - "cerbero deps windows x86_64"
471   only:
472     variables:
473       - $CI_PROJECT_NAME == "cerbero"
474
475 build cerbero cross win64:
476   extends: '.cerbero cross win64'
477   except:
478     variables:
479       - $CI_PROJECT_NAME == "cerbero"
480       - $CI_PROJECT_NAME == "gst-build"
481       - $CI_PROJECT_NAME == "gst-omx"
482       - $CI_PROJECT_NAME == "gstreamer-vaapi"
483       - $CI_PROJECT_NAME == "gst-docs"
484
485 #
486 # Build an Android App using the android binaries
487 #
488 .android universal examples:
489   image: $ANDROID_IMAGE
490   stage: 'apps'
491   variables:
492     EXAMPLES_HOME: ${CI_PROJECT_DIR}/examples
493     GSTREAMER_ROOT_ANDROID: ${CI_PROJECT_DIR}/examples/cerbero-android-universal
494   script:
495     - mkdir -p ${EXAMPLES_HOME}/outputs
496     - curl -o clone_manifest_ref.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/clone_manifest_ref.py
497     - chmod +x clone_manifest_ref.py
498     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-examples --destination ${EXAMPLES_HOME}/gst-examples
499     - ./clone_manifest_ref.py --manifest manifest.xml --project gst-docs --destination ${EXAMPLES_HOME}/gst-docs
500     - rm clone_manifest_ref.py
501
502     # extract our binaries
503     - rm -f gstreamer-1.0-android-universal-*-runtime.tar.bz2
504     - mkdir ${GSTREAMER_ROOT_ANDROID}
505     - tar -C ${GSTREAMER_ROOT_ANDROID} -xf gstreamer-1.0-android-universal-*.tar.bz2
506
507     # gst-examples
508     - chmod +x ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew
509     - ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew --no-search-upward --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/playback/player/android assembleDebug
510     - cp ${EXAMPLES_HOME}/gst-examples/playback/player/android/app/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
511
512     # gst-docs android tutorials
513     - chmod +x ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew
514     - ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew --no-search-upward --no-daemon --project-dir ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android assembleDebug
515     - cp ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/android-tutorial-*/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/
516   after_script:
517     - rm -rf ${GSTREAMER_ROOT_ANDROID}
518     - rm -rf ${EXAMPLES_HOME}/gst-examples ${EXAMPLES_HOME}/gst-docs
519   artifacts:
520     name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
521     expire_in: '5 days'
522     when: 'always'
523     paths:
524       - "manifest.xml"
525       - "${EXAMPLES_HOME}/outputs"
526
527 android universal examples:
528   extends: ".android universal examples"
529   dependencies:
530     - "build cerbero android universal"
531   except:
532     variables:
533       - $CI_PROJECT_NAME == "cerbero"
534       - $CI_PROJECT_NAME == "gst-build"
535       - $CI_PROJECT_NAME == "gst-omx"
536       - $CI_PROJECT_NAME == "gst-integration-testsuites"
537       - $CI_PROJECT_NAME == "gstreamer-vaapi"
538       - $CI_PROJECT_NAME == "gst-docs"
539
540 cerbero android universal examples:
541   extends: ".android universal examples"
542   dependencies:
543     - "cerbero android universal"
544   only:
545     variables:
546       - $CI_PROJECT_NAME == "cerbero"
547
548 documentation:
549   image: $FEDORA_IMAGE
550   dependencies:
551     - 'build fedora x86_64'
552   stage: deploy
553
554   script:
555   - cd gst-build/
556   - ./gst-uninstalled.py hotdoc run --conf-file=build/subprojects/gst-docs/GStreamer-doc.json --fatal-warnings
557   - cd -
558   - mv gst-build/build/subprojects/gst-docs/GStreamer-doc/html documentation/
559
560   artifacts:
561     paths:
562     - documentation/