.gitlab-ci.yml 1.85 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

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
10
11
12
before_script:
  - sh version.sh > senpy/VERSION

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

.test: &test_definition
  variables:
20
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
21
22
  cache:
    paths:
23
      - .eggs/
24
25
      - "$CI_PROJECT_DIR/pip-cache"
      - .venv
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
26
    key: "$CI_PROJECT_NAME"
27
  stage: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
28
  script:
29
30
31
32
33
    - 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
34
    - py.test --cov=senpy --cov-report term-missing
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
35
    - python 
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
36
    
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
37
38
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
39
  image: "python:3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
40
41
42

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

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

49

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

image-3.5:
  <<: *image_definition
  variables:
66
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
67
68
69
70

image-2.7:
  <<: *image_definition
  variables:
71
72
73
74
    PYTHON_VERSION: "2.7"

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