92dca4f5f2c38476b5e1e4fc3302090550c2b624
[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   rules:
16     - when: 'always'
17   image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/test-manifest:2019-10-23-793476'
18   stage: "preparation"
19   script:
20     - pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
21   coverage: '/TOTAL.*\s+(\d+%)$/'
22   artifacts:
23     reports:
24       junit:
25         - "junit.xml"
26
27 .base:
28   image: 'registry.fedoraproject.org/fedora:31'
29   extends:
30     - '.global_ci_policy'
31   tags: ['gstreamer']
32   rules:
33     - when: 'manual'
34       allow_failure: true
35   variables:
36     STORAGE_DRIVER: 'vfs'
37     BUILDAH_FORMAT: 'docker'
38     GIT_STRATEGY: fetch
39   script:
40     - export DATE=$(date +"%Y-%m-%d")
41     - export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
42     - export _UID="${IMAGE}:${DATE}-${CI_JOB_ID}"
43     - export LATEST="${IMAGE}:latest"
44
45     - dnf install -y buildah runc
46     # Newer versions of podman/buildah try to set overlayfs mount options when
47     # using the vfs driver, and this causes errors.
48     - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
49
50     - buildah bud --build-arg DEFAULT_BRANCH=${GST_UPSTREAM_BRANCH} -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
51
52     # If we are in a fork, push the image to the reigstry regardless the branch
53     - |
54       if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
55         buildah login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
56         buildah push ${LATEST}
57       fi
58
59     # Push the images to the upstream registry
60     - |
61       if [ "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
62         # Tag the image with the git ref
63         buildah tag ${LATEST} ${_UID}-${CI_COMMIT_REF_NAME}
64         # Push the tags
65         buildah login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
66         buildah push ${_UID}-${CI_COMMIT_REF_NAME}
67         buildah push ${LATEST}
68       fi
69
70 alpine amd64 manifest builder docker:
71   stage: "build docker"
72   variables:
73     ARCH: "amd64"
74     TAG: "build-manifest"
75     CONTEXT_DIR: "docker/build_manifest/"
76     DOCKERFILE: "docker/build_manifest/Dockerfile"
77   extends: .base
78
79 test manifest amd64 docker:
80   stage: "build docker"
81   variables:
82     ARCH: "amd64"
83     TAG: "test-manifest"
84     CONTEXT_DIR: "docker/test_manifest/"
85     DOCKERFILE: "docker/test_manifest/Dockerfile"
86   extends: .base
87
88 gst-indent amd64 docker:
89   stage: "build docker"
90   variables:
91     ARCH: "amd64"
92     TAG: "gst-indent"
93     CONTEXT_DIR: "docker/indent/"
94     DOCKERFILE: "docker/indent/Dockerfile"
95   extends: .base
96
97 fedora amd64 docker:
98   stage: "build docker"
99   variables:
100     ARCH: "amd64"
101     TAG: "fedora"
102     CONTEXT_DIR: "docker/fedora/"
103     DOCKERFILE: "docker/fedora/Dockerfile"
104   extends: .base
105
106 cerbero fedora amd64 docker:
107   stage: "build docker"
108   variables:
109     ARCH: "amd64"
110     TAG: "cerbero-fedora"
111     CONTEXT_DIR: "docker/cerbero/"
112     DOCKERFILE: "docker/cerbero/Dockerfile-fedora"
113   extends: .base
114
115 android docker:
116   stage: "build docker"
117   variables:
118     ARCH: "amd64"
119     TAG: "android"
120     CONTEXT_DIR: "docker/android/"
121     DOCKERFILE: "docker/android/Dockerfile"
122   extends: .base
123
124 .local_rules: &local_rules
125   rules:
126     - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "gstreamer/gst-ci"'
127       when: 'never'
128     - when: 'manual'
129       allow_failure: true
130
131 .local_template: &local_template
132   <<: *local_rules
133   needs:
134     - 'manifest'
135
136 # Test the build job against the latest build image tag and the local manifest
137 build fedora x86_64 local:
138   extends: '.build'
139   stage: 'build'
140   image: "${CI_REGISTRY_IMAGE}/amd64/fedora:latest"
141   artifacts:
142     expire_in: '5 days'
143     when: always
144     paths:
145       - "manifest.xml"
146       - "gst-build/"
147   <<: *local_template
148
149 build cerbero fedora x86_64 local:
150   extends: '.cerbero fedora x86_64'
151   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
152   <<: *local_template
153
154 build cerbero cross-android universal local:
155   extends: '.cerbero cross-android universal'
156   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
157   <<: *local_template
158
159 build cerbero cross win32 local:
160   extends: '.cerbero cross win32'
161   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
162   <<: *local_template
163
164 build cerbero cross win64 local:
165   extends: '.cerbero cross win64'
166   image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
167   <<: *local_template
168
169 # Note: dependencies: will be deprecated in the future, but current manual
170 # jobs with needs: (even if they are allowed to fail) will leave the pipeline
171 # pending.
172 .test fedora x86_64 local:
173   image: '${CI_REGISTRY_IMAGE}/amd64/fedora:latest'
174   extends: '.test'
175   <<: *local_rules
176
177 check fedora local:
178   extends: '.test fedora x86_64 local'
179   variables:
180     TEST_SUITE: 'check.gst*'
181
182 cross-android universal examples local:
183   extends: '.cross-android universal examples'
184   image: "${CI_REGISTRY_IMAGE}/amd64/android:latest"
185   <<: *local_rules
186   dependencies:
187     - 'build cerbero cross-android universal local'
188
189 integration testsuites fedora local:
190   extends: '.test fedora x86_64 local'
191   before_script:
192     - rm -f gst-build/build/subprojects/gstreamer-vaapi/gst/vaapi/libgstvaapi.so
193   variables:
194     EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures"
195     TEST_SUITE: "validate ges"