.gitlab-ci.yml 1.12 KB
Newer Older
Tjerk Vreeken's avatar
Tjerk Vreeken committed
1 2 3 4
image: python:3.6

before_script:
  - pip install tox
5 6

stages:
Tjerk Vreeken's avatar
Tjerk Vreeken committed
7
  - style
8 9
  - build
  - test
10
  - coverage
11 12
  - deploy

Tjerk Vreeken's avatar
Tjerk Vreeken committed
13 14 15 16 17 18 19 20
# style
flake8:
  stage: style
  image: python:3.6
  script:
    - tox -vv
  variables:
    TOXENV: flake8
21 22
  tags:
    - docker
Tjerk Vreeken's avatar
Tjerk Vreeken committed
23

Tjerk Vreeken's avatar
Tjerk Vreeken committed
24
# build
25
build:
26 27
  stage: build
  script:
28
    - python setup.py sdist bdist_wheel
29 30
  artifacts:
    paths:
31
      - dist/
32 33
    expire_in: 1 week
  tags:
34
    - docker
35

Tjerk Vreeken's avatar
Tjerk Vreeken committed
36 37
# test
.job_template: &unittests
38
  stage: test
Tjerk Vreeken's avatar
Tjerk Vreeken committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  script:
    - tox -vv

py35:linux:
  <<: *unittests
  image: python:3.5-jessie
  variables:
    TOXENV: py35
  tags:
    - docker

py36:linux:
  <<: *unittests
  image: python:3.6-jessie
  variables:
    TOXENV: py36
  tags:
    - docker

58 59 60 61 62 63 64 65 66 67 68 69
# coverage
coverage:
  stage: coverage
  script:
    - tox -vv
    - pip install codecov
    - codecov --token=$CODECOV_TOKEN
  variables:
    TOXENV: coverage
  tags:
    - docker

Tjerk Vreeken's avatar
Tjerk Vreeken committed
70 71 72
# deploy
deploy:
  stage: deploy
Tjerk Vreeken's avatar
Tjerk Vreeken committed
73
  dependencies:
74
    - build
Tjerk Vreeken's avatar
Tjerk Vreeken committed
75
  script:
Tjerk Vreeken's avatar
Tjerk Vreeken committed
76 77 78 79 80 81 82
    - pip install twine
    - twine upload -u $PYPI_USER -p $PYPI_PASSWORD dist/*
  only:
    - tags
  except:
    # Do not deploy tags that do not start with 2.
    - /^(?!2\.).*$
83
  tags:
84
    - docker