CI: Overwrite the build job from the template
[platform/upstream/gstreamer.git] / .gitlab-ci.yml
1 stages:
2   - "test"
3   - "build runtime"
4   - "build base"
5   - "manifest"
6   - "build"
7
8 test manifest:
9   variables:
10     GIT_STRATEGY: fetch
11   image: "fedora"
12   stage: "test"
13   before_script:
14     - dnf install -y python3-pytest python3-pytest-cov python3-requests
15   script:
16     - pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
17   only:
18     changes:
19       - "gitlab/build_manifest.py"
20   coverage: '/TOTAL.*\s+(\d+%)$/'
21   artifacts:
22     reports:
23       junit:
24         - "junit.xml"
25
26 .base:
27   image: "docker:stable"
28   services:
29     - docker:dind
30   variables:
31     # When using dind, it's wise to use the overlayfs driver for
32     # improved performance.
33     DOCKER_DRIVER: "overlay2"
34     GIT_STRATEGY: fetch
35   script:
36     - export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
37     - export REF="${IMAGE}:${CI_COMMIT_SHA}"
38     - export LATEST="${IMAGE}:latest"
39
40     - docker build --pull -f ${DOCKERFILE} -t ${REF} ${CONTEXT_DIR}
41     - docker image tag ${REF} ${LATEST}
42
43     # Push the images
44     - |
45       if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
46         docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
47         docker push ${REF}
48         docker push ${LATEST}
49       fi
50   only:
51     changes:
52       - ".gitlab-ci.yml"
53       - "docker/**"
54       - "docker/*/**"
55
56
57 fedora amd64 run docker:
58   stage: "build runtime"
59   variables:
60     ARCH: "amd64"
61     TAG: "fedora-runtime"
62     CONTEXT_DIR: "docker/runtime-images/"
63     DOCKERFILE: "docker/runtime-images/Dockerfile-fedora"
64   extends: .base
65
66 fedora amd64 build docker:
67   stage: "build base"
68   variables:
69     ARCH: "amd64"
70     TAG: "fedora-build"
71     CONTEXT_DIR: "docker/build-base-images/"
72     DOCKERFILE: "docker/build-base-images/Dockerfile-fedora"
73   extends: .base
74
75 include: "gitlab/ci_template.yml"
76
77 # Overwrite the job with the same name that comes from the include template,
78 # in order to use the `:latest` tag of the image built
79 build fedora x86_64:
80   # This comes from the `include:` above
81   extends: .build
82   image: "${CI_REGISTRY_IMAGE}/amd64/fedora-build:latest"