Files
via/ci-check.sh
Ryan Hamamura 50e368f47b
All checks were successful
CI / Build and Test (push) Successful in 38s
CI / Build and Test (pull_request) Successful in 33s
fix: nil-close bug, stale docs, dead code, and tracked binaries
- Fix potential nil file.Close() panic in devModePersist/devModeRemovePersisted
  by extracting loadDevModeMap/saveDevModeMap helpers with proper defer
- Remove tracked binaries (pathparams 10.8 MB, shake.db 22 MB) and consolidate
  .gitignore with a wildcard pattern covering all 19 examples
- Remove stale reaper reference in README (removed in dc56261), update example
  count from 14 to 19, fix OnChange debounce claim in docs
- Fix typos: "percist"→"persist", "percisted"→"persisted", "tmplates"→"templates"
- Remove dead code: commented import in signal_test.go, unnecessary fmt.Sprintf
  in computed.go, commented picocss imports and no-op Config calls in examples
- Replace go fmt with gofmt -l check in ci-check.sh to fail on unformatted code
  instead of silently reformatting
2026-02-20 09:58:46 -10:00

61 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
set -u
set -o pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
echo "== CI: Check formatting =="
if [ -n "$(gofmt -l .)" ]; then
echo "ERROR: files not formatted:"
gofmt -l .
exit 1
fi
echo "OK: all files formatted"
echo "== CI: Run go vet =="
if ! go vet ./...; then
echo "ERROR: go vet failed."
exit 1
fi
echo "OK: go vet passed"
echo "== CI: Build all packages =="
if ! go build ./...; then
echo "ERROR: go build ./... failed."
exit 1
fi
echo "OK: packages built"
echo "== CI: Build example apps under internal/examples =="
if [ -d "internal/examples" ]; then
count=0
while IFS= read -r -d '' mainfile; do
dir="$(dirname "$mainfile")"
echo "Building $dir"
if ! (cd "$dir" && go build); then
echo "ERROR: example build failed: $dir"
exit 1
fi
count=$((count + 1))
done < <(find internal/examples -type f -name "main.go" -print0)
if [ "$count" -eq 0 ]; then
echo "NOTE: no example main.go files found under internal/examples"
else
echo "OK: built $count example(s)"
fi
else
echo "NOTE: internal/examples not found, skipping example builds"
fi
echo "== CI: Run tests =="
if ! go test ./... 2>&1 | grep -v '\[no test files\]'; then
echo "ERROR: tests failed."
exit 1
fi
echo "SUCCESS: All checks passed."
exit 0