-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
192 lines (187 loc) · 5.02 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
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
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-extrenal-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
printf '\n[tool.pyproject-indirect-import-detector]\nexclude_modules = ["tests"]\n' >> pyproject.toml
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
- test:
matrix:
parameters:
python-version: *python-versions
- test-extrenal-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:
- lint
- test:
matrix:
parameters:
python-version: *python-versions
- test-with-up-to-date-dependencies:
matrix:
parameters:
python-version: *python-versions
- build