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