-
Notifications
You must be signed in to change notification settings - Fork 3k
Expand file tree
/
Copy pathjustfile
More file actions
188 lines (147 loc) · 5.81 KB
/
Copy pathjustfile
File metadata and controls
188 lines (147 loc) · 5.81 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
set windows-shell := ["pwsh", "-NoLogo", "-NoProfileLoadTime", "-Command"]
mod release
# Show available commands
default:
@just --list
# Build the project
build:
{{ ninja }} pylib qt
# Build and run Anki in development mode
run *args:
{{ run_script }} {{ args }}
# Build and run Anki in optimized (release) mode
run-optimized *args:
{{ if os() == "windows" { "$env:RELEASE='1'; .\\run.bat" } else { "RELEASE=1 ./run" } }} {{ args }}
# Watch web sources and rebuild/reload Anki's web stack on change (macOS/Linux)
web-watch:
./tools/web-watch
# Rebuild and reload Anki's web stack without restarting (macOS/Linux)
rebuild-web:
./tools/rebuild-web
# Build wheels (needed for some platforms)
wheels:
{{ ninja }} wheels
# Build and run all checks (lint + test) - lets ninja handle dependencies
check:
{{ ninja }} pylib qt check
# Run all tests (Rust, Python, TypeScript). Pass --coverage to enforce coverage, and --html to include HTML reports.
[arg("coverage", long="coverage", value="--coverage")]
[arg("html", long="html", value="--html")]
test coverage='' html='':
just {{ if coverage == "--coverage" { "coverage " + html } else { "_test" } }}
# Run coverage for all test stacks. Pass --html to also generate HTML reports.
[arg("html", long="html", value="--html")]
coverage html='':
just _coverage-rust {{ html }}
just _coverage-py {{ html }}
just _coverage-ts {{ html }}
# Run Rust tests. Pass --coverage to enforce Rust coverage, and --html to include an HTML report.
[arg("coverage", long="coverage", value="--coverage")]
[arg("html", long="html", value="--html")]
test-rust coverage='' html='':
just {{ if coverage == "--coverage" { "_coverage-rust " + html } else { "_test-rust" } }}
# Run Python tests (pylib + qt). Pass --coverage to enforce coverage, and --html to include HTML reports.
[arg("coverage", long="coverage", value="--coverage")]
[arg("html", long="html", value="--html")]
test-py coverage='' html='':
just {{ if coverage == "--coverage" { "_coverage-py " + html } else { "_test-py" } }}
# Run TypeScript/Svelte Vitest tests. Pass --coverage to enforce coverage, and --html to include an HTML report.
[arg("coverage", long="coverage", value="--coverage")]
[arg("html", long="html", value="--html")]
test-ts coverage='' html='':
just {{ if coverage == "--coverage" { "_coverage-ts " + html } else { "_test-ts" } }}
# Run Playwright end-to-end tests. Pass --ui to open the interactive UI.
[arg("ui", long="ui", value="--ui")]
test-e2e ui='': _install-playwright-browsers
{{ ninja }} pyenv ts:generated pylib qt
{{ playwright_env }} {{ yarn }} test:e2e {{ ui }}
[private]
_test:
{{ ninja }} check:rust_test check:pytest check:vitest
[private]
_test-rust:
{{ ninja }} check:rust_test
[private]
_test-py:
{{ ninja }} check:pytest
[private]
_test-ts:
{{ ninja }} check:vitest
[private]
_coverage-rust html='':
{{ if os_family() == "windows" { "tools\\coverage\\coverage-rust" } else { "tools/coverage/coverage-rust" } }} {{ html }}
[private]
_coverage-py html='':
{{ ninja }} pylib qt
just _coverage-py-pylib {{ html }}
just _coverage-py-qt {{ html }}
[private]
_coverage-py-pylib html='':
{{ if os_family() == "windows" { "tools\\coverage\\coverage-py" } else { "tools/coverage/coverage-py" } }} pylib {{ html }}
[private]
_coverage-py-qt html='':
{{ if os_family() == "windows" { "tools\\coverage\\coverage-py" } else { "tools/coverage/coverage-py" } }} qt {{ html }}
[private]
_coverage-ts html='':
{{ ninja }} node_modules ts:generated
{{ if os_family() == "windows" { "tools\\coverage\\coverage-ts" } else { "tools/coverage/coverage-ts" } }} {{ html }}
[private]
_install-playwright-browsers:
{{ ninja }} node_modules
{{ playwright_env }} {{ yarn }} playwright install chromium
# Check formatting (fast, no build needed)
fmt:
{{ ninja }} check:format
# Fix formatting
fix-fmt:
{{ ninja }} format
# Run linting and type checking (requires build outputs)
lint:
{{ ninja }} \
check:clippy \
check:mypy \
check:ruff \
check:eslint \
check:svelte \
check:typescript
# Fix auto-fixable lint issues (ruff + eslint)
fix-lint:
{{ ninja }} fix:ruff fix:eslint
# Run minilints (copyright, contributors, licenses)
minilints:
{{ ninja }} check:minilints
# Fix minilints (update licenses.json)
fix-minilints:
{{ ninja }} fix:minilints
# Sync translation files
ftl-sync:
{{ ninja }} ftl-sync
# Deprecate translation strings
ftl-deprecate:
{{ ninja }} ftl-deprecate
# Build documentation site
docs:
{{ uv }} run --group docs sphinx-build -b html docs out/docs/html
@echo "Docs built at out/docs/html/index.html"
# Build and serve documentation site
docs-serve:
{{ uv }} run --group docs sphinx-autobuild docs out/docs/html --host 127.0.0.1 --port 8000
# Build Rust API docs
docs-rust:
cargo doc --open
# Dispatch CI workflow on a given branch or tag
ci branch:
gh workflow run ci.yml --ref {{ branch }}
# Run Complexipy in regression-only mode
complexipy-diff:
{{ ninja }} check:complexipy-diff
# Remove build outputs from out/ (pass keep-env to keep node_modules/pyenv); macOS/Linux
clean *args:
./tools/clean {{ args }}
# Helpers to get the right commands for the platform
ninja := if os() == "windows" { "tools\\ninja" } else { "./ninja" }
run_script := if os() == "windows" { ".\\run.bat" } else { "./run" }
playwright_env := if os() == "windows" { "set PLAYWRIGHT_BROWSERS_PATH=out\\playwright-browsers&&" } else { "PLAYWRIGHT_BROWSERS_PATH=out/playwright-browsers" }
yarn := if os() == "windows" { "out\\extracted\\node\\yarn.cmd" } else { "out/extracted/node/bin/yarn" }
uv := env("UV_BINARY", if os() == "windows" { "out\\extracted\\uv\\uv" } else { "out/extracted/uv/uv" })
export UV_PROJECT_ENVIRONMENT := if os() == "windows" { "out\\pyenv" } else { "out/pyenv" }