.gitlab-ci.yml 1.34 KB
Newer Older
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
1
2
3
4
image: docker:latest


services:
5
  - docker:dind
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  
# 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"
25
  stage: deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
26
27
28
29
30
31
32
33
  script:
    - pip install virtualenv
    - virtualenv -q .venv
    - source .venv/bin/activate
    - python setup.py test
  
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
34
  image: "python:3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
35
36
37

test-3.4:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
38
  image: "python:3.4"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
39
40
41

test-2.7:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
42
  image: "python:2.7"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
43
44
45
46
47
48
49
50
51
52
53

.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
54
55
56
  # only:
  #   - tags
  #   - triggers
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
57

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
58
image-master:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
59
60
61
62
63
64
65
  <<: *image_definition
  only:
    - master

image-3.5:
  <<: *image_definition
  variables:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
66
    IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
67
68
69
70
71
    DOCKERFILE: Dockerfile-3.5

image-2.7:
  <<: *image_definition
  variables:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
72
73
    IMAGE_NAME: "$REGISTRY_IMAGE:$CI_BUILD_TAG-python2.7"
    DOCKERFILE: Dockerfile-2.7