-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
100 lines (86 loc) · 1.76 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
91
92
93
94
95
96
97
98
99
100
image: python:3.8
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
workflow:
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED
cache:
paths:
- .cache/pip
- venv/
before_script:
- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="/root/.local/bin:$PATH"
# make dependencies cachable
- poetry config virtualenvs.in-project true
- poetry install --with dev
stages:
- test
- build
- upload
test:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- poetry run python -m unittest
pylint:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- poetry run pylint ha_mqtt
mypy-typing:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- poetry run mypy ha_mqtt
check_device_class:
stage: test
when: manual
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- poetry run python util/parse_device_classes.py
build:
stage: build
script:
- poetry build
artifacts:
paths:
- dist
docs:
stage: build
script:
- poetry run sphinx-apidoc ha_mqtt -f -o docs/source/
- poetry run sphinx-build -b html -W --keep-going docs/source/ docs/build/html
artifacts:
paths:
- docs/build
when: always
upload:
stage: upload
dependencies:
- build
script:
- poetry publish -n -u __token__ -p "$CI_PYPI_TOKEN"
only:
- /^release_.+/
pages:
stage: upload
dependencies:
- docs
script:
- mkdir public
- cp -R docs/build/html public/
artifacts:
paths:
- public
- docs/build
only:
- /^release_.+/