forked from life4/deal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
218 lines (211 loc) · 4.72 KB
/
Taskfile.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
# https://taskfile.dev/
version: "3"
vars:
PYTHON: python3
TEST_ENV: .venvs/test
LINT_ENV: .venvs/lint
DOCS_ENV: .venvs/docs
MAIN_ENV: .venvs/main
TEST_NODEPS_ENV: .venvs/test-nodeps
TEST_PYTHON: "{{.TEST_ENV}}/bin/python3"
LINT_PYTHON: "{{.LINT_ENV}}/bin/python3"
DOCS_PYTHON: "{{.DOCS_ENV}}/bin/python3"
MAIN_PYTHON: "{{.MAIN_ENV}}/bin/python3"
TEST_NODEPS_PYTHON: "{{.TEST_NODEPS_ENV}}/bin/python3"
env:
FLIT_ROOT_INSTALL: "1"
tasks:
install-flit:
status:
- which flit
cmds:
- python3 -m pip install flit
venv-test:
status:
- test -d {{.TEST_ENV}}
cmds:
- "{{.PYTHON}} -m venv {{.TEST_ENV}}"
venv-test-nodeps:
status:
- test -d {{.TEST_NODEPS_ENV}}
cmds:
- "{{.PYTHON}} -m venv {{.TEST_NODEPS_ENV}}"
venv-lint:
status:
- test -d {{.LINT_ENV}}
cmds:
- "{{.PYTHON}} -m venv {{.LINT_ENV}}"
venv-docs:
status:
- test -d {{.DOCS_ENV}}
cmds:
- "{{.PYTHON}} -m venv {{.DOCS_ENV}}"
venv-main:
status:
- test -d {{.MAIN_ENV}}
cmds:
- "{{.PYTHON}} -m venv {{.MAIN_ENV}}"
install-test:
sources:
- pyproject.toml
deps:
- install-flit
- venv-test
cmds:
- >
flit install
--python {{.TEST_PYTHON}}
--extras=test,integration
--deps=production
--symlink
install-test-nodeps:
sources:
- pyproject.toml
deps:
- install-flit
- venv-test-nodeps
cmds:
- >
flit install
--python {{.TEST_NODEPS_PYTHON}}
--extras=test
--deps=production
--symlink
install-lint:
sources:
- pyproject.toml
deps:
- install-flit
- venv-lint
cmds:
- >
flit install
--python {{.LINT_PYTHON}}
--extras=lint,integrations
--deps=production
--symlink
install-docs:
sources:
- pyproject.toml
deps:
- install-flit
- venv-docs
cmds:
- >
flit install
--python {{.DOCS_PYTHON}}
--extras=docs
--deps=production
--symlink
install-main:
sources:
- pyproject.toml
deps:
- install-flit
- venv-main
cmds:
- >
flit install
--python {{.MAIN_PYTHON}}
--deps=production
--symlink
release:
cmds:
- which gh
- grep -F {{.CLI_ARGS}} deal/__init__.py
- git add deal/__init__.py
- git commit -m "bump version"
- git tag {{.CLI_ARGS}}
- flit publish
- git push
- git push --tags
- gh release create --generate-notes {{.CLI_ARGS}}
- gh release upload {{.CLI_ARGS}} ./dist/*
test-import:
desc: "test that deal doesn't have deps at import time"
deps:
- install-main
cmds:
- "{{.MAIN_PYTHON}} -c 'import deal'"
- "{{.MAIN_PYTHON}} -c 'import deal._cli'"
- "{{.MAIN_PYTHON}} -c 'import deal.linter'"
pytest:
desc: "run Python tests"
deps:
- install-test
cmds:
- "{{.TEST_PYTHON}} -m pytest {{.CLI_ARGS}}"
pytest-nodeps:
desc: "run Python tests"
deps:
- install-test-nodeps
cmds:
- "{{.TEST_NODEPS_PYTHON}} -m pytest --cov-fail-under=68 {{.CLI_ARGS}}"
flake8:
desc: "lint Python code"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m flake8 --ignore=DEL {{.CLI_ARGS}} ."
mypy:
desc: "check type annotations"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m mypy {{.CLI_ARGS}}"
unify:
desc: "convert double quotes to single ones"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m unify -r -i --quote=\\' {{.CLI_ARGS}} deal tests"
isort:
desc: "sort imports"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m isort {{.CLI_ARGS}} ."
isort:check:
desc: "sort imports"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m isort --check {{.CLI_ARGS}} ."
mypy-test:
desc: "validate type annotations"
deps:
- install-lint
cmds:
- "{{.LINT_PYTHON}} -m mypy_test {{.CLI_ARGS}} ./types/"
sphinx:
desc: "generate documentation"
deps:
- install-docs
cmds:
- rm -rf docs/build
- "{{.DOCS_ENV}}/bin/sphinx-build -W docs docs/build {{.CLI_ARGS}}"
# groups
format:
desc: "run all code formatters"
cmds:
- task: isort
- task: unify
lint:
desc: "run all linters"
cmds:
- task: flake8
- task: mypy
- task: isort:check
test:
desc: "run all tests"
cmds:
- task: test-import
- task: pytest
- task: pytest-nodeps
- task: mypy-test
all:
desc: "run all code formatters, linters, and tests"
cmds:
- task: format
- task: lint
- task: test