gstreamer/.gitlab-ci.yml
Jordan Petridis 72ec8cd33f
docker: Add a unified image for fedora
This is meant to replace both the runtime and build images.
Spliting it in two increasing the maintainance required without
any big benefits.
2018-11-27 14:29:36 +02:00

128 lines
3.4 KiB
YAML

stages:
- "build runtime"
- "build base"
# Eventually will replace both of the above stages
- "build docker"
- "preparation"
# Test just one basic build, if succeds procced to test the rest
- "build"
- "test"
# Run multiple builds and tests, multi-distro, multi-arch
- "full builds"
- "full tests"
test manifest:
variables:
GIT_STRATEGY: fetch
image: "fedora"
stage: "preparation"
before_script:
- dnf install -y python3-pytest python3-pytest-cov python3-requests
script:
- pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
junit:
- "junit.xml"
only:
changes:
- 'gitlab/build_manifest.py'
.base:
image: "docker:stable"
services:
- docker:dind
variables:
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: "overlay2"
GIT_STRATEGY: fetch
script:
- export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
- export REF="${IMAGE}:${CI_COMMIT_SHA}"
- export LATEST="${IMAGE}:latest"
- docker build --pull -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
# If we are in a fork, push the image to the reigstry regardless the branch
- |
if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${LATEST}
fi
# Push the images to the upstream registry
- |
if [ "$CI_COMMIT_REF_NAME" = "master" -a "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
# Tag the image with the git ref
docker image tag ${LATEST} ${REF}
# Push the tags
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${REF}
docker push ${LATEST}
fi
alpine amd64 manifest builder docker:
stage: "build runtime"
variables:
ARCH: "amd64"
TAG: "alpine-manifest-build"
CONTEXT_DIR: "docker/runtime-images/"
DOCKERFILE: "docker/runtime-images/Dockerfile-manifest-builder"
extends: .base
only:
changes:
- 'docker/runtime-images/Dockerfile-manifest-builder'
- 'gitlab/build_manifest.py'
fedora amd64 docker:
stage: "build docker"
variables:
ARCH: "amd64"
TAG: "fedora"
CONTEXT_DIR: "docker/fedora/"
DOCKERFILE: "docker/fedora/Dockerfile"
extends: .base
only:
changes:
- 'docker/fedora/*'
ubuntu amd64 run docker:
stage: "build runtime"
variables:
ARCH: "amd64"
TAG: "ubuntu-runtime"
CONTEXT_DIR: "docker/runtime-images/"
DOCKERFILE: "docker/runtime-images/Dockerfile-ubuntu"
extends: .base
only:
changes:
- 'docker/runtime-images/Dockerfile-ubuntu'
ubuntu amd64 build docker:
stage: "build base"
variables:
ARCH: "amd64"
TAG: "ubuntu-build"
CONTEXT_DIR: "docker/build-base-images/"
DOCKERFILE: "docker/build-base-images/Dockerfile-ubuntu"
extends: .base
only:
changes:
- 'docker/build-base-images/Dockerfile-ubuntu'
include: "gitlab/ci_template.yml"
# Test the build job against the latest build image tag and the local manifest
build fedora x86_64 local:
extends: '.build'
stage: 'build'
image: "${CI_REGISTRY_IMAGE}/amd64/fedora:latest"
build ubuntu x86_64 local:
extends: '.build'
variables:
MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dlibav=disabled"
image: "${CI_REGISTRY_IMAGE}/amd64/ubuntu-build:latest"