Skip to content

Commit 1bcbf3a

Browse files
committed
test: add brew install path to local UAT
1 parent 36a84bd commit 1bcbf3a

3 files changed

Lines changed: 98 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ make fmt # Format
397397
make lint # Vet + golangci-lint
398398
make test # Unit tests
399399
make prepush-full # Full gate: lint + test + coverage + contract + integration + e2e + acceptance
400-
make test-uat-local # UAT for source, go-install, and local release-archive install paths
400+
make test-uat-local # UAT for source/go-install/local-release paths; add --brew for Homebrew install path
401401
```
402402

403403
CI pipelines: main, PR, determinism (cross-platform), CodeQL, nightly (hardening + chaos + performance + soak), release (GoReleaser + checksums + SBOM + cosign + SLSA provenance).

cmd/proof/verify_cmd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestVerifyBundleWithManifestSignature(t *testing.T) {
7878

7979
key, err := proof.GenerateSigningKey()
8080
require.NoError(t, err)
81-
_, err = proof.SignBundle(dir, key)
81+
_, err = proof.SignBundleFile(dir, key)
8282
require.NoError(t, err)
8383

8484
out, err := runCLIForTest(t, []string{"verify", "--bundle", "--signatures", "--public-key", hex.EncodeToString(key.Public), dir})

scripts/test_uat_local.sh

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
66

77
OUTPUT_DIR="${REPO_ROOT}/.uat_local"
88
RELEASE_VERSION="${PROOF_UAT_RELEASE_VERSION:-}"
9+
RUN_BREW_PATH="${PROOF_UAT_BREW:-0}"
910

1011
usage() {
1112
cat <<'EOF'
1213
Run local end-to-end UAT for Proof.
1314
1415
Usage:
15-
test_uat_local.sh [--output-dir <path>] [--release-version <tag>]
16+
test_uat_local.sh [--output-dir <path>] [--release-version <tag>] [--brew]
1617
1718
Options:
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
2123
EOF
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() {
231237
extract_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+
258339
require_cmd go
259340
require_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)"
324406
fi
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+
326418
log "UAT COMPLETE: PASS"

0 commit comments

Comments
 (0)