-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
143 lines (118 loc) · 3.59 KB
/
Copy pathTaskfile.yml
File metadata and controls
143 lines (118 loc) · 3.59 KB
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
---
# https://taskfile.dev
#
# Python tools live in the Poetry env. Always invoke them via `poetry run`
# so `task …` works without activating .venv (and without relying on Task
# PATH templating, which varies by Task version).
version: '3'
vars:
# Prefix for project Python tooling (black, pytest, …)
PY: poetry run
includes:
docs:
taskfile: ./docs/Taskfile.yml
dir: ./docs
vars:
PY: '{{.PY}}'
tasks:
list:
desc: "Show available commands"
aliases:
- default
silent: true
cmds:
- task --list-all
clean:
desc: Remove local venvs, caches, and build artifacts (fresh-clone-like workspace)
cmds:
- bash ./scripts/clean_workspace.sh
# Publish and release
# =============
publish_pypi_test:
desc: Publish package on test.pypi.org
cmds:
- poetry config repositories.testpypi https://test.pypi.org/legacy/
- poetry build
- poetry publish -r testpypi
publish_pypi:
desc: Publish package on pypi.org
cmds:
- poetry build
- poetry publish
# Fix
# =============
fix_lint:
desc: fix all what can be fixed
cmds:
- "{{.PY}} isort --profile black --overwrite-in-place $(git ls-files | grep '\\.py$')"
- "{{.PY}} black $(git ls-files | grep '\\.py$')"
- "{{.PY}} pymarkdownlnt fix $( git ls-files | grep '\\.md$' | grep -v 'docs/' )"
test_lint:
desc: show what can be improved
cmds:
- "{{.PY}} isort --profile black $(git ls-files | grep '\\.py$')"
- "{{.PY}} black --check $(git ls-files | grep '\\.py$')"
- "{{.PY}} pylint $(git ls-files | grep '\\.py$' | grep clak/)"
test_lint_full:
desc: run all linting tests
cmds:
- task: test_lint
- "{{.PY}} yamllint $( git ls-files | grep '\\.yml$' )"
- "{{.PY}} pymarkdownlnt scan $( git ls-files | grep '\\.md$' | grep -v 'docs/' )"
- shellcheck $( git ls-files | grep '\.sh$' )
- task: docs:test
# Tests
# =============
test:
desc: Test everything
once: true
cmds:
- task: test_pytest
- task: test_regressions
- task: test_report
# - task: test_lab
# - task: test_examples
- task: test_lint_full
# test_lab:
# dest: Test lab
# cmds:
# - bash ./scripts/run_python_scripts.sh lab 'test[0-9]*'
# test_examples:
# dest: Test examples
# cmds:
# - bash ./scripts/run_python_scripts.sh examples 'example[0-9]*'
fix_regressions:
desc: Fix regressions
cmds:
- "{{.PY}} pytest tests/ --force-regen"
test_pytest:
desc: Test with pytest
once: true
cmds:
- "{{.PY}} pytest tests/ -vv --tags unit-tests examples-unit examples-regressions"
test_regressions:
desc: Test for regressions (slow)
once: true
env:
# Note: we need to disable colors in regression tests to prevent
# colorama to patch python stdout/err and break the tests.
CLAK_COLORS: false
cmds:
- "{{.PY}} pytest tests/ --tags examples-regressions"
- "{{.PY}} pytest tests/ --tags examples-regressions-cli"
test_report:
desc: Report tests
once: true
cmds:
# - pytest tests --tb no -vv -q
- "{{.PY}} pytest tests/ --tb no -q --cov=clak --cov-report term-missing --tags examples-unit unit-tests"
test_matrix:
desc: Run pytest matrix (3.10–3.14) via mise + isolated .venvs
cmds:
- bash ./scripts/run_python_matrix.sh
test_matrix_one:
desc: "Run pytest for one Python version (PYTHON_VERSION=3.11)"
requires:
vars: [PYTHON_VERSION]
cmds:
- PYTHON_VERSION={{.PYTHON_VERSION}} bash ./scripts/run_python_matrix.sh