mirror of
https://github.com/mudler/LocalAI.git
synced 2026-05-29 11:07:18 -04:00
- Strict monotonic Go coverage gate (make test-coverage-check, 45% baseline) run in CI; fixes ginkgo dropping all-but-one coverprofile across multiple recursive roots, builds with -tags auth, and folds in the in-process tests/e2e suite via --coverpkg. - React UI e2e coverage (make test-ui-coverage: vite-plugin-istanbul + nyc, nix-provided Chromium) plus e2e specs for 6 previously-untested pages, and a UI coverage gate (make test-ui-coverage-check) with a small tolerance since e2e line coverage jitters ~0.5pp run-to-run. - pre-commit hook: lint + coverage on Go changes, Playwright e2e + UI coverage gate on react-ui changes; install with make install-hooks. - New Go handler tests (settings, branding), hermetic base64 download test. - fix(ui): model editor reads vram_display (snake_case), so the VRAM estimate renders again; covered by a regression test. Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Richard Palethorpe <io@richiejp.com>
47 lines
1.7 KiB
Bash
Executable File
47 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
#
|
|
# Ensure a Chromium is available for the Playwright e2e suite, with an
|
|
# actionable error instead of a cryptic apt failure.
|
|
#
|
|
# Resolution order:
|
|
# 1. PLAYWRIGHT_CHROMIUM_PATH set -> use it (the nix flake dev shell exports
|
|
# this; playwright.config.js reads it). Just validate it's executable.
|
|
# 2. apt-get available (CI/Debian) -> `playwright install --with-deps chromium`.
|
|
# 3. otherwise -> fail with guidance (e.g. NixOS without
|
|
# the dev shell, where the downloaded browser can't resolve system libs).
|
|
#
|
|
# Run from core/http/react-ui (so `bunx playwright` resolves the local install).
|
|
set -eu
|
|
|
|
if [ -n "${PLAYWRIGHT_CHROMIUM_PATH:-}" ]; then
|
|
if [ ! -x "$PLAYWRIGHT_CHROMIUM_PATH" ]; then
|
|
echo "ensure-playwright-browser: PLAYWRIGHT_CHROMIUM_PATH is set but not executable:" >&2
|
|
echo " $PLAYWRIGHT_CHROMIUM_PATH" >&2
|
|
exit 1
|
|
fi
|
|
echo "ensure-playwright-browser: using PLAYWRIGHT_CHROMIUM_PATH ($PLAYWRIGHT_CHROMIUM_PATH)"
|
|
exit 0
|
|
fi
|
|
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
echo "ensure-playwright-browser: installing Playwright Chromium (--with-deps)…"
|
|
exec bunx playwright install --with-deps chromium
|
|
fi
|
|
|
|
cat >&2 <<'MSG'
|
|
ensure-playwright-browser: no Chromium available for Playwright.
|
|
|
|
PLAYWRIGHT_CHROMIUM_PATH is not set, and this system has no apt-get to install
|
|
Playwright's bundled browser with system libraries (e.g. NixOS — the bundled
|
|
browser can't resolve libglib-2.0 and friends).
|
|
|
|
Fix one of:
|
|
• Enter the dev shell: nix develop
|
|
(provides chromium and exports PLAYWRIGHT_CHROMIUM_PATH)
|
|
• Or point at a Chromium yourself:
|
|
export PLAYWRIGHT_CHROMIUM_PATH=/path/to/chromium
|
|
|
|
then re-run. (CI uses the apt-get path automatically.)
|
|
MSG
|
|
exit 1
|