e93507a09c
Lockfile supply-chain audit / lockfile supply-chain audit (push) Has been cancelled
Windows Studio GGUF CI / GPU prebuilt resolves without Visual Studio (push) Has been cancelled
Windows Studio GGUF CI / setup.ps1 unit tests (VS 2026 / CMake guard) (push) Has been cancelled
Windows Studio GGUF CI / real-VS detection (VS 2022) (push) Has been cancelled
Windows Studio GGUF CI / real-VS detection (VS 2026) (push) Has been cancelled
Windows Studio GGUF CI / VC++ runtime detect + install round-trip (windows-2025-vs2026) (push) Has been cancelled
Windows Studio GGUF CI / VC++ runtime detect + install round-trip (windows-latest) (push) Has been cancelled
Windows Studio Update CI / Studio Updating Tests (push) Has been cancelled
Wheel CI / Wheel build + content sanity + import smoke (push) Has been cancelled
Lint CI / Source lint (Python + shell + YAML + JSON + safety nets) (push) Has been cancelled
MLX CI on Mac M1 / dispatch (push) Has been cancelled
Security audit / advisory audit (pip + npm + cargo) (push) Has been cancelled
Security audit / pip scan-packages :: extras (push) Has been cancelled
Security audit / pip scan-packages :: studio (push) Has been cancelled
Security audit / pip scan-packages :: hf-stack (push) Has been cancelled
Security audit / npm scan-packages (Studio frontend tarballs) (push) Has been cancelled
Security audit / workflow-trigger lint (pull_request_target / cache-poisoning) (push) Has been cancelled
Security audit / pytest tests/security (push) Has been cancelled
Security audit / npm provenance + new install-script diff (push) Has been cancelled
Studio API CI / Studio API & Auth Tests (push) Has been cancelled
Backend CI / (Python 3.10) (push) Has been cancelled
Backend CI / (Python 3.11) (push) Has been cancelled
Backend CI / (Python 3.12) (push) Has been cancelled
Backend CI / (Python 3.13) (push) Has been cancelled
Backend CI / Repo tests (CPU) (push) Has been cancelled
Frontend CI / Frontend build + bundle sanity (push) Has been cancelled
Studio GGUF CI / OpenAI, Anthropic API tests (push) Has been cancelled
Studio GGUF CI / Tool calling Tests (push) Has been cancelled
Studio GGUF CI / JSON, images (push) Has been cancelled
Mac Studio GGUF CI / OpenAI, Anthropic API tests (push) Has been cancelled
Mac Studio GGUF CI / Tool calling Tests (push) Has been cancelled
Mac Studio GGUF CI / JSON, images (push) Has been cancelled
Mac Studio Install Matrix CI / Install + load (macos-14) (push) Has been cancelled
Mac Studio Install Matrix CI / Install + load (macos-15) (push) Has been cancelled
Mac Studio Install Matrix CI / Install + load (macos-26) (push) Has been cancelled
Mac Studio Install Matrix CI / Install + load (macos-15-intel) (push) Has been cancelled
Mac Studio API CI / Studio API & Auth Tests (push) Has been cancelled
Mac Studio Install Matrix CI / Install + load (macos-26-intel) (push) Has been cancelled
Mac Studio UI CI / Chat UI Tests (push) Has been cancelled
Studio Tauri CI / Tauri Linux debug build (no codesign) (push) Has been cancelled
Mac Studio Update CI / Studio Updating Tests (push) Has been cancelled
Studio UI CI / Chat UI Tests (push) Has been cancelled
Windows Studio API CI / Studio API & Auth Tests (push) Has been cancelled
Windows Studio UI CI / Chat UI Tests (push) Has been cancelled
Studio Update CI / Studio Updating Tests (push) Has been cancelled
Core / Core (HF=default + TRL=default) (push) Has been cancelled
Core / Core (HF=4.57.6 + TRL<1) (push) Has been cancelled
Core / Core (HF=latest + TRL=latest) (push) Has been cancelled
Core / llama.cpp build + smoke (push) Has been cancelled
Windows Studio GGUF CI / OpenAI, Anthropic API tests (push) Has been cancelled
Windows Studio GGUF CI / Tool calling Tests (push) Has been cancelled
Windows Studio GGUF CI / JSON, images (push) Has been cancelled
Windows Studio GGUF CI / Studio install + inference without Visual Studio (push) Has been cancelled
Studio export capability / capability (macos-latest) (push) Has been cancelled
Studio export capability / capability (ubuntu-latest) (push) Has been cancelled
Studio export capability / capability (windows-latest) (push) Has been cancelled
Cross-platform parity / parity (macos-latest) (push) Has been cancelled
Cross-platform parity / parity (windows-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Studio load-orchestrator CI / test (push) Has been cancelled
64 lines
2.5 KiB
Bash
64 lines
2.5 KiB
Bash
#!/bin/bash
|
|
# Unit tests for decide_node_source() from studio/setup.sh.
|
|
# Slices the pure function out of setup.sh and exercises the three outcomes:
|
|
# system -- system Node + npm already satisfy Vite 8 (^20.19/22.12/>=23) + npm>=11
|
|
# bundled -- otherwise install an isolated Node (the Discord-reported npm-only case)
|
|
# skip -- UNSLOTH_SKIP_NODE_INSTALL=1 and the system is unsuitable
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
SETUP_SH="$SCRIPT_DIR/../../studio/setup.sh"
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
_FUNC_FILE=$(mktemp)
|
|
sed -n '/^decide_node_source()/,/^}/p' "$SETUP_SH" > "$_FUNC_FILE"
|
|
if [ ! -s "$_FUNC_FILE" ]; then
|
|
echo "FAIL: could not extract decide_node_source from $SETUP_SH"
|
|
exit 1
|
|
fi
|
|
# shellcheck disable=SC1090
|
|
. "$_FUNC_FILE"
|
|
|
|
assert_decision() {
|
|
_label="$1"; _node="$2"; _npm="$3"; _skip="$4"; _expected="$5"
|
|
_actual="$(decide_node_source "$_node" "$_npm" "$_skip")"
|
|
if [ "$_actual" = "$_expected" ]; then
|
|
echo " PASS: $_label (node='$_node' npm='$_npm' skip='$_skip' -> $_actual)"
|
|
PASS=$((PASS + 1))
|
|
else
|
|
echo " FAIL: $_label (node='$_node' npm='$_npm' skip='$_skip' expected '$_expected', got '$_actual')"
|
|
FAIL=$((FAIL + 1))
|
|
fi
|
|
}
|
|
|
|
echo "decide_node_source"
|
|
# system: both satisfy
|
|
assert_decision "node22 + npm11" "v22.17.1" "11.13.0" "0" system
|
|
assert_decision "node20.19 + npm11" "v20.19.0" "11.0.0" "0" system
|
|
assert_decision "node24 + npm11" "v24.17.0" "11.13.0" "0" system
|
|
assert_decision "node23 + npm11" "v23.5.0" "11.0.0" "0" system
|
|
|
|
# bundled: the reported bug -- fine Node, stale npm
|
|
assert_decision "node22 + npm10 (bug)" "v22.17.1" "10.9.2" "0" bundled
|
|
# bundled: node too old / wrong line
|
|
assert_decision "node18" "v18.20.0" "11.0.0" "0" bundled
|
|
assert_decision "node22.11 (<22.12)" "v22.11.0" "11.0.0" "0" bundled
|
|
assert_decision "node20.18 (<20.19)" "v20.18.0" "11.0.0" "0" bundled
|
|
assert_decision "node21 (odd)" "v21.7.0" "11.0.0" "0" bundled
|
|
# bundled: missing entirely
|
|
assert_decision "no node/npm" "" "" "0" bundled
|
|
# bundled: garbage versions
|
|
assert_decision "garbage versions" "vfoo" "bar" "0" bundled
|
|
|
|
# skip: unsuitable + skip flag
|
|
assert_decision "npm10 + skip" "v22.17.1" "10.9.2" "1" skip
|
|
assert_decision "missing + skip" "" "" "1" skip
|
|
# skip flag does NOT override an already-good system
|
|
assert_decision "good system + skip" "v22.17.1" "11.13.0" "1" system
|
|
|
|
rm -f "$_FUNC_FILE"
|
|
echo ""
|
|
echo "Passed: $PASS Failed: $FAIL"
|
|
[ "$FAIL" -eq 0 ] || exit 1
|