summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: c50f2aa5532c3a7941ccbb37ab64b33e0e7dbd08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
image: python:3.7

stages:
  - lint
  - build-test-image
  - test
  - deploy

commitlint:
  image: node:12
  stage: lint
  before_script:
    - npm install -g @commitlint/cli @commitlint/config-conventional
    - 'echo "module.exports = {extends: [\"@commitlint/config-conventional\"]}" > commitlint.config.js'
  script:
    - npx commitlint --from=origin/master
  except:
    - master

black_lint:
  stage: lint
  before_script:
    - pip3 install black
  script:
    - black --check .
  except:
    - master

#build_test_image:  # Currently hangs forever, because of GitLab Runner infrastructure issues
#  stage: build-test-image
#  image:
#    name: gcr.io/kaniko-project/executor:debug
#    entrypoint: [""]
#  script:
#    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
#    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/tools/Dockerfile-test --destination $CI_REGISTRY_IMAGE:test
#  only:
#    refs:
#      - master
#    changes:
#      - tools/

.tox_includes: &tox_includes
  stage: test
  before_script:
    - pip install tox
  script:
    - tox -e $TOX_ENV

test_2.7:
  <<: *tox_includes
  image: python:2.7
  variables:
    TOX_ENV: py27

test_3.4:
  <<: *tox_includes
  image: python:3.4
  variables:
    TOX_ENV: py34
    
test_3.5:
  <<: *tox_includes
  image: python:3.5
  variables:
    TOX_ENV: py35
    
test_3.6:
  <<: *tox_includes
  image: python:3.6
  variables:
    TOX_ENV: py36
    
test_3.7:
  <<: *tox_includes
  image: python:3.7
  variables:
    TOX_ENV: py37

test_3.8:
  <<: *tox_includes
  image: python:3.8-rc-alpine
  variables:
    TOX_ENV: py38
  allow_failure: true

test_docs:
  <<: *tox_includes
  variables:
    TOX_ENV: docs

deploy:
  stage: deploy
  script:
    - pip install -U setuptools wheel twine
    - python setup.py sdist bdist_wheel
    # test package
    - python3 -m venv test
    - . test/bin/activate
    - pip install -U dist/python-gitlab*.whl
    - gitlab -h
    - deactivate
    - twine upload --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*
  only:
    - tags