-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmoke.sh
More file actions
executable file
·67 lines (51 loc) · 1.54 KB
/
smoke.sh
File metadata and controls
executable file
·67 lines (51 loc) · 1.54 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
#!/usr/bin/env bash
set -euo pipefail
# One-command release smoke test for lore.
# - Creates an isolated temp workspace + venv
# - Installs the current project as a normal package
# - Runs core CLI checks
#
# Usage:
# ./smoke.sh
# Optional env vars:
# PYTHON_BIN=python3.12 # choose interpreter
# KEEP_SMOKE=1 # keep temp workspace for debugging
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PYTHON_BIN="${PYTHON_BIN:-python3}"
KEEP_SMOKE="${KEEP_SMOKE:-0}"
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then
echo "[smoke] error: interpreter not found: $PYTHON_BIN" >&2
exit 1
fi
SMOKE_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/lore-smoke.XXXXXX")"
VENV_DIR="$SMOKE_ROOT/.venv"
TEST_REPO="$SMOKE_ROOT/project"
cleanup() {
if [[ "$KEEP_SMOKE" == "1" ]]; then
echo "[smoke] keeping workspace: $SMOKE_ROOT"
return
fi
rm -rf "$SMOKE_ROOT"
}
trap cleanup EXIT
echo "[smoke] workspace: $SMOKE_ROOT"
echo "[smoke] python: $PYTHON_BIN"
"$PYTHON_BIN" -m venv "$VENV_DIR"
# shellcheck disable=SC1090
source "$VENV_DIR/bin/activate"
python -m pip install -U pip setuptools wheel
python -m pip install "$ROOT_DIR"
echo "[smoke] step: lore version"
lore version
mkdir -p "$TEST_REPO"
cd "$TEST_REPO"
echo "[smoke] step: lore init"
lore init .
echo "[smoke] step: lore add"
lore add facts "smoke test memory"
echo "[smoke] step: trust refresh (dry run)"
lore trust refresh --dry-run
echo "[smoke] step: export chronicle"
lore export --format chronicle
test -f "$TEST_REPO/CHRONICLE.md"
echo "[smoke] success: CLI smoke test passed"