Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
324 lines (290 loc) Β· 11.9 KB
/
Copy pathTaskfile.yml
File metadata and controls
324 lines (290 loc) Β· 11.9 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# MANAGED by EpiAwarePackageTools.scaffold β do not edit by hand.
version: '3'
# Standard EpiAware package development tasks. Package-specific assumptions
# (a particular extension, a fixed package name) are kept out so this drops
# into any package. Override `PACKAGE` below, or leave it read from
# Project.toml.
vars:
PACKAGE:
sh: julia --project=. -e 'using Pkg; print(Pkg.project().name)'
tasks:
# Default task - show help
default:
desc: Show available tasks and common workflows
cmds:
- task: help
# === TESTING WORKFLOWS ===
test:
desc: Run the full test suite including quality and AD gradient tests
deps: [test-ad]
cmds:
- echo "π§ͺ Running test suite..."
- julia --project=. --quiet -e 'using Pkg; Pkg.test()'
- echo "β
All tests completed successfully"
test-fast:
desc: Run tests quickly (skip quality checks for development)
cmds:
- echo "π§ͺ Running fast test suite (skipping quality checks)..."
- julia --project=. --quiet -e 'using Pkg; Pkg.test(test_args=["skip_quality"])'
- echo "β
Fast tests completed"
test-quality:
desc: Run only quality checks (Aqua, formatting, linting, doctests)
cmds:
- echo "π Running quality checks only..."
- julia --project=. --quiet -e 'using Pkg; Pkg.test(test_args=["quality_only"])'
- echo "β
Quality checks completed"
test-parallel:
desc: Run test-fast and test-quality concurrently (faster local iteration)
deps: [test-fast, test-quality]
test-jet:
desc: Run JET static analysis directly (isolated environment)
cmds:
- echo "π Running JET static analysis..."
- julia --project=test/jet -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/jet test/jet/runtests.jl
- echo "β
JET analysis completed"
test-formatting:
desc: Run the Runic check directly (isolated environment)
cmds:
- echo "π¨ Checking code formatting..."
- julia --project=test/formatter -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/formatter test/formatter/runtests.jl
- echo "β
Formatting check completed"
test-ad:
desc: Run AD gradient tests directly (isolated environment)
cmds:
- echo "π Running AD gradient tests..."
- julia --project=test/ad -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/ad test/ad/runtests.jl
- echo "β
AD gradient tests completed"
test-ad-backend:
desc: >-
Run AD gradient tests for a single backend tag, as the per-backend CI
does (e.g. TAG=enzyme_reverse task test-ad-backend)
cmds:
- echo "π Running AD gradient tests for {{.TAG}}..."
- julia --project=test/ad -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/ad test/ad/runtests.jl {{.TAG}}
- echo "β
AD gradient tests for {{.TAG}} completed"
test-extensions:
desc: >-
Check package extensions load by importing the package in the docs env
(a package can customise which trigger packages to load here)
cmds:
- echo "π§ Testing package extensions..."
- julia --project=docs --quiet -e 'using {{.PACKAGE}}; println("β
Package + docs env loaded")'
format:
desc: Format code with Runic (fixes formatting issues)
cmds:
- echo "π¨ Formatting code with Runic..."
- julia --project=test/formatter -e 'using Pkg; Pkg.instantiate()' 2>/dev/null
- julia --project=test/formatter --quiet -e 'using Runic; dirs = filter(isdir, ["src", "test", "docs", "benchmark", "ext"]); Runic.main(["-i", dirs...])'
- echo "β
Code formatting completed"
coverage:
desc: Run tests with coverage and generate an lcov report
cmds:
- echo "π Running tests with coverage..."
- julia --project=. -e 'using Pkg; Pkg.test(coverage=true, test_args=["skip_quality"])'
- echo "π Processing coverage data..."
- julia --project=@coverage -e 'using Pkg; Pkg.add("Coverage"); using Coverage; LCOV.writefile("lcov.info", process_folder())'
- echo "β
Coverage report generated (lcov.info)"
coverage-ad:
desc: >
Run AD gradient tests with coverage over src + ext and write
lcov-ad.info (mirrors CI). Pass a backend tag to scope it, e.g.
`task coverage-ad -- enzyme_reverse`; omit for the full union.
cmds:
- echo "π Running AD gradient tests with coverage..."
- julia --project=test/ad -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/ad --code-coverage=user test/ad/runtests.jl {{.CLI_ARGS}}
- echo "π Processing AD coverage data (src + ext)..."
- julia --project=test -e 'using Pkg; Pkg.add("Coverage"); using Coverage; cov = vcat(process_folder("src"), process_folder("ext")); LCOV.writefile("lcov-ad.info", cov); clean_folder("src"); clean_folder("ext")'
- echo "β
AD coverage report generated (lcov-ad.info)"
# === DOCUMENTATION WORKFLOWS ===
docs:
desc: Build the documentation
cmds:
- echo "π Building documentation..."
- JULIA_NUM_THREADS=auto julia --project=docs docs/make.jl
- echo "β
Documentation built successfully"
docs-fast:
desc: Build documentation quickly (skip notebook processing)
cmds:
- echo "π Building documentation (skipping notebooks)..."
- JULIA_NUM_THREADS=auto julia --project=docs docs/make.jl --skip-notebooks
- echo "β
Fast documentation build completed"
# === DEVELOPMENT SETUP ===
setup:
desc: Set up the development environment from scratch
cmds:
- echo "π οΈ Setting up development environment..."
- julia --project=. -e 'using Pkg; Pkg.instantiate()'
- julia --project=test -e 'using Pkg; Pkg.instantiate()'
- >-
for d in test/ad test/jet test/formatter docs benchmark; do
[ -f "$d/Project.toml" ] &&
julia --project="$d" -e 'using Pkg; Pkg.instantiate()' || true;
done
- echo "β
Development environment ready"
setup-precompile:
desc: Force precompilation of all environments
cmds:
- echo "π Precompiling all environments..."
- julia --project=. -e 'using Pkg; Pkg.precompile()'
- julia --project=test -e 'using Pkg; Pkg.precompile()'
- julia --project=docs -e 'using Pkg; Pkg.precompile()'
- julia --project=benchmark -e 'using Pkg; Pkg.precompile()'
- echo "β
Precompilation completed"
# === PACKAGE MANAGEMENT ===
pkg-status:
desc: Show package status for the root and test environments
cmds:
- echo "π¦ Package status overview:"
- echo "=== Root Environment ==="
- julia --project=. --quiet -e 'using Pkg; Pkg.status()'
- echo "=== Test Environment ==="
- julia --project=test --quiet -e 'using Pkg; Pkg.status()'
pkg-update:
desc: Update packages in all environments
interactive: true
cmds:
- |
echo "β οΈ WARNING: This will update packages in all environments"
printf " Continue? [y/N] "
read -r REPLY
if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then
echo "π¦ Updating root environment..."
julia --project=. -e 'using Pkg; Pkg.update()'
echo "π¦ Updating test environment..."
julia --project=test -e 'using Pkg; Pkg.update()'
echo "π¦ Updating docs environment..."
julia --project=docs -e 'using Pkg; Pkg.update()'
echo "π¦ Updating benchmark environment..."
julia --project=benchmark -e 'using Pkg; Pkg.update()'
echo "β
All environments updated"
else
echo "β Update cancelled"
fi
pkg-add:
desc: "Add package to specified environment (usage: task pkg-add ENV=docs -- PackageName)"
cmds:
- |
ENV_VAR={{.ENV | default "."}}
if [ -z "{{.CLI_ARGS}}" ]; then
echo "Usage: task pkg-add ENV=<environment> -- <PackageName>"
echo "Environments: . (root), test, docs, benchmark"
echo "Example: task pkg-add ENV=docs -- Literate"
exit 1
fi
echo "π¦ Adding {{.CLI_ARGS}} to $ENV_VAR environment..."
julia --project=$ENV_VAR -e "using Pkg; Pkg.add(\"{{.CLI_ARGS}}\")"
echo "β
Package added successfully"
# === BENCHMARKS ===
# Helper to find main repo (works in both main repo and worktrees)
_benchmark-repo-path:
internal: true
cmds:
- |
git_dir=$(git rev-parse --git-dir)
if [[ "$git_dir" == *"/worktrees/"* ]]; then
dirname $(dirname $(dirname "$git_dir"))
else
git rev-parse --show-toplevel
fi
silent: true
benchmark:
desc: "Run benchmarks (usage: task benchmark -- --filter=Foo)"
cmds:
- echo "β‘ Running benchmarks..."
- |
git_dir=$(git rev-parse --git-dir)
if [[ "$git_dir" == *"/worktrees/"* ]]; then
REPO_PATH=$(dirname $(dirname $(dirname "$git_dir")))
else
REPO_PATH=$(git rev-parse --show-toplevel)
fi
~/.julia/bin/benchpkg --rev=dirty --path="$REPO_PATH" --script="$(pwd)/benchmark/benchmarks.jl" {{.CLI_ARGS}}
benchmark-compare:
desc: "Compare main vs current (usage: task benchmark-compare -- --filter=Foo)"
cmds:
- echo "β‘ Comparing benchmarks (main vs current)..."
- |
git_dir=$(git rev-parse --git-dir)
if [[ "$git_dir" == *"/worktrees/"* ]]; then
REPO_PATH=$(dirname $(dirname $(dirname "$git_dir")))
else
REPO_PATH=$(git rev-parse --show-toplevel)
fi
~/.julia/bin/benchpkg --rev=main,dirty --path="$REPO_PATH" --script="$(pwd)/benchmark/benchmarks.jl" {{.CLI_ARGS}}
benchmark-table:
desc: "Show benchmark results table (usage: task benchmark-table -- --rev=dirty)"
cmds:
- ~/.julia/bin/benchpkgtable {{.PACKAGE}} {{.CLI_ARGS}}
benchmark-install:
desc: Install the benchpkg CLI to the global environment (one-time)
cmds:
- julia -e 'using Pkg; Pkg.add("AirspeedVelocity")'
- echo "β
benchpkg installed to ~/.julia/bin"
# === DEVELOPMENT WORKFLOWS ===
dev:
desc: Common development workflow (format + precommit + fast test + fast docs)
cmds:
- task: format
- task: precommit
- task: test-fast
- task: docs-fast
- echo "β
Development checks completed"
dev-full:
desc: Full development workflow (format + precommit + all tests + full docs)
cmds:
- task: format
- task: precommit
- task: test
- task: docs
- echo "β
Full development checks completed"
precommit:
desc: Run the pre-commit hooks on all files
cmds:
- echo "π¨ Running pre-commit hooks..."
- pre-commit run --all-files
- echo "β
Pre-commit completed"
ci:
desc: Simulate the CI pipeline locally
cmds:
- echo "π€ Running CI simulation..."
- task: precommit
- task: test
- task: docs-fast
- task: benchmark
- echo "β
CI simulation completed successfully"
# === UTILITIES ===
clean:
desc: Clean build artifacts and temporary files
interactive: true
cmds:
- |
echo "β οΈ WARNING: This will delete build artifacts and temporary files"
echo " - docs/build/ directory"
echo " - .cov files"
echo " - Test environment Manifest.toml"
printf " Continue? [y/N] "
read -r REPLY
if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then
echo "ποΈ Cleaning build artifacts..."
rm -rf docs/build/
find . -name "*.cov" -delete
rm -f test/Manifest.toml docs/Manifest.toml benchmark/Manifest.toml
echo "β
Cleanup completed"
else
echo "β Cleanup cancelled"
fi
# === INFORMATION ===
info:
desc: Show project information and environment status
cmds:
- 'julia --project=. -e ''using Pkg; println("Julia version: ", VERSION); p = Pkg.project(); println("Package: ", p.name, " v", p.version)'''
- task: pkg-status
help:
desc: Show available commands
cmds:
- task --list