#!/usr/bin/env bash

if ! command -v pg_validate_extupgrade >/dev/null 2>&1; then
    cat <<'EOF'
warning: pg_validate_extupgrade not found in PATH
ctest will register *_validate_extupgrade_unavailable placeholder tests
instead of real extension-upgrade validation. Those placeholders will fail if
your worktree touches upgrade-sensitive SQL/CMake files. Install it with:

  cargo install --git https://github.com/rjuju/pg_validate_extupgrade pg_validate_extupgrade
EOF
fi

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install build --component h3-pg
ctest --test-dir build --output-on-failure --build-config Release
