-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
90 lines (80 loc) · 1.54 KB
/
.gitlab-ci.yml
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
# Run by default on lowest supported Python version
image: python:3.8
include:
- template: Jobs/SAST.gitlab-ci.yml
before_script:
- pip install tox
stages:
- style
- build
- test
- coverage
- examples
- deploy
# style
style:
stage: style
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
paths:
- ${PRE_COMMIT_HOME}
before_script:
- apt update && apt install -y --no-install-recommends git
- pip install pre-commit
script:
- pre-commit run --all-files --show-diff-on-failure
# build
build:
stage: build
script:
- python setup.py sdist bdist_wheel
artifacts:
paths:
- dist/
expire_in: 1 week
.python_tox_matrix:
image: python:${VERSION}
script:
- tox -vv
parallel:
matrix:
- VERSION: ["3.8", "3.9", "3.10", "3.11"]
# test
test:linux:
stage: test
extends: .python_tox_matrix
variables:
TOXENV: py
# run examples (only for tags)
examples:linux:
stage: examples
extends: .python_tox_matrix
variables:
TOXENV: examples
only:
- tags
# coverage
coverage:
stage: coverage
script:
- tox -vv
- pip install codecov
- codecov --token=$CODECOV_TOKEN
variables:
TOXENV: coverage
# deploy
deploy:
stage: deploy
dependencies:
- build
script:
- pip install twine
- twine upload -u $PYPI_USER -p $PYPI_PASSWORD dist/*
only:
# Only deploy refs that start with "2."
- /^2\..*$/
except:
# If a branch happens to start with "2.", skip it as we only want to
# deploy tags.
- branches