Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
263 lines (224 loc) · 8.66 KB
/
Copy pathJustfile
File metadata and controls
263 lines (224 loc) · 8.66 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
# Justfile for alliance-platform-py development tasks
# Install dependencies
install:
uv sync --all-groups
# Run tests for specific package
# Usage: just test-package ap-pdf [python-version] [django-constraint]
# Examples:
# just test-package ap-pdf # default Python, no constraint
# just test-package ap-pdf 3.12 # Python 3.12, no constraint
# just test-package ap-pdf 3.12 django42 # Python 3.12 with Django 4.2
test-package package python="" constraint="":
#!/usr/bin/env bash
set -euo pipefail
PKG="{{package}}"
PY="{{python}}"
CONSTRAINT="{{constraint}}"
if [[ "$PKG" == "ap-dev" ]]; then
if [[ -n "$CONSTRAINT" ]]; then
echo "ap-dev does not accept a Django constraint" >&2
exit 2
fi
just test-dev "$PY"
exit
fi
# Colors
BOLD='\033[1m'
GREEN='\033[32m'
BLUE='\033[34m'
RESET='\033[0m'
# Set environment variables
export UV_NO_SYNC=1
if [[ -n "$PY" ]]; then
export UV_PYTHON="$PY"
fi
if [[ -n "$CONSTRAINT" ]]; then
export UV_CONSTRAINT="constraints/${CONSTRAINT}.txt"
echo -e "${BLUE}Using constraint: $UV_CONSTRAINT${RESET}"
fi
echo -e "${BOLD}${GREEN}Testing $PKG${RESET}"
PACKAGE_NAME="alliance-platform-${PKG#ap-}"
# Recreate venv for correct Python version if needed
if [[ ! -d .venv ]] || [[ -n "$PY" ]]; then
echo "Creating virtual environment..."
rm -rf .venv
uv venv >/dev/null
fi
# Install package and dependencies (including dev group)
echo "Installing dependencies..."
if [[ -n "$CONSTRAINT" ]]; then
# Use override to replace Django version while preserving dev dependencies
uv export --no-hashes --package "$PACKAGE_NAME" | UV_OVERRIDE="constraints/${CONSTRAINT}.txt" uv pip install -r - >/dev/null 2>&1
else
uv export --no-hashes --package "$PACKAGE_NAME" | uv pip install -r - >/dev/null 2>&1
fi
# Run tests
cd "packages/$PKG" && uv run ./manage.py test
# Run the standalone development runner tests (no Django test app or database).
test-dev python="":
#!/usr/bin/env bash
set -euo pipefail
if [[ -n "{{python}}" ]]; then
export UV_PYTHON="{{python}}"
fi
unset UV_NO_SYNC
cd packages/ap-dev
uv run --package alliance-platform-dev python -m unittest discover -s tests -p 'test_*.py'
# Run tests for all packages
# Usage: just test-all [python-version] [django-constraint]
# Examples:
# just test-all # default Python, no constraint
# just test-all 3.12 # Python 3.12, no constraint
# just test-all 3.12 django42 # Python 3.12 with Django 4.2
test-all python="" constraint="":
#!/usr/bin/env bash
set -e
PY="{{python}}"
CONSTRAINT="{{constraint}}"
# Colors
BOLD='\033[1m'
GREEN='\033[32m'
BLUE='\033[34m'
RED='\033[31m'
YELLOW='\033[33m'
RESET='\033[0m'
# Set environment variables
export UV_NO_SYNC=1
if [[ -n "$PY" ]]; then
export UV_PYTHON="$PY"
echo -e "${BLUE}Using Python: $PY${RESET}"
fi
if [[ -n "$CONSTRAINT" ]]; then
export UV_CONSTRAINT="constraints/${CONSTRAINT}.txt"
echo -e "${BLUE}Using constraint: $UV_CONSTRAINT${RESET}"
fi
echo ""
# Recreate venv for correct Python version if needed
if [[ ! -d .venv ]] || [[ -n "$PY" ]]; then
echo -e "${YELLOW}Creating virtual environment...${RESET}"
rm -rf .venv
uv venv >/dev/null
echo ""
fi
FAILED_PACKAGES=()
PASSED_PACKAGES=()
if just test-dev "$PY"; then
PASSED_PACKAGES+=("ap-dev")
else
FAILED_PACKAGES+=("ap-dev")
fi
for pkg in ap-core ap-codegen ap-frontend ap-storage ap-audit ap-ui ap-pdf ap-server-choices ap-ordered-model; do
echo -e "${BOLD}${GREEN}═══════════════════════════════════════════════════${RESET}"
echo -e "${BOLD}${GREEN}Testing $pkg${RESET}"
echo -e "${BOLD}${GREEN}═══════════════════════════════════════════════════${RESET}"
PACKAGE_NAME="alliance-platform-${pkg#ap-}"
# Install package and dependencies (including dev group)
echo -e "${YELLOW}Installing dependencies...${RESET}"
if [[ -n "$CONSTRAINT" ]]; then
# Use override to replace Django version while preserving dev dependencies
if ! uv export --no-hashes --package "$PACKAGE_NAME" | UV_OVERRIDE="constraints/${CONSTRAINT}.txt" uv pip install -r - >/dev/null 2>&1; then
echo -e "${RED}✗ Failed to install $pkg${RESET}"
FAILED_PACKAGES+=("$pkg")
echo ""
continue
fi
else
if ! uv export --no-hashes --package "$PACKAGE_NAME" | uv pip install -r - >/dev/null 2>&1; then
echo -e "${RED}✗ Failed to install $pkg${RESET}"
FAILED_PACKAGES+=("$pkg")
echo ""
continue
fi
fi
# Run tests
if cd "packages/$pkg" && uv run ./manage.py test; then
PASSED_PACKAGES+=("$pkg")
echo -e "${GREEN}✓ $pkg tests passed${RESET}"
else
FAILED_PACKAGES+=("$pkg")
echo -e "${RED}✗ $pkg tests failed${RESET}"
fi
cd ../..
echo ""
done
# Summary
echo -e "${BOLD}${GREEN}═══════════════════════════════════════════════════${RESET}"
echo -e "${BOLD}Test Summary${RESET}"
echo -e "${BOLD}${GREEN}═══════════════════════════════════════════════════${RESET}"
echo -e "${GREEN}Passed: ${#PASSED_PACKAGES[@]}${RESET}"
if [[ ${#PASSED_PACKAGES[@]} -gt 0 ]]; then
for pkg in "${PASSED_PACKAGES[@]}"; do
echo -e " ${GREEN}✓${RESET} $pkg"
done
fi
echo ""
echo -e "${RED}Failed: ${#FAILED_PACKAGES[@]}${RESET}"
if [[ ${#FAILED_PACKAGES[@]} -gt 0 ]]; then
for pkg in "${FAILED_PACKAGES[@]}"; do
echo -e " ${RED}✗${RESET} $pkg"
done
exit 1
fi
# Run mypy for specific package
mypy-package package:
cd packages/{{package}} && uv run mypy .
# Run mypy for all packages
mypy-all:
#!/usr/bin/env bash
set -e
for pkg in ap-core ap-codegen ap-frontend ap-storage ap-audit ap-ui ap-pdf ap-server-choices ap-ordered-model ap-dev; do
echo "Type checking $pkg..."
cd packages/$pkg && uv run mypy .
cd ../..
done
# Run ruff linter
lint:
uv run ruff check
# Run ruff formatter
format:
uv run ruff format
# Check ruff formatting without making changes
format-check:
uv run ruff format --check
# Run specific package's manage.py command
manage package *args:
cd packages/{{package}} && uv run ./manage.py {{args}}
# Regenerate ap-ui HTML parity fixtures and tests/fixtures/css-mappings.json using the
# alliance-platform-js runtime.
# Usage:
# just sync-html-ui-parity-fixtures
# just sync-html-ui-parity-fixtures ../alliance-platform-js button_group
sync-html-ui-parity-fixtures js_repo="../alliance-platform-js" component="":
#!/usr/bin/env bash
set -euo pipefail
if [[ -n "{{component}}" ]]; then
./packages/ap-ui/scripts/syncHtmlUiParityFixtures.sh --js-repo "{{js_repo}}" --component "{{component}}"
else
./packages/ap-ui/scripts/syncHtmlUiParityFixtures.sh --js-repo "{{js_repo}}"
fi
# Check ap-ui HTML parity fixtures and the class mappings they are tested with for drift.
check-html-ui-parity-fixtures js_repo="../alliance-platform-js":
#!/usr/bin/env bash
set -euo pipefail
./packages/ap-ui/scripts/syncHtmlUiParityFixtures.sh --js-repo "{{js_repo}}"
git diff --exit-code -- \
packages/ap-ui/tests/fixtures/ui_html_*_parity.json \
packages/ap-ui/tests/fixtures/css-mappings.json
# Build docs and watch for changes
docs-watch:
./scripts/build-docs.sh
# Build docs as Markdown and sync into the Codex skill references directory
docs-build-skill:
./scripts/build-skill-docs.sh
# Build docs skill and publish it into a .well-known path in a local site root
docs-publish-skill:
./scripts/publish-skill-well-known.sh
# Clean build artifacts
clean:
rm -rf build_artifacts/
rm -rf .venv/
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
# List all available recipes
list:
@just --list