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


# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
  DOCKER_DRIVER: overlay
8
  DOCKERFILE: Dockerfile
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
9
10
11

stages:
  - test
12
  - images
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
13
14
15
16
  - release

.test: &test_definition
  variables:
17
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.eggs"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
18
19
  cache:
    paths:
20
      - .eggs/
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
21
    key: "$CI_PROJECT_NAME"
22
  stage: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
23
24
25
26
27
  script:
    - python setup.py test
  
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
28
  image: "python:3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
29
30
31

test-3.4:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
32
  image: "python:3.4"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
33
34
35

test-2.7:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
36
  image: "python:2.7"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
37

38

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
39
.image: &image_definition
40
41
  variables:
    PYTHON_VERSION: "3.5"
42
43
  before_script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
44
  script:
45
46
    - docker build -f Dockerfile-3.5 . -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG-$PYTHON_VERSION
    - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG-$PYTHON_VERSION
47
  stage: images
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
48
  only:
49
50
    - tags
    - triggers
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
51
52
53
54

image-3.5:
  <<: *image_definition
  variables:
55
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
56
57
58
59

image-2.7:
  <<: *image_definition
  variables:
60
61
62
63
    PYTHON_VERSION: "2.7"

image-latest:
  stage: release
64
65
  before_script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
66
67
68
  script:
    - docker build -f Dockerfile . -t $CI_REGISTRY_IMAGE
    - docker tag $CI_REGISTRY_IMAGE $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
69
70
    - docker push $CI_REGISTRY_IMAGE
    - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
71
72
  only:
    - master
73
    - triggers