-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
125 lines (104 loc) · 3.79 KB
/
Taskfile.yaml
File metadata and controls
125 lines (104 loc) · 3.79 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
# https://taskfile.dev
version: "3"
vars:
TS: tree-sitter
# Editor install tasks are intentionally omitted.
#
# All supported editors (Neovim, Helix, Emacs, VS Code, Zed, Nova) require
# editing user configuration files (init.lua, languages.toml, init.el, etc.)
# in addition to copying files. Because there is no safe, idempotent way to
# merge into an arbitrary user config, and getting it wrong could break the
# user's editor setup, we do not automate these installs. See docs/editors/
# for per-editor instructions.
tasks:
default:
desc: List available tasks
cmds:
- task --list
# ── Internal ───────────────────────────────────────────────────────
_check-tools:
internal: true
preconditions:
- sh: command -v node
msg: "node is not installed — install Node.js 22 LTS (see .tool-versions)"
- sh: |
major=$(node -p "process.versions.node.split(\".\")[0]")
test "$major" -ge 22 -a "$major" -lt 24
msg: >-
Node.js >=22, <24 is required (found {{.NODE_VERSION}}).
tree-sitter-cli 0.25.x does not work with Node 24+.
Use asdf, fnm, or nvm to switch: see .tool-versions
- sh: command -v tree-sitter
msg: >-
tree-sitter CLI is not installed.
Install via: cargo install tree-sitter-cli
vars:
NODE_VERSION:
sh: node --version 2>/dev/null || echo "not found"
_npm-deps:
internal: true
sources:
- package.json
- package-lock.json
generates:
- node_modules/.package-lock.json
cmds:
- npm ci
# ── Build ──────────────────────────────────────────────────────────
generate:
desc: Regenerate the parser from the grammar
deps: [_check-tools, _npm-deps]
sources:
- grammar.js
generates:
- src/parser.c
cmds:
- "{{.TS}} generate"
build:
desc: Build the shared and static C libraries
deps: [generate]
cmds:
- make
clean:
desc: Remove build artifacts
cmds:
- make clean
# ── Test ───────────────────────────────────────────────────────────
test:
desc: Run the tree-sitter test corpus
deps: [_check-tools, _npm-deps, generate]
cmds:
- "{{.TS}} test"
test:parse-examples:
desc: Parse all example files and report errors
deps: [_check-tools, _npm-deps, generate]
cmds:
- "{{.TS}} parse examples/*.conf --stat"
# ── Install (system) ───────────────────────────────────────────────
install:
desc: Install the C library and query files system-wide (may need sudo)
deps: [build]
cmds:
- make install
uninstall:
desc: Remove the system-wide installation (may need sudo)
cmds:
- make uninstall
# ── CI ─────────────────────────────────────────────────────────────
ci:
desc: Run all CI checks
cmds:
- task: ci:test
- task: ci:check-github
ci:test:
desc: Build, test, and parse examples (used in CI)
cmds:
- task: test
- task: test:parse-examples
ci:check-github:
desc: Validate GitHub Actions workflows with zizmor
preconditions:
- sh: command -v zizmor
msg: "zizmor is not installed — pip install zizmor"
cmds:
- zizmor --format plain .github/workflows/