@@ -6,17 +6,19 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
66
77OUTPUT_DIR=" ${REPO_ROOT} /.uat_local"
88RELEASE_VERSION=" ${PROOF_UAT_RELEASE_VERSION:- } "
9+ RUN_BREW_PATH=" ${PROOF_UAT_BREW:- 0} "
910
1011usage () {
1112 cat << 'EOF '
1213Run local end-to-end UAT for Proof.
1314
1415Usage:
15- test_uat_local.sh [--output-dir <path>] [--release-version <tag>]
16+ test_uat_local.sh [--output-dir <path>] [--release-version <tag>] [--brew]
1617
1718Options:
1819 --output-dir <path> UAT artifacts directory (default: .uat_local)
1920 --release-version <tag> Optional GitHub release tag to validate release binary path
21+ --brew Validate Homebrew install path (requires --release-version)
2022 -h, --help Show this help
2123EOF
2224}
@@ -33,6 +35,10 @@ while [[ $# -gt 0 ]]; do
3335 RELEASE_VERSION=" $2 "
3436 shift 2
3537 ;;
38+ --brew)
39+ RUN_BREW_PATH=1
40+ shift
41+ ;;
3642 -h|--help)
3743 usage
3844 exit 0
@@ -231,10 +237,25 @@ create_local_release_archive() {
231237extract_release_binary () {
232238 local release_dir=" $1 "
233239 local extraction_dir=" $2 "
240+ local platform_suffix=" ${3:- } "
241+ rm -rf " ${extraction_dir} "
234242 mkdir -p " ${extraction_dir} "
235243
236244 local archive
237- archive=" $( find " ${release_dir} " -maxdepth 1 -type f \( -name ' *.tar.gz' -o -name ' *.zip' \) | head -n1 || true) "
245+ if [[ -n " ${platform_suffix} " ]]; then
246+ archive=" $(
247+ find " ${release_dir} " -maxdepth 1 -type f \( -name ' *.tar.gz' -o -name ' *.zip' \) | sort | while IFS= read -r path; do
248+ base=" $( basename " ${path} " ) "
249+ if [[ " ${base} " == * " _${platform_suffix} .tar.gz" || " ${base} " == * " _${platform_suffix} .zip" ]]; then
250+ printf ' %s\n' " ${path} "
251+ break
252+ fi
253+ done
254+ ) "
255+ fi
256+ if [[ -z " ${archive:- } " ]]; then
257+ archive=" $( find " ${release_dir} " -maxdepth 1 -type f \( -name ' *.tar.gz' -o -name ' *.zip' \) | sort | head -n1 || true) "
258+ fi
238259 if [[ -z " ${archive} " ]]; then
239260 return 1
240261 fi
@@ -255,6 +276,66 @@ extract_release_binary() {
255276 return 0
256277}
257278
279+ host_release_platform_suffix () {
280+ local os
281+ local arch
282+
283+ case " $( uname -s) " in
284+ Darwin) os=" darwin" ;;
285+ Linux) os=" linux" ;;
286+ MINGW* |MSYS* |CYGWIN* ) os=" windows" ;;
287+ * ) return 1 ;;
288+ esac
289+
290+ case " $( uname -m) " in
291+ x86_64|amd64) arch=" amd64" ;;
292+ arm64|aarch64) arch=" arm64" ;;
293+ * ) return 1 ;;
294+ esac
295+
296+ printf ' %s_%s' " ${os} " " ${arch} "
297+ }
298+
299+ resolve_brew_binary_path () {
300+ local linked_prefix
301+ local keg_prefix
302+
303+ linked_prefix=" $( brew --prefix 2> /dev/null || true) "
304+ if [[ -n " ${linked_prefix} " && -x " ${linked_prefix} /bin/proof" ]]; then
305+ printf ' %s' " ${linked_prefix} /bin/proof"
306+ return 0
307+ fi
308+
309+ keg_prefix=" $( brew --prefix proof 2> /dev/null || true) "
310+ if [[ -n " ${keg_prefix} " && -x " ${keg_prefix} /bin/proof" ]]; then
311+ printf ' %s' " ${keg_prefix} /bin/proof"
312+ return 0
313+ fi
314+
315+ return 1
316+ }
317+
318+ run_brew_install_path_suite () {
319+ local release_version=" $1 "
320+ local artifacts_dir=" $2 "
321+ local brew_bin
322+ local expected_version
323+
324+ require_cmd brew
325+ run_step " brew_tap" brew tap Clyra-AI/homebrew-tap
326+ run_step " brew_install" bash -lc " set -euo pipefail; if brew list --versions proof >/dev/null 2>&1; then brew reinstall Clyra-AI/homebrew-tap/proof; else brew install Clyra-AI/homebrew-tap/proof; fi"
327+
328+ brew_bin=" $( resolve_brew_binary_path || true) "
329+ if [[ -z " ${brew_bin} " ]]; then
330+ log " FAIL brew_binary_resolve (proof binary not found after brew install)"
331+ exit 1
332+ fi
333+
334+ expected_version=" ${release_version# v} "
335+ run_step " brew_expected_version" bash -lc " \" ${brew_bin} \" --version | grep -F \" ${expected_version} \" "
336+ run_binary_contract_suite " brew" " ${brew_bin} " " ${artifacts_dir} "
337+ }
338+
258339require_cmd go
259340require_cmd python3
260341
@@ -310,10 +391,11 @@ if [[ -n "${RELEASE_VERSION}" ]]; then
310391 require_cmd gh
311392 RELEASE_DIR=" ${OUTPUT_DIR} /release"
312393 mkdir -p " ${RELEASE_DIR} "
313- run_step " release_download" gh release download " ${RELEASE_VERSION} " -R Clyra-AI/proof -D " ${RELEASE_DIR} "
394+ run_step " release_download" gh release download " ${RELEASE_VERSION} " -R Clyra-AI/proof -D " ${RELEASE_DIR} " --clobber
314395
315396 RELEASE_EXTRACT_DIR=" ${OUTPUT_DIR} /release_extract"
316- RELEASE_BIN=" $( extract_release_binary " ${RELEASE_DIR} " " ${RELEASE_EXTRACT_DIR} " || true) "
397+ RELEASE_PLATFORM_SUFFIX=" $( host_release_platform_suffix || true) "
398+ RELEASE_BIN=" $( extract_release_binary " ${RELEASE_DIR} " " ${RELEASE_EXTRACT_DIR} " " ${RELEASE_PLATFORM_SUFFIX} " || true) "
317399 if [[ -z " ${RELEASE_BIN} " ]]; then
318400 log " FAIL release_binary_extract (no proof binary found in downloaded release assets)"
319401 exit 1
@@ -323,4 +405,14 @@ else
323405 log " SKIP release path checks (set --release-version to enable)"
324406fi
325407
408+ if [[ " ${RUN_BREW_PATH} " == " 1" ]]; then
409+ if [[ -z " ${RELEASE_VERSION} " ]]; then
410+ log " FAIL brew install path checks require --release-version"
411+ exit 1
412+ fi
413+ run_brew_install_path_suite " ${RELEASE_VERSION} " " ${ARTIFACTS_DIR} "
414+ else
415+ log " SKIP brew install path checks (pass --brew to enable)"
416+ fi
417+
326418log " UAT COMPLETE: PASS"
0 commit comments