Docker: fix a type in the test-manifest image
[platform/upstream/gstreamer.git] / .gitlab-ci.yml
1 stages:
2   - "build docker"
3   - "preparation"
4   # Test just one basic build, if succeds procced to test the rest
5   - "build"
6   - "test"
7   # Run multiple builds and tests, multi-distro, multi-arch
8   - "full builds"
9   - "full tests"
10
11 test manifest:
12   variables:
13     GIT_STRATEGY: fetch
14   image: "fedora"
15   stage: "preparation"
16   before_script:
17     - dnf install -y python3-pytest python3-pytest-cov python3-requests
18   script:
19     - pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
20   coverage: '/TOTAL.*\s+(\d+%)$/'
21   artifacts:
22     reports:
23       junit:
24         - "junit.xml"
25   only:
26     changes:
27       - 'gitlab/build_manifest.py'
28
29 .base:
30   image: "docker:stable"
31   services:
32     - docker:dind
33   variables:
34     # When using dind, it's wise to use the overlayfs driver for
35     # improved performance.
36     DOCKER_DRIVER: "overlay2"
37     GIT_STRATEGY: fetch
38   script:
39     - export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
40     - export REF="${IMAGE}:${CI_COMMIT_SHA}"
41     - export LATEST="${IMAGE}:latest"
42
43     - docker build --pull -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
44
45     # If we are in a fork, push the image to the reigstry regardless the branch
46     - |
47       if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
48         docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
49         docker push ${LATEST}
50       fi
51
52     # Push the images to the upstream registry
53     - |
54       if [ "$CI_COMMIT_REF_NAME" = "master" -a "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
55         # Tag the image with the git ref
56         docker image tag ${LATEST} ${REF}
57         # Push the tags
58         docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
59         docker push ${REF}
60         docker push ${LATEST}
61       fi
62
63 alpine amd64 manifest builder docker:
64   stage: "build docker"
65   variables:
66     ARCH: "amd64"
67     TAG: "build-manifest"
68     CONTEXT_DIR: "docker/build_manifest/"
69     DOCKERFILE: "docker/build_manifest/Dockerfile"
70   extends: .base
71   only:
72     changes:
73       - 'docker/build_manifest/*'
74       - 'gitlab/build_manifest.py'
75
76 test manifest amd64 docker:
77   stage: "build docker"
78   variables:
79     ARCH: "amd64"
80     TAG: "test-manifest"
81     CONTEXT_DIR: "docker/test_manifest/"
82     DOCKERFILE: "docker/test_manifest/Dockerfile"
83   extends: .base
84   only:
85     changes:
86       - 'docker/test_manifest/*'
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   only:
97     changes:
98       - 'docker/indent/*'
99
100 fedora amd64 docker:
101   stage: "build docker"
102   variables:
103     ARCH: "amd64"
104     TAG: "fedora"
105     CONTEXT_DIR: "docker/fedora/"
106     DOCKERFILE: "docker/fedora/Dockerfile"
107   extends: .base
108   only:
109     changes:
110       - 'docker/fedora/*'
111
112 # Cross compile image
113 android 28 amd64 docker:
114   stage: "build docker"
115   variables:
116     ARCH: "amd64"
117     TAG: "android_28"
118     CONTEXT_DIR: "docker/android/"
119     DOCKERFILE: "docker/android/Dockerfile"
120   extends: .base
121   only:
122     changes:
123       - 'docker/android/*'
124
125 include: "gitlab/ci_template.yml"
126
127 # Test the build job against the latest build image tag and the local manifest
128 build fedora x86_64 local:
129   extends: '.build'
130   stage: 'build'
131   image: "${CI_REGISTRY_IMAGE}/amd64/fedora:latest"
132
133 build android 28 local:
134   extends: '.build'
135   variables:
136     MESON_ARGS: >
137       -Dbad=enabled
138       -Dbad:androidmedia=enabled
139       --cross-file /android_arm64_28.txt
140   image: "${CI_REGISTRY_IMAGE}/amd64/android_28:latest"