Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
327 lines (296 loc) · 12.5 KB
/
Copy pathTaskfile.yml
File metadata and controls
327 lines (296 loc) · 12.5 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
325
326
327
version: '3'
tasks:
# Default task - show help
default:
desc: Show available tasks and common workflows
cmds:
- task: help
# === TESTING WORKFLOWS ===
test:
desc: Run test suite including quality checks 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-jet:
desc: Run JET static analysis directly
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-ad:
desc: Run AD gradient tests directly
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-formatting:
desc: Run JuliaFormatter check directly
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-extensions:
desc: Test package extensions with OptimizationExt
cmds:
- echo "🔧 Testing package extensions..."
- julia --project=docs --quiet -e 'using CensoredDistributions, Distributions, OptimizationOptimJL, Bijectors; println("✅ Extensions loaded successfully")'
format:
desc: Format code with JuliaFormatter (fixes formatting issues)
cmds:
- echo "🎨 Formatting code with JuliaFormatter..."
- julia --project=test/formatter -e 'using Pkg; Pkg.instantiate()' 2>/dev/null
- julia --project=test/formatter --quiet -e 'using JuliaFormatter; format("src", verbose=false, overwrite=true); format("test", verbose=false, overwrite=true); format("docs", verbose=false, overwrite=true); format("benchmark", verbose=false, overwrite=true)'
- echo "✅ Code formatting completed"
coverage:
desc: Run tests with coverage and generate coverage report
cmds:
- echo "📊 Running tests with coverage..."
- julia --project=. --code-coverage=user -e 'using Pkg; Pkg.test(test_args=["skip_quality"])'
- echo "📊 Processing coverage data..."
- julia --project=test -e 'using Pkg; Pkg.add("Coverage"); using Coverage; coverage = process_folder(); LCOV.writefile("lcov.info", coverage)'
- 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 complete documentation including Literate tutorials (slow)
cmds:
- echo "📚 Building complete documentation (including notebooks)..."
- 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 --project=docs docs/make.jl --skip-notebooks
- echo "✅ Fast documentation build completed"
# === DEVELOPMENT SETUP ===
setup:
desc: Set up development environment from scratch
cmds:
- echo "🛠️ Setting up development environment..."
- echo "📦 Installing root environment dependencies..."
- julia --project=. -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing test environment dependencies..."
- julia --project=test -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing AD test environment dependencies..."
- julia --project=test/ad -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing JET environment dependencies..."
- julia --project=test/jet -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing formatter environment dependencies..."
- julia --project=test/formatter -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing docs environment dependencies..."
- julia --project=docs -e 'using Pkg; Pkg.instantiate()'
- echo "📦 Installing benchmark environment dependencies..."
- julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
- 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 across all environments
cmds:
- echo "📦 Package status overview:"
- echo ""
- echo "=== Root Environment ==="
- julia --project=. --quiet -e 'using Pkg; Pkg.status()'
- echo ""
- echo "=== Test Environment ==="
- julia --project=test --quiet -e 'using Pkg; Pkg.status()'
- echo ""
- echo "=== Docs Environment ==="
- julia --project=docs --quiet -e 'using Pkg; Pkg.status()'
- echo ""
- echo "=== Benchmark Environment ==="
- julia --project=benchmark --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=PrimaryCensored)"
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=analytical)"
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 CensoredDistributions {{.CLI_ARGS}}
benchmark-install:
desc: Install benchpkg CLI to 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 pre-commit formatting hooks only
cmds:
- echo "🎨 Running pre-commit formatting hooks..."
- pre-commit run --all-files
- echo "✅ Pre-commit formatting completed"
ci:
desc: Simulate 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:
- echo "📋 CensoredDistributions.jl Project Information"
- echo "==============================================="
- |
julia --project=. -e 'using Pkg; println("Julia version: ", VERSION); pkg = Pkg.project(); println("Package: ", pkg.name, " v", pkg.version)'
- echo ""
- task: pkg-status
help:
desc: Show available commands
cmds:
- task --list