Files
zeekay 3bb86da715 Add sdk/: the shared framework, from the private build
The code is the private build's sdk/ with the module path swapped and the
hostnames, private issue refs and incident prose taken out. Its self-contained
tests come with it; the framework's own tests need the private test kits and stay
behind. Builds and vets in this module; needs luxfi/kms v1.12.26.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 20:25:04 -08:00

35 lines
716 B
Go

package kit
import (
"os"
"os/exec"
"testing"
)
// CI reports whether this run is the gate's.
func CI() bool {
for _, name := range []string{"CI", "GITHUB_ACTIONS", "HANZO_CI"} {
if v := os.Getenv(name); v != "" && v != "false" && v != "0" {
return true
}
}
return false
}
// Tool answers the path of each named program, in order.
func Tool(t testing.TB, names ...string) []string {
t.Helper()
paths := make([]string, len(names))
for i, name := range names {
path, err := exec.LookPath(name)
if err != nil {
if CI() {
t.Fatalf("%s is not on the gate's PATH, so this test did not run: %v", name, err)
}
t.Skipf("%s is not installed", name)
}
paths[i] = path
}
return paths
}