-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
187 lines (156 loc) · 4.15 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
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
version: '3'
vars:
PACKAGE_MANAGER: '{{.PACKAGE_MANAGER | default "poetry"}}'
RUN_PREFIX: "{{.PACKAGE_MANAGER}} run"
RUN_PYTHON: "{{.RUN_PREFIX}} python"
# Deduce language from package manager: if go, go, else python
LANGUAGE: "{{if eq .PACKAGE_MANAGER \"go\"}}go{{else}}py{{end}}"
tasks:
# General
install:
desc: Install dependencies
cmds:
- task: "{{.PACKAGE_MANAGER}}:install"
update:
desc: Update dependencies
cmds:
- task: "{{.PACKAGE_MANAGER}}:update"
test:
desc: Run all tests
cmds:
- task: "{{.LANGUAGE}}:test"
# Python
py:install:
desc: Install Python dependencies using the specified package manager
cmds:
- task: "{{.PACKAGE_MANAGER}}:install"
py:update:
desc: Update Python dependencies using the specified package manager
cmds:
- task: "{{.PACKAGE_MANAGER}}:update"
poetry:install:
desc: Install Python dependencies + create virtualenv and lock file using poetry
cmds:
- poetry install
poetry:update:
desc: Update Python dependencies using poetry
cmds:
- poetry update
uv:install:
desc: Install Python dependencies + create virtualenv and lock file using uv
cmds:
- uv sync
uv:update:
desc: Update Python dependencies using uv
cmds:
- uv lock --upgrade
py:lint:
desc: Check static typing with Ruff
cmds:
- |
{{.RUN_PYTHON}} -m ruff check . \
{{if (eq (.FIX | default "false") "true")}}--fix{{end}} \
{{if (eq (.VERBOSE | default "false") "true")}}--verbose{{end}} \
py:fmt:
desc: Format static typing with Ruff
cmds:
- |
{{.RUN_PYTHON}} -m ruff format .
py:typecheck:
desc: Typechecking via pyright
cmds:
- |
{{.RUN_PYTHON}} -m pyright . \
{{if (eq (.VERBOSE | default "false") "true")}}--verbose{{end}}
py:test:
desc: Run all python tests
aliases: [pytest]
cmds:
- "{{.RUN_PYTHON}} -m pytest tests"
py:check:
desc: Run all Python static code checks
cmds:
- task: fmt
vars: { FIX: false }
- task: lint
vars: { FIX: false }
- task: typecheck
py:fix:
desc: Fix all auto-fixable code check errors
cmds:
- task: fmt
vars: { FIX: true }
- task: lint
vars: { FIX: true }
py:validate:
desc: Validate python with static code checks and unit tests
cmds:
- task: check
- task: test
# Streamlit
streamlit:run:
desc: Run Streamlit app from /dashboard folder
dir: ..
cmds:
- uv pip compile -q dashboard/pyproject.toml -o requirements.txt # To keep dependencies in sync with Streamlit Cloud
- dashboard/.venv/bin/python -m streamlit run dashboard/src/_router.py --logger.level debug
streamlit:upload:
desc: Upload files to Google Drive, for streamlit to fetch, from /dashboard folder
dir: ..
cmds:
- rclone copy dashboard/src/notebooks/ private_google_drive:pitchit/notebooks/ --include "*.ipynb"
# Go
go:lint:
desc: run golangci-lint in current directory
cmds:
- golangci-lint run ./... # The ./... pattern only matches current dir and subdirs
go:vet:
desc: run go vet
cmds:
- go vet ./...
go:fmt:
desc: check if code is formatted
cmds:
- |
if [ -n "$(gofmt -l .)" ]; then
echo "These files are not formatted:"
gofmt -l .
exit 1
fi
go:fmt-fix:
desc: fix code formatting
cmds:
- gofmt -w .
go:check:
desc: run all static code checks
cmds:
- task: go:fmt
- task: go:vet
- task: go:lint
go:fix:
desc: fix all auto-fixable issues
cmds:
- task: go:fmt-fix
go:ci:
desc: run all CI checks
cmds:
- task: go:check
- task: go:test
go:run:
desc: run main.go (with CGO enabled due to DuckDB API requirement)
cmds:
- CGO_ENABLED=1 go run main.go
go:test:
desc: run tests
cmds:
- go test -v ./...
go:install:
desc: install Go packages
cmds:
- go mod download
- go mod tidy
go:update:
desc: update Go packages
cmds:
- go get -u ./...
- go mod tidy