.gitlab-ci.yml 1.8 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/pip-cache"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
18
19
  cache:
    paths:
20
      - .eggs/
21
22
      - "$CI_PROJECT_DIR/pip-cache"
      - .venv
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
23
    key: "$CI_PROJECT_NAME"
24
  stage: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
25
  script:
26
27
28
29
30
    - pip install --use-wheel -U pip setuptools virtualenv
    - virtualenv .venv/$PYTHON_VERSION
    - source .venv/$PYTHON_VERSION/bin/activate
    - pip install --use-wheel -r requirements.txt
    - pip install --use-wheel -r test-requirements.txt
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
31
    - py.test --cov=senpy --cov-report term-missing
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
32
    - python 
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
33
    
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
34
35
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
36
  image: "python:3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
37
38
39

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

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

46

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
47
.image: &image_definition
48
49
  variables:
    PYTHON_VERSION: "3.5"
50
51
  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
52
  script:
53
54
    - 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
55
  stage: images
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
56
  only:
57
58
    - tags
    - triggers
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
59
60
61
62

image-3.5:
  <<: *image_definition
  variables:
63
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
64
65
66
67

image-2.7:
  <<: *image_definition
  variables:
68
69
70
71
    PYTHON_VERSION: "2.7"

image-latest:
  stage: release
72
73
  before_script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
74
75
76
  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
77
78
    - docker push $CI_REGISTRY_IMAGE
    - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
79
80
  only:
    - master
81
    - triggers