-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
210 lines (185 loc) · 7.58 KB
/
Copy pathTaskfile.yml
File metadata and controls
210 lines (185 loc) · 7.58 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
version: "3"
tasks:
fmt:
desc: Format code with rustfmt
cmds:
- cargo fmt
fmt-check:
desc: Check if code is formatted
cmds:
- cargo fmt -- --check
lint:
desc: Run linter
cmds:
- cargo clippy --workspace --all-targets --all-features -- -D warnings
doc:
desc: Build docs warnings-as-errors and run doc tests (mirrors CI)
# Mirrors the CI "build-and-test" doc job. RUSTDOCFLAGS=-D warnings turns
# rustdoc lints (broken/private intra-doc links, etc.) into hard errors —
# these only run in CI otherwise, so a clean `task dev` could still fail the
# doc job. `task dev` inlines the build half of this; the doc tests there
# come along with `cargo test --workspace`.
cmds:
- RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
- cargo test --doc
build-release:
desc: Build release version
cmds:
- cargo build --release
test-debug:
desc: Run tests with debug logging
cmds:
- RUST_LOG=debug cargo test
test-quiet:
desc: Run tests quietly (no debug output)
cmds:
- RUST_LOG=off cargo test
test-slow:
desc: Run ignored slow regression and stochastic tests
cmds:
- cargo test --workspace -- --ignored
test-ts:
desc: Compile the TS wrapper and run the @jolars/eunoia/svg unit tests
# `prepare-package.mjs` recompiles `ts/*.ts` → `npm/*.js` first, so the
# tests always run against fresh output. It only needs the (checked-in)
# wasm `.d.ts` in `npm/`, not a fresh wasm-pack build. The svg module is
# pure/wasm-free, so `node --test` loads `npm/svg.js` directly.
cmds:
- node ts/prepare-package.mjs
- node --test 'ts/tests/**/*.test.mjs'
coverage:
desc: Generate code coverage report
cmds:
- cargo llvm-cov --all-features --workspace --html
- echo "Coverage report generated at target/llvm-cov/html/index.html"
coverage-open:
desc: Generate and open coverage report in browser
cmds:
- cargo llvm-cov --all-features --workspace --open
dev:
desc: Development workflow - format, check, test (+ corpus guardrail), lint, doc
cmds:
- cargo fmt
- cargo check --workspace
- cargo test --workspace
# Fit-quality guardrail: the corpus_quality passes are #[ignore]'d out of
# the default suite for speed (~0.7s vs ~17s), but run here so the pre-PR
# gate still catches fitter regressions. Scoped to corpus_quality (~16s)
# rather than a blanket --include-ignored: the latter also pulls in the
# 17-set issue89 regression, whose debug-assert-heavy fits push the run
# past two minutes. Use `task test-slow` for the full ignored set.
- cargo test -p eunoia --lib fitter::corpus_quality -- --include-ignored
- cargo clippy --workspace --all-targets --all-features -- -D warnings
# Rustdoc warnings-as-errors (broken/private intra-doc links, etc.). CI
# enforces this in its doc job; mirror just the build here since the doc
# tests already ran under `cargo test --workspace` above. See `task doc`.
- RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
# JS/TS surface: compile the wrapper and run the pure svg-serializer tests.
- task: test-ts
build-wasm:
desc: Build WASM bindings and prepare npm/ as @jolars/eunoia
# The prepare step is part of `build-wasm` (not a separate task) so the
# `npm/` artifact is always self-consistent. Otherwise downstream tooling
# (notably pnpm resolving the `file:../npm` link from web/) can capture
# the raw wasm-pack output keyed as `eunoia-wasm` instead of
# `@jolars/eunoia`, silently breaking imports.
cmds:
- wasm-pack build crates/eunoia-wasm --target bundler --out-dir ../../npm
- node ts/prepare-package.mjs
build-web:
desc: Build the self-contained browser bundle (@jolars/eunoia/web)
# Separate from `build-wasm`: this runs its own `wasm-pack --target web`
# build and esbuild-inlines the result into a single `npm/web.js`. Kept off
# the `build-wasm` hot path (the web app's dev loop uses the `.` entry, not
# `/web`), so it only runs for releases — see publish-npm.yml — or on demand.
cmds:
- node ts/build-web.mjs
pack-npm:
desc: Alias for build-wasm (kept for back-compat with publish workflows)
cmds:
- task: build-wasm
web-dev:
desc: Start Svelte development server
dir: web
cmds:
- npm run dev
lighthouse:
desc: "Lighthouse desktop audit of the docs (perf, a11y, best-practices, SEO). Args: URL=..."
# Audits the live docs site by default. Point URL at a local preview
# (e.g. `task web-dev` → http://localhost:5173/docs/) to audit unreleased
# changes. Uses the chromium from the devenv shell.
vars:
URL: '{{.URL | default "https://eunoia.bz/docs/"}}'
cmds:
- mkdir -p .lighthouse
- >-
CHROME_PATH="$(command -v chromium)"
lighthouse "{{.URL}}"
--preset=desktop
--output=json --output=html
--output-path=.lighthouse/report
--chrome-flags="--headless=new --no-sandbox --disable-gpu"
--only-categories=performance,accessibility,best-practices,seo
--quiet
- >-
node -e 'const r=require("./.lighthouse/report.report.json");
for(const k in r.categories)
console.log(r.categories[k].title.padEnd(16),
Math.round(r.categories[k].score*100));'
flamegraph:
desc: "Flamegraph of the single-fit example. Args: CASE=3circle|4set|6set (default 6set)"
vars:
CASE: '{{.CASE | default "6set"}}'
cmds:
- RAYON_NUM_THREADS=1 cargo flamegraph --profile profiling --example fit_profile -- {{.CASE}}
perf-record:
desc: "perf record on the single-fit example. Args: CASE=3circle|4set|6set (default 6set)"
vars:
CASE: '{{.CASE | default "6set"}}'
cmds:
- cargo build --profile profiling --example fit_profile
- RAYON_NUM_THREADS=1 perf record --call-graph fp -F 999 -o perf.data -- ./target/profiling/examples/fit_profile {{.CASE}}
- 'echo "Inspect with: perf report -i perf.data (or: perf annotate -i perf.data)"'
samply:
desc: "samply record on the single-fit example (web UI). Args: CASE=3circle|4set|6set, ITERS=200"
vars:
CASE: '{{.CASE | default "6set"}}'
ITERS: "{{.ITERS | default 200}}"
cmds:
- cargo build --profile profiling --example fit_profile
- RAYON_NUM_THREADS=1 samply record ./target/profiling/examples/fit_profile {{.CASE}} {{.ITERS}}
asm:
desc: "Disassemble a function with cargo-show-asm. Args: FUNC=eunoia::geometry::shapes::ellipse::region_boundary_arcs_ellipse"
vars:
FUNC: '{{.FUNC | default ""}}'
cmds:
- cargo asm --profile profiling -p eunoia --lib {{.FUNC}}
paper-figures:
desc: Regenerate the JOSS paper figures from the npm/ package
# Needs a current `npm/` (task build-wasm) plus node and inkscape.
cmds:
- node paper/make-figures.mjs
paper-build:
desc: Build JOSS paper locally
cmds:
- |
docker run --rm \
--volume $PWD/paper:/data \
--user $(id -u):$(id -g) \
--env JOURNAL=joss \
openjournals/inara
- echo "Paper built!"
paper-preview:
desc: Rebuild the JOSS paper on change and open it in zathura
watch: true
sources:
- "paper/paper.md"
- "paper/paper.bib"
cmds:
- task: paper-build
- pgrep -f "zathura.*paper/paper.pdf" || (zathura paper/paper.pdf &)
- echo "Watching for changes"
paper-wordcount:
desc: Word count of the JOSS paper
cmds:
- pandoc paper/paper.md -t plain | wc -w