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