-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
162 lines (138 loc) · 3.48 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
# Documentation: https://taskfile.dev/
version: "3"
tasks:
# Linting Tasks
lint::black:
desc: "Check code formatting with Black"
cmds:
- poetry run black --check .
lint::isort:
desc: "Check import order with isort"
cmds:
- poetry run isort --check .
lint::ruff:
desc: "Lint code with Ruff"
cmds:
- poetry run ruff check .
lint:
desc: "Run all linting tasks"
deps:
- lint::black
- lint::isort
- lint::ruff
# Formatting Tasks
format::black:
desc: "Format code with Black"
cmds:
- poetry run black .
format::isort:
desc: "Format imports with isort"
cmds:
- poetry run isort .
format::ruff:
desc: "Fix linting issues with Ruff"
cmds:
- poetry run ruff format .
format:
desc: "Run all formatting tasks"
deps:
- task: format::black
- task: format::isort
- task: format::ruff
aliases:
- "fmt"
# Environment Setup
setup::poetry:
desc: "Install dependencies with Poetry"
cmds:
- poetry install
setup::mockoon:
desc: "Start mock API server"
cmds:
- mockoon-cli start --data ./openapi/infrastructure-api.yml
setup:
desc: "Set up development environment"
deps:
- setup::poetry
- setup::mockoon
# Build Tasks
build::image:
desc: "Build Docker image"
cmds:
- docker build -t frobnicate -f containers/Containerfile .
# only run if there are any changes to code, Dockerfile, or poetry.lock
sources:
- frobnicate/**/*.py
- containers/poetry-build.Containerfile
- pyproject.toml
- poetry.lock
build::python:
desc: "Build Python wheels and sdist"
cmds:
- poetry build
sources:
- frobnicate/**/*.py
- pyproject.toml
- poetry.lock
generates:
- dist/frobnicate-*.whl
- dist/frobnicate-*.tar.gz
build::pex:
desc: "Build PEX binary"
sources:
- frobnicate/**/*.py
- pyproject.toml
- poetry.lock
cmds:
- poetry run pex . -m frobnicate.main:app --sh-boot --compile --venv -v -o dist/frobnicate.pex
generates:
- dist/frobnicate.pex
build:
desc: "Run all build tasks"
deps:
- build::image
- build::python
- build::pex
# Run Docker Image
run::image:
desc: "Run Docker image for frobnicate"
cmds:
- docker run -it -v $(pwd)/out:/out --rm frobnicate bash
# Generate Documentation
gen::command-list:
desc: "Generate command list for autosuggest"
cmds:
- poetry run python scripts/gen_command_list.py
gen::manual:
desc: "Generate MANUAL.md"
cmds:
- poetry run typer frobnicate.main utils docs --output docs/MANUAL.md --name frobnicate
gen:
desc: "Run all generation tasks"
deps:
- gen::command-list
- gen::manual
# Testing Tasks
test:
desc: "Run tests with pytest"
cmds:
- poetry run pytest --cov-report term --cov-report xml:coverage.xml --junitxml=report.xml --cov=frobnicate
# Clean Task
clean:
desc: "Clean build artifacts"
cmds:
- poetry run pyclean .
- rm -rf dist/
# Profiling Tasks
profile::run:
desc: "Run profiling in Docker"
deps:
- build::image
cmds:
- docker run -it -v $(pwd)/out:/out --rm frobnicate bash
profile:
desc: "Profile frobnicate with py-spy"
deps:
- build::image
cmds:
- docker run -it -v $(pwd)/out:/out --rm frobnicate sh -c "/opt/poetry/bin/poetry install; frobnicate; /opt/poetry/bin/poetry run py-spy record -r 1000 -f speedscope -o /out/profile.svg -- frobnicate"