ai tools finished
This commit is contained in:
@ -19,12 +19,12 @@ run_if_present() {
|
||||
log "root: $ROOT_DIR"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
log "Step 1/5: frontend dependency check"
|
||||
log "Step 1/7: frontend dependency check"
|
||||
if [[ ! -d "frontend/node_modules" ]]; then
|
||||
log "frontend/node_modules missing; install with: cd frontend && npm install"
|
||||
fi
|
||||
|
||||
log "Step 2/5: frontend lint"
|
||||
log "Step 2/7: frontend lint"
|
||||
if [[ -f "frontend/package.json" ]]; then
|
||||
(
|
||||
cd frontend
|
||||
@ -39,7 +39,7 @@ else
|
||||
log "frontend/package.json not found; skipping"
|
||||
fi
|
||||
|
||||
log "Step 3/5: frontend build"
|
||||
log "Step 3/7: frontend build"
|
||||
if [[ -f "frontend/package.json" ]]; then
|
||||
(
|
||||
cd frontend
|
||||
@ -52,7 +52,20 @@ if [[ -f "frontend/package.json" ]]; then
|
||||
)
|
||||
fi
|
||||
|
||||
log "Step 4/5: backend syntax check"
|
||||
log "Step 4/7: frontend tests"
|
||||
if [[ -f "frontend/package.json" ]]; then
|
||||
(
|
||||
cd frontend
|
||||
if npm run -s test; then
|
||||
log "frontend tests: OK"
|
||||
else
|
||||
log "frontend tests failed"
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
fi
|
||||
|
||||
log "Step 5/7: backend syntax check"
|
||||
PY=""
|
||||
for p in \
|
||||
"$ROOT_DIR/.venv312/bin/python3.12" \
|
||||
@ -67,6 +80,14 @@ for p in \
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$PY" ]]; then
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PY="$(command -v python3)"
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
PY="$(command -v python)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$PY" ]]; then
|
||||
log "using python: $PY"
|
||||
"$PY" -m py_compile "$ROOT_DIR/backend/main.py" "$ROOT_DIR/backend/routers/export.py"
|
||||
@ -75,9 +96,22 @@ else
|
||||
log "no project python found (.venv312/.venv/venv); skipping backend syntax check"
|
||||
fi
|
||||
|
||||
log "Step 5/5: backend health import smoke"
|
||||
log "Step 6/7: backend unit tests"
|
||||
if [[ -n "$PY" ]]; then
|
||||
"$PY" - <<'PYCODE'
|
||||
if find "$ROOT_DIR/backend/tests" -type f -name 'test_*.py' -print -quit 2>/dev/null | grep -q .; then
|
||||
PYTHONPATH="$ROOT_DIR/backend:$ROOT_DIR" "$PY" -m unittest discover -s "$ROOT_DIR/backend/tests" -p 'test_*.py' -v
|
||||
log "backend unit tests: OK"
|
||||
else
|
||||
log "backend unit tests: skipped (no tests found)"
|
||||
fi
|
||||
fi
|
||||
|
||||
log "Step 7/7: backend health import smoke"
|
||||
if [[ -n "$PY" ]]; then
|
||||
if [[ "${SKIP_BACKEND_IMPORT_SMOKE:-0}" == "1" ]]; then
|
||||
log "backend import smoke: skipped (SKIP_BACKEND_IMPORT_SMOKE=1)"
|
||||
else
|
||||
PYTHONPATH="$ROOT_DIR/backend:$ROOT_DIR" "$PY" - <<'PYCODE'
|
||||
import importlib
|
||||
mods = [
|
||||
"backend.main",
|
||||
@ -88,6 +122,7 @@ for m in mods:
|
||||
importlib.import_module(m)
|
||||
print("backend import smoke: OK")
|
||||
PYCODE
|
||||
fi
|
||||
fi
|
||||
|
||||
log "Validation complete"
|
||||
|
||||
Reference in New Issue
Block a user