-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathTaskfile.yml
More file actions
131 lines (108 loc) · 3.68 KB
/
Taskfile.yml
File metadata and controls
131 lines (108 loc) · 3.68 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
version: "3"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
silent: true
help:
desc: Show available tasks
cmds:
- task --list
silent: true
install:
desc: Install dev dependencies and git hooks
cmds:
- |
if ! command -v uv >/dev/null 2>&1; then
echo "uv is not installed or not on PATH."
exit 1
fi
if ! command -v prek >/dev/null 2>&1; then
echo "prek is not installed or not on PATH."
exit 1
fi
prek install
uv sync --locked --group dev
check:
desc: Run all quality checks
deps:
- lint
- format
- typecheck
- deadcode
lint:
desc: Run ruff linter with auto-fix
cmds:
- uv run ruff check --fix
format:
desc: Run ruff formatter
cmds:
- uv run ruff format
typecheck:
desc: Run ty type checker
cmds:
- uv run ty check
deadcode:
desc: Run vulture dead code checker
cmds:
- uv run vulture --min-confidence 100 --exclude ".venv" .
test:
desc: Run pytest
cmds:
- uv run pytest
rebuild:
desc: Build and run Docker containers
interactive: true
env:
PHOTON_VERSION: "{{.PHOTON_VERSION}}"
vars:
PHOTON_VERSION:
sh: tr -d '[:space:]' < .last_release
NOCACHE: '{{default "false" .NOCACHE}}'
VOLUMES: '{{default "false" .VOLUMES}}'
cmds:
- |
nocache="{{.NOCACHE}}"
volumes="{{.VOLUMES}}"
if [ "{{.CLI_ARGS}}" != "" ]; then
echo "This task does not accept positional CLI args. Use Task vars like NOCACHE=true."
exit 1
fi
if [ ! -t 0 ]; then
if [ "$volumes" = "true" ]; then
docker compose -f docker-compose.build.yml down -v
else
docker compose -f docker-compose.build.yml down
fi
if [ "$nocache" = "true" ]; then
docker compose -f docker-compose.build.yml build --no-cache
else
docker compose -f docker-compose.build.yml build
fi
docker compose -f docker-compose.build.yml up
exit 0
fi
read -r "?Rebuild without cache? (y/n): " nocache_input
read -r "?Remove volumes before rebuild? (y/n): " volumes_input
if [ "$nocache_input" = "y" ] || [ "$nocache_input" = "Y" ]; then
nocache="true"
fi
if [ "$volumes_input" = "y" ] || [ "$volumes_input" = "Y" ]; then
volumes="true"
fi
if [ "$volumes" = "true" ]; then
docker compose -f docker-compose.build.yml down -v
else
docker compose -f docker-compose.build.yml down
fi
if [ "$nocache" = "true" ]; then
docker compose -f docker-compose.build.yml build --no-cache
else
docker compose -f docker-compose.build.yml build
fi
docker compose -f docker-compose.build.yml up
clean:
desc: Stop and remove Docker containers
cmds:
- docker compose -f docker-compose.build.yml down