2017-02-13 11:04:29 +00:00
|
|
|
image: docker:latest
|
|
|
|
|
|
|
|
|
|
|
|
services:
|
2017-02-13 16:16:38 +00:00
|
|
|
- docker:dind
|
2017-02-13 11:04:29 +00:00
|
|
|
|
|
|
|
# When using dind, it's wise to use the overlayfs driver for
|
|
|
|
# improved performance.
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- release
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
.test: &test_definition
|
|
|
|
variables:
|
|
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .venv/
|
|
|
|
- pip-cache/
|
|
|
|
key: "$CI_PROJECT_NAME"
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- pip install virtualenv
|
|
|
|
- virtualenv -q .venv
|
|
|
|
- source .venv/bin/activate
|
|
|
|
- python setup.py test
|
|
|
|
|
|
|
|
test-3.5:
|
|
|
|
<<: *test_definition
|
2017-02-13 11:30:44 +00:00
|
|
|
image: "python:3.5"
|
2017-02-13 11:04:29 +00:00
|
|
|
|
|
|
|
test-3.4:
|
|
|
|
<<: *test_definition
|
2017-02-13 11:30:44 +00:00
|
|
|
image: "python:3.4"
|
2017-02-13 11:04:29 +00:00
|
|
|
|
|
|
|
test-2.7:
|
|
|
|
<<: *test_definition
|
2017-02-13 11:30:44 +00:00
|
|
|
image: "python:2.7"
|
2017-02-13 11:04:29 +00:00
|
|
|
|
|
|
|
.image: &image_definition
|
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
IMAGE_NAME: $REGISTRY_IMAGE:$CI_BUILD_TAG
|
|
|
|
DOCKERFILE: Dockerfile
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
|
|
|
|
script:
|
|
|
|
- docker build -f $DOCKERFILE . -t $IMAGE_NAME
|
|
|
|
- docker push $IMAGE_NAME
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
- triggers
|
|
|
|
|
2017-02-13 11:30:44 +00:00
|
|
|
image-master:
|
2017-02-13 11:04:29 +00:00
|
|
|
<<: *image_definition
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
|
|
|
|
image-3.5:
|
|
|
|
<<: *image_definition
|
|
|
|
variables:
|
2017-02-13 11:30:44 +00:00
|
|
|
IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python3.5"
|
2017-02-13 11:04:29 +00:00
|
|
|
DOCKERFILE: Dockerfile-3.5
|
|
|
|
|
|
|
|
image-2.7:
|
|
|
|
<<: *image_definition
|
|
|
|
variables:
|
2017-02-13 11:30:44 +00:00
|
|
|
IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python2.7"
|
|
|
|
DOCKERFILE: Dockerfile-2.7
|