-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy pathtest_install_smoke.sh
More file actions
executable file
·104 lines (88 loc) · 3.09 KB
/
test_install_smoke.sh
File metadata and controls
executable file
·104 lines (88 loc) · 3.09 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
#!/bin/bash
# Local equivalent of .github/workflows/install-smoke.yml.
#
# For each install profile, builds the wheel and installs it into a
# clean venv (no dev deps), then runs the smoke test for that profile
# (imports + any per-profile runtime checks). By default runs every
# known profile; pass a profile name to run just one.
#
# Available profiles (must match those in tests/install_smoke/__main__.py):
# base -- `pip install a2a-sdk`
# http-server -- `pip install a2a-sdk[http-server]`
# grpc -- `pip install a2a-sdk[grpc]`
# telemetry -- `pip install a2a-sdk[telemetry]`
# sql -- `pip install a2a-sdk[sql]`
#
# Usage:
# scripts/test_install_smoke.sh [profile] [python-version]
#
# Examples:
# scripts/test_install_smoke.sh # all profiles, default python
# scripts/test_install_smoke.sh '' 3.13 # all profiles on python 3.13
# scripts/test_install_smoke.sh http-server # http-server only
# scripts/test_install_smoke.sh http-server 3.13 # http-server on python 3.13
set -e
set -o pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
ALL_PROFILES=(base http-server grpc telemetry sql)
PROFILE_ARG="${1:-}"
PYTHON_VERSION="${2:-}"
if [ -z "$PROFILE_ARG" ]; then
PROFILES=("${ALL_PROFILES[@]}")
else
PROFILES=("$PROFILE_ARG")
fi
extras_for_profile() {
case "$1" in
base) echo "" ;;
http-server) echo "[http-server]" ;;
grpc) echo "[grpc]" ;;
telemetry) echo "[telemetry]" ;;
sql) echo "[sql]" ;;
*)
echo "Unknown profile '$1'. Available: ${ALL_PROFILES[*]}" >&2
return 1
;;
esac
}
# Validate profiles up-front so we fail fast.
for profile in "${PROFILES[@]}"; do
extras_for_profile "$profile" >/dev/null
done
echo "--- Building wheel ---"
rm -rf dist
uv build --wheel
WHEEL=$(ls dist/*.whl)
FAILED_PROFILES=()
for profile in "${PROFILES[@]}"; do
extras=$(extras_for_profile "$profile")
venv_dir=".venv-smoke-${profile}"
echo
echo "=================================================================="
echo " Profile: $profile (extras='$extras')"
echo "=================================================================="
echo "--- Creating clean venv at $venv_dir ---"
rm -rf "$venv_dir"
if [ -n "$PYTHON_VERSION" ]; then
uv venv "$venv_dir" --python "$PYTHON_VERSION"
else
uv venv "$venv_dir"
fi
echo "--- Installing built wheel with '$profile' dependencies only ---"
VIRTUAL_ENV="$venv_dir" uv pip install "${WHEEL}${extras}"
echo "--- Installed packages ---"
VIRTUAL_ENV="$venv_dir" uv pip list
echo "--- Running smoke test (imports + runtime checks) ---"
if ! "$venv_dir/bin/python" -m tests.install_smoke "$profile"; then
FAILED_PROFILES+=("$profile")
fi
done
echo
echo "=================================================================="
if [ ${#FAILED_PROFILES[@]} -eq 0 ]; then
echo " All profiles passed: ${PROFILES[*]}"
exit 0
fi
echo " Failed profiles: ${FAILED_PROFILES[*]}" >&2
exit 1