Port from only/except to rules
[platform/upstream/gstreamer.git] / .gitlab-ci.yml
1 include: "gitlab/ci_template.yml"
2
3 stages:
4   - "build docker"
5   - "preparation"
6   - "pre-build"
7   - "build"
8   - "test"
9   # use the binaries in some way
10   - "integrate"
11
12 test manifest:
13   variables:
14     GIT_STRATEGY: fetch
15   image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/test-manifest:2019-10-23-793476'
16   stage: "preparation"
17   script:
18     - pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
19   coverage: '/TOTAL.*\s+(\d+%)$/'
20   artifacts:
21     reports:
22       junit:
23         - "junit.xml"
24
25 .base:
26   image: "docker:stable"
27   services:
28     - docker:dind
29   when: 'manual'
30   variables:
31     # When using dind, it's wise to use the overlayfs driver for
32     # improved performance.
33     DOCKER_DRIVER: "overlay2"
34     GIT_STRATEGY: fetch
35   script:
36     - export DATE=$(date +"%Y-%m-%d")
37     - export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
38     - export _UID="${IMAGE}:${DATE}-${CI_JOB_ID}"
39     - export LATEST="${IMAGE}:latest"
40
41     - docker build --pull --build-arg DEFAULT_BRANCH=${GST_UPSTREAM_BRANCH} -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
42
43     # If we are in a fork, push the image to the reigstry regardless the branch
44     - |
45       if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
46         docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
47         docker push ${LATEST}
48       fi
49
50     # Push the images to the upstream registry
51     - |
52       if [ "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
53         # Tag the image with the git ref
54         docker image tag ${LATEST} ${_UID}-${CI_COMMIT_REF_NAME}
55         # Push the tags
56         docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
57         docker push ${_UID}-${CI_COMMIT_REF_NAME}
58         docker push ${LATEST}
59       fi
60
61 alpine amd64 manifest builder docker:
62   stage: "build docker"
63   variables:
64     ARCH: "amd64"
65     TAG: "build-manifest"
66     CONTEXT_DIR: "docker/build_manifest/"
67     DOCKERFILE: "docker/build_manifest/Dockerfile"
68   extends: .base
69
70 test manifest amd64 docker:
71   stage: "build docker"
72   variables:
73     ARCH: "amd64"
74     TAG: "test-manifest"
75     CONTEXT_DIR: "docker/test_manifest/"
76     DOCKERFILE: "docker/test_manifest/Dockerfile"
77   extends: .base
78
79 gst-indent amd64 docker:
80   stage: "build docker"
81   variables:
82     ARCH: "amd64"
83     TAG: "gst-indent"
84     CONTEXT_DIR: "docker/indent/"
85     DOCKERFILE: "docker/indent/Dockerfile"
86   extends: .base
87
88 fedora amd64 docker:
89   stage: "build docker"
90   variables:
91     ARCH: "amd64"
92     TAG: "fedora"
93     CONTEXT_DIR: "docker/fedora/"
94     DOCKERFILE: "docker/fedora/Dockerfile"
95   extends: .base
96
97 cerbero fedora amd64 docker:
98   stage: "build docker"
99   variables:
100     ARCH: "amd64"
101     TAG: "cerbero-fedora"
102     CONTEXT_DIR: "docker/cerbero/"
103     DOCKERFILE: "docker/cerbero/Dockerfile-fedora"
104   extends: .base
105
106 android docker:
107   stage: "build docker"
108   variables:
109     ARCH: "amd64"
110     TAG: "android"
111     CONTEXT_DIR: "docker/android/"
112     DOCKERFILE: "docker/android/Dockerfile"
113   extends: .base
114
115 .build local:
116   extends: '.build'
117   rules:
118     - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "gstreamer/gst-ci"'
119       when: 'never'
120     - when: 'manual'
121   needs:
122     - 'manifest'
123
124 # Test the build job against the latest build image tag and the local manifest
125 build fedora x86_64 local:
126   extends: '.build local'
127   stage: 'build'
128   image: "${CI_REGISTRY_IMAGE}/amd64/fedora:latest"
129   artifacts:
130     expire_in: '5 days'
131     when: always
132     paths:
133       - "manifest.xml"
134       - "gst-build/"
135
136 build cerbero fedora x86_64 local:
137   extends: '.cerbero fedora x86_64'
138   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
139
140 build cerbero cross-android universal local:
141   extends: '.cerbero cross-android universal'
142   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
143
144 build cerbero cross win32 local:
145   extends: '.cerbero cross win32'
146   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
147
148 build cerbero cross win64 local:
149   extends: '.cerbero cross win64'
150   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
151
152 .test fedora x86_64 local:
153   image: '${CI_REGISTRY_IMAGE}/amd64/fedora:latest'
154   extends: '.test'
155   dependencies:
156     - 'build fedora x86_64 local'
157
158 check fedora local:
159   extends: '.test fedora x86_64 local'
160   variables:
161     TEST_SUITE: 'check.gst*'
162
163 cross-android universal examples local:
164   extends: '.cross-android universal examples'
165   image: "${CI_REGISTRY_IMAGE}/amd64/android:latest"
166   dependencies:
167     - "build cerbero cross-android universal local"
168
169 integration testsuites fedora local:
170   extends: '.test fedora x86_64 local'
171   before_script:
172     - rm -f gst-build/build/subprojects/gstreamer-vaapi/gst/vaapi/libgstvaapi.so
173   variables:
174     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures"
175     TEST_SUITE: "validate ges"