.gitlab-ci.yml 3.38 KB
Newer Older
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
1
# Setup variables and caches ---------------------------------------------------
2 3 4 5 6 7 8 9
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"

cache:
  paths:
    - "$CI_PROJECT_DIR/pip-cache"
  key: "$CI_PROJECT_ID"

Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
10
# Declare the stages -----------------------------------------------------------
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
11 12 13 14 15 16
stages:
  - lint
  - test
  - build
  - deploy

Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
17
# LINT stage -------------------------------------------------------------------
18 19 20
setup:
  image: python:3.5
  stage: lint
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
21 22
  before_script:
    - pip install tox
23 24 25 26 27
  script: tox -e setup

safety:
  image: python:3.5
  stage: lint
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
28 29
  before_script:
    - pip install tox
30 31 32 33 34
  script: tox -e safety

style:
  image: python:3.5
  stage: lint
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
35 36
  before_script:
    - pip install tox
37 38 39 40 41 42 43 44
  script: tox -e style
  allow_failure: true

docs:
  image: python:3.5
  stage: lint
  before_script:
    - apt-get update && apt-get install -y python-enchant
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
45
    - pip install tox
46 47
  script: tox -e docs
  allow_failure: true
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
48 49 50
  artifacts:
    paths:
      - dist/docs/
51

Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
52
# TEST stage -------------------------------------------------------------------
53
py34-django111:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
54 55
  image: python:3.4
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
56 57
  before_script:
    - pip install tox
58
  script: tox -e py34-django111
59 60 61
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
62

63
py35-django111:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
64 65
  image: python:3.5
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
66 67
  before_script:
    - pip install tox
68
  script: tox -e py35-django111
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
69 70 71
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
72

73
py36-django111:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
74 75
  image: python:3.6
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
76 77
  before_script:
    - pip install tox
78
  script: tox -e py36-django111
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
79 80 81
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
82

83
py37-django111:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
84 85
  image: python:3.7-rc-stretch
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
86 87
  before_script:
    - pip install tox
88
  script: tox -e py37-dev-django111
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
89 90 91
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
92

93
py34-django20:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
94 95
  image: python:3.4
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
96 97
  before_script:
    - pip install tox
98
  script: tox -e py34-django20
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
99 100 101
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
102

103
py35-django20:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
104 105
  image: python:3.5
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
106 107
  before_script:
    - pip install tox
108
  script: tox -e py35-django20
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
109 110 111
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
112

113
py36-django20:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
114 115
  image: python:3.6
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
116 117
  before_script:
    - pip install tox
118
  script: tox -e py36-django20
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
119 120 121
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
122

123
py37-django20:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
124 125
  image: python:3.7-rc-stretch
  stage: test
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
126 127
  before_script:
    - pip install tox
128
  script: tox -e py37-dev-django20
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
129 130 131
  artifacts:
    paths:
      - .coverage.*
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
132

Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
133
# BUILD stage ------------------------------------------------------------------
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
134 135 136 137 138 139 140
build:
  image: docker:latest
  services:
    - docker:dind
  stage: build
  script: echo "Build Docker images"

Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
141
# DEPLOY stage -----------------------------------------------------------------
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
deploy_staging:
  stage: deploy
  script:
    - echo "Deploy to staging server"
  environment:
    name: staging
    url: https://staging.example.com
  only:
    - master

deploy_prod:
  stage: deploy
  script:
    - echo "Deploy to production server"
  environment:
    name: production
    url: https://example.com
  when: manual
  only:
    - master
162 163 164

pages:
  stage: deploy
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
165
  image: python:3.5
166
  dependencies:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
167
    - docs
168 169 170 171 172 173 174 175 176
    - py34-django111
    - py35-django111
    - py36-django111
    - py37-django111
    - py34-django20
    - py35-django20
    - py36-django20
    - py37-django20
  before_script:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
177
    - pip install tox
178
  script:
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
179
    - tox -e report
Timothée Mazzucotelli's avatar
Timothée Mazzucotelli committed
180 181
    - mv htmlcov/ dist/docs/
    - mv dist/docs/ public/
182 183 184 185
  artifacts:
    paths:
      - public
    expire_in: 30 days