-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
162 lines (137 loc) · 3.46 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
default:
image: python:3.12-slim
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- .venv
before_script:
- pip install virtualenv
- virtualenv .venv
- source .venv/bin/activate
- pip install -e .
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == 'main'
stages:
- Install
- Static Analysis
- Test
- Ship
- Documentation
# ------------------------------- Install -------------------------------------
pip_install:
stage: Install
before_script:
- python --version ; pip --version
script:
- pip install .
- pip list -v
# ------------------------------ Static analysis ------------------------------
.static_analysis_base:
stage: Static Analysis
allow_failure: true
flake8:
needs:
- pip_install
extends: .static_analysis_base
script:
- pip install flake8
- flake8 --ignore E501 ./dinamis_sdk
pylint:
needs:
- pip_install
extends: .static_analysis_base
script:
- pip install pylint
- pylint ./dinamis_sdk
codespell:
needs:
- pip_install
extends: .static_analysis_base
script:
- pip install codespell
- codespell ./dinamis_sdk docs README.md
pydocstyle:
needs:
- pip_install
extends: .static_analysis_base
script:
- pip install pydocstyle
- pydocstyle ./dinamis_sdk
mypy:
needs:
- pip_install
extends: .static_analysis_base
script:
- pip install mypy
- pip list -v
- mypy --install-types --non-interactive .
# --------------------------------- Doc ---------------------------------------
.doc_base:
stage: Documentation
before_script:
- pip install -r doc/doc_requirements.txt
artifacts:
paths:
- public
- public_test
test:
extends: .doc_base
except:
- main
script:
- mkdocs build --site-dir public_test
pages:
extends: .doc_base
only:
- main
script:
- mkdocs build --site-dir public
# --------------------------------- Test --------------------------------------
.tests_base:
needs:
- pip_install
stage: Test
except:
- main
Misc Tests:
extends: .tests_base
script:
- python tests/test_misc.py
OAuth2 Tests:
extends: .tests_base
script:
- python tests/test_spot-6-7-drs.py
- python tests/test_super-s2.py
- python tests/test_push.py
API key Tests:
extends: .tests_base
script:
- dinamis_cli register
- mv /root/.config/dinamis_sdk_auth/.token /root/.config/dinamis_sdk_auth/.token_
- python tests/test_spot-6-7-drs.py
- python tests/test_super-s2.py
- python tests/test_push.py
- mv /root/.config/dinamis_sdk_auth/.token_ /root/.config/dinamis_sdk_auth/.token
- dinamis_cli delete
- toto=$(dinamis_cli create 2>&1)
- mv /root/.config/dinamis_sdk_auth/.token /root/.config/dinamis_sdk_auth/.token_
- export DINAMIS_SDK_ACCESS_KEY=$(echo $toto | cut -d"'" -f4)
- export DINAMIS_SDK_SECRET_KEY=$(echo $toto | cut -d"'" -f8)
- python tests/test_spot-6-7-drs.py
- mv /root/.config/dinamis_sdk_auth/.token_ /root/.config/dinamis_sdk_auth/.token
- dinamis_cli revoke $DINAMIS_SDK_ACCESS_KEY
# --------------------------------- Ship --------------------------------------
pypi:
stage: Ship
only:
- main
before_script:
- python3 -m pip install --upgrade build twine
script:
- python3 -m build
after_script:
- python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p $pypi_token dist/*