-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
81 lines (72 loc) · 1.74 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
stages:
- test
- static
- build
- release
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .cache/pip
- venv/
.python-base:
image: python:3.11.7
before_script:
- python -V # Print out python version for debugging
- pip install --progress-bar off poetry==1.4.2 # Install Poetry
- poetry -vvv install --no-root
mypy:
stage: static
extends: .python-base
allow_failure: true
script:
- pip install mypy
- python -m mypy */*.py
when: manual
flake8:
stage: static
extends: .python-base
allow_failure: true
script:
- pip install flake8
- flake8 --max-line=120 */*.py
when: manual
pylint:
stage: static
extends: .python-base
allow_failure: true
script:
- pip install pylint
- mkdir ./pylint
- pylint --output-format=text */*.py | tee ./pylint/pylint.log || pylint-exit $?
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
- anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
- echo "Pylint score is $PYLINT_SCORE"
when: manual
artifacts:
paths:
- ./pylint/
test:
stage: test
extends: .python-base
script:
- poetry run python -m unittest
build-package:
stage: build
extends: .python-base
script:
- poetry run python setup.py sdist bdist_wheel
artifacts:
paths:
- dist/*.whl
- dist/*.tar.gz
release-package:
stage: release
extends: .python-base
only:
- tags
script:
- pip install twine
- python setup.py sdist bdist_wheel
- TWINE_PASSWORD=${PYPI_PASSWORD} TWINE_USERNAME=${PYPI_USERNAME} python -m twine upload --repository pypi dist/* --verbose