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