-
Notifications
You must be signed in to change notification settings - Fork 3
/
Taskfile.yaml
122 lines (111 loc) · 2.86 KB
/
Taskfile.yaml
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
version: '3'
run: once
vars:
VERSION:
sh: poetry version --short
PY:
sh: git ls-files "*.py"
YAML:
sh: git ls-files "*.yaml" "*.yml"
MD:
sh: git ls-files "*.md"
SH:
sh: git ls-files "*.sh"
PY_TEST:
sh: git ls-files "tests/*.yaml" "tests/*.yaml"
tasks:
default:
aliases: [all]
deps:
- task: clean
- task: lint
- task: test
uninstall:
desc: Uninstall this library and all of its dependencies.
cmds:
- poetry env remove --all
- pip freeze | grep -v "^-e" | sed "s/@.*//" | xargs pip uninstall -y
install:
desc: Install this library and all of its dependencies.
cmds:
- poetry install --all-extras --sync
build:
desc: Build the library.
deps:
- task: clean
cmds:
- poetry build
clean:
desc: Remove all of the build files.
cmds:
- rm -rf build dist
- find . -name "*.pyc" -exec rm \{\} \;
- find . -type d -name "__pycache__" -exec rm -r {} +
format:
desc: Format the code using different formatters.
vars:
PY:
ref: .PY | splitLines | join " "
YAML:
ref: .YAML | splitLines | join " "
MD:
ref: .MD | splitLines | join " "
SH:
ref: .SH | splitLines | join " "
deps:
- task: clean
cmds:
- poetry run codespell --write-changes {{.PY}} {{.YAML}} {{.MD}} {{.SH}}
- poetry run isort {{.PY}}
- poetry run ruff format {{.PY}}
- poetry run mdformat {{.MD}}
- poetry run shfmt --write --simplify {{.SH}}
- poetry run pyproject-fmt pyproject.toml
lint:
desc: Lint the code using different linters.
vars:
PY:
ref: .PY | splitLines | join " "
YAML:
ref: .YAML | splitLines | join " "
MD:
ref: .MD | splitLines | join " "
SH:
ref: .SH | splitLines | join " "
deps:
- task: clean
cmds:
- poetry run codespell {{.PY}} {{.YAML}} {{.MD}} {{.SH}}
- poetry run isort --check {{.PY}}
- poetry run ruff check {{.PY}}
- poetry run yamllint --strict {{.YAML}}
- poetry run mdformat --check {{.MD}}
- poetry run shellcheck {{.SH}}
test:
desc: Test the library.
deps:
- task: clean
vars:
PY_TEST:
ref: .PY_TEST | splitLines | join " "
cmds:
- |
poetry run openfisca test {{.PY_TEST}} \
--country-package=openfisca_country_template \
--extensions=openfisca_extension_template
test-build:
desc: Check if the build is ok.
deps:
- task: clean
- task: build
cmds:
- poetry run twine check dist/*
- defer: rm -rf build dist
serve:
desc: Serve the Web API.
cmds:
- |
poetry run openfisca serve \
--port 5000 \
--country-package openfisca_country_template \
--extensions openfisca_extension_template