-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.dist.yaml
More file actions
179 lines (161 loc) · 4.42 KB
/
Copy pathTaskfile.dist.yaml
File metadata and controls
179 lines (161 loc) · 4.42 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
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
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
includes:
setup: Taskfile.{{OS}}.yaml
tasks:
default:
silent: true
cmds:
- task -l
init:
desc: Install dependencies and setup environment
aliases: [setup]
cmds:
- task: setup:init
- task: mise
- task: direnv
- task: lefthook
mise:
desc: Install workstation dependencies
cmds:
- mise trust -q -a
- mise install -q
preconditions:
- sh: command -v mise
msg: Mise is not installed
direnv:
desc: Run direnv hooks
cmd: direnv allow .
status:
- '[ -x "$(command -v direnv)" ]'
- "[[ $(direnv status --json | jq '.state.foundRC.allowed') == 0 ]]"
- "[[ $(direnv status --json | jq '.state.loadedRC.allowed') == 0 ]]"
lefthook:
desc: Install Lefthook
cmds:
- lefthook install
preconditions:
- command -v lefthook
- test -f lefthook.yaml
check:
desc: Run checks on tracked files
cmds:
- git diff --check
- task: check-files
vars:
FILES_CMD: git ls-files -z
check-staged:
desc: Run checks on staged files
cmds:
- git diff --cached --check
- task: check-files
vars:
FILES_CMD: git diff --cached --name-only --diff-filter=ACMR -z
check-files:
internal: true
cmds:
- |
bash -euo pipefail -c '
posix_shell_files=()
shell_files=()
zsh_files=()
lua_files=()
nvim_lua_files=()
format_files=()
while IFS= read -r -d "" file; do
[[ -e "$file" || -L "$file" ]] || continue
case "$file" in
base/.profile)
posix_shell_files+=("$file")
;;
*.sh|*.bash|*.ksh|*.bashrc|*.bash_profile|*.bash_login|*.bash_logout)
shell_files+=("$file")
;;
*.zsh|*/.zprofile|.zprofile|*/.zshrc|.zshrc|*/.zshrc.*|.zshrc.*)
zsh_files+=("$file")
;;
*.lua)
lua_files+=("$file")
case "$file" in
base/.config/nvim/*)
nvim_lua_files+=("$file")
;;
esac
;;
*.yaml|*.yml|*.json|*.jsonc)
format_files+=("$file")
;;
esac
done < <({{.FILES_CMD}})
if ((${#posix_shell_files[@]})); then
shellcheck -s sh -- "${posix_shell_files[@]}"
fi
if ((${#shell_files[@]})); then
shellcheck -- "${shell_files[@]}"
fi
for file in "${zsh_files[@]}"; do
zsh -n -- "$file"
done
if ((${#lua_files[@]})); then
stylua --check -- "${lua_files[@]}"
fi
if ((${#nvim_lua_files[@]})); then
selene --config base/.config/nvim/selene.toml -- "${nvim_lua_files[@]}"
fi
if ((${#format_files[@]})); then
prettier --check --ignore-unknown -- "${format_files[@]}"
fi
'
test:
desc: Run tests
cmds:
- git submodule update --init dotbot
- task: test-dotbot
- python3 ai/tests/test_worklease.py
test-dotbot:
internal: true
dir: dotbot
cmds:
- hatch test
fix:
desc: Format tracked files
cmds:
- task: fix-files
vars:
FILES_CMD: git ls-files -z
fix-files:
internal: true
cmds:
- |
bash -euo pipefail -c '
lua_files=()
format_files=()
while IFS= read -r -d "" file; do
[[ -e "$file" || -L "$file" ]] || continue
case "$file" in
*.lua)
lua_files+=("$file")
;;
*.yaml|*.yml|*.json|*.jsonc)
format_files+=("$file")
;;
esac
done < <({{.FILES_CMD}})
if ((${#lua_files[@]})); then
stylua -- "${lua_files[@]}"
fi
if ((${#format_files[@]})); then
prettier --write --ignore-unknown -- "${format_files[@]}"
fi
'
update:
desc: Update dependencies
cmds:
- mise update -q
- task: update-dotbot
update-dotbot:
desc: Update the pinned Dotbot revision
cmds:
- git submodule update --remote dotbot
- git -C dotbot submodule update --init --recursive