diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-07 11:27:43 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-07 11:27:43 +0300 |
| commit | 0d424adfc64da1c61296c66a99162ec68cc4f8d0 (patch) | |
| tree | 2aaaad9e6c5c1886809d213a4bf4f0fe8a5bc3c8 /scripts/coverage.sh | |
| parent | 8889949ad3851bfbf36ff5b73128286d67c88201 (diff) | |
hexai-action: integrate tmux orchestration; add internal/tmux; tests+docs; bump version to v0.7.0v0.7.0
Diffstat (limited to 'scripts/coverage.sh')
| -rwxr-xr-x | scripts/coverage.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 0000000..1492f0f --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Simple coverage helper focusing on new/modified packages. +# Usage: scripts/coverage.sh [packages...] + +pkgs=("$@") +if [ ${#pkgs[@]} -eq 0 ]; then + pkgs=( + "codeberg.org/snonux/hexai/internal/tmux" + "codeberg.org/snonux/hexai/cmd/internal/hexai-action" + ) +fi + +cover_dir="$(mktemp -d)" +trap 'rm -rf "$cover_dir"' EXIT + +echo "Running coverage for packages:" "${pkgs[@]}" + +total=0 +for p in "${pkgs[@]}"; do + out="$cover_dir/$(echo "$p" | tr '/' '_').out" + go test -coverprofile="$out" -covermode=atomic "$p" + echo "--- $p ---" + go tool cover -func="$out" | tail -n1 +done + +echo +echo "Hint: combine coverage across all packages with:" +echo " go test ./... -coverprofile=cover.out && go tool cover -func=cover.out" + |
