-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
247 lines (240 loc) · 6.7 KB
/
config.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
version: 2.1
references:
python-versions: &python-versions ["3.9"]
commands:
setup-python-environment:
steps:
- run:
command: |
apt-get update -y
apt-get install -y --no-install-recommends libcairo2-dev libgirepository1.0-dev
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo 'export PATH=$HOME/.poetry/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
poetry-install:
steps:
- restore_cache:
key: &cache-key-poetry cache-poetry-{{ .Environment.CIRCLECI_CACHE_VERSION }}-{{ checksum "poetry.lock" }}
- run:
name: "`poetry install`"
command: |
poetry config virtualenvs.in-project true
poetry install
- save_cache:
key: *cache-key-poetry
paths:
- ".venv"
poetry-install-without-cache:
steps:
- run:
name: "`poetry install`"
command: |
poetry config virtualenvs.in-project true
poetry install
jobs:
lint:
docker:
- image: python:3-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run:
name: Lint
command: |
poetry run pysen run lint
# Self check.
check-indirect-import:
docker:
- image: python:3-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run:
name: Check indirect import
command: |
poetry run pyproject-indirect-import-detector -v
test:
parameters:
python-version:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run:
name: Test
command: |
poetry run pytest -v
test-with-up-to-date-dependencies:
parameters:
python-version:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
steps:
- checkout
- setup-python-environment
- run: |
rm poetry.lock
- poetry-install-without-cache
- run:
name: Test
command: |
poetry run pytest -v
test-external-project-isort:
parameters:
python-version:
type: string
branch:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
steps:
- checkout
- setup-python-environment
- run:
name: Prepare
command: |
git clone https://github.com/PyCQA/isort work/PyCQA/isort
cd work/PyCQA/isort
git checkout <<parameters.branch>>
poetry add --dev ../../..
- run:
name: Test
command: |
cd work/PyCQA/isort
cat \<< EOS >> pyproject.toml
[tool.pyproject-indirect-import-detector]
exclude_modules = [
"dataclasses", # Compatibility.
"pylama", # `isort` provides a plugin of pylama, but does not depend on it.
"mypy_extensions", # `if TYPE_CHECKING`
"numpy", # Vendered `toml` imports `numpy`. Not a good code.
"a", # Dummy in tests.
"b", # Dummy in tests.
]
EOS
poetry run pyproject-indirect-import-detector
test-external-project-nitpick:
parameters:
python-version:
type: string
branch:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
steps:
- checkout
- setup-python-environment
- run:
name: Prepare
command: |
git clone https://github.com/andreoliwa/nitpick work/andreoliwa/nitpick
cd work/andreoliwa/nitpick
git checkout <<parameters.branch>>
poetry add --dev ../../..
poetry install --extras lint --extras test --extras doc
- run:
name: Test
command: |
cd work/andreoliwa/nitpick
cat \<< EOS >> pyproject.toml
[tool.pyproject-indirect-import-detector]
exclude_modules = ["tests"]
EOS
poetry run pyproject-indirect-import-detector
build:
docker:
- image: python:3-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run: |
poetry build
- store_artifacts:
path: dist
destination: dist
validate-tag-with-version:
docker:
- image: python:3-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run:
name: Check if git tag name is appropriate for package version
command: |
tag=$CIRCLE_TAG
version=$(poetry run python -c 'import toml; print(toml.load("pyproject.toml")["tool"]["poetry"]["version"])')
test "$tag" = "$version"
deploy:
docker:
- image: python:3-buster
steps:
- checkout
- setup-python-environment
- poetry-install
- run:
name: Publish wheel & sdist to PyPI
command: |
poetry build
poetry publish --username "__token__" --password "$PYPI_API_TOKEN" --no-interaction
workflows:
version: 2
commit:
jobs:
- lint
- check-indirect-import
- test:
matrix:
parameters:
python-version: *python-versions
- test-external-project-isort:
matrix:
parameters:
python-version: *python-versions
branch: ["7e43b80"]
- test-external-project-nitpick:
matrix:
parameters:
python-version: *python-versions
branch: ["v0.26.0"]
- build
release:
jobs:
- validate-tag-with-version:
filters: &release-filter
branches:
ignore: /.*/
tags:
only: /^[0-9]+(\.[0-9]+){2}((a|b|rc)[0-9]+)?(.post[0-9])?(.dev[0-9])?$/
- build:
filters: *release-filter
requires:
- validate-tag-with-version
- deploy:
filters: *release-filter
requires:
- build
nightly:
triggers:
- schedule:
cron: "31 23 * * *" # in UTC
filters:
branches:
only:
- master
jobs:
- test:
matrix:
parameters:
python-version: *python-versions
- test-with-up-to-date-dependencies:
matrix:
parameters:
python-version: *python-versions