mirror of
https://github.com/Sea-Haven-Industries/shoc-pr-review-runner.git
synced 2026-10-03 17:43:19 +00:00
46 lines
1.5 KiB
Bash
46 lines
1.5 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Backend clean build/test gates (spec §13.1, Phase 1 scope).
|
||
|
|
#
|
||
|
|
# Mirrors shoc-backend's own governance gates: restore -> Release build -> test.
|
||
|
|
# Backend runtime (startup, health, migrations, API scenarios) is Phase 2 and is
|
||
|
|
# recorded NOT_RUN by generate-evidence.sh.
|
||
|
|
#
|
||
|
|
# Reads: BACKEND_DIR (default $WORKSPACE_DIR/backend),
|
||
|
|
# BACKEND_SOLUTION (default SeaHavenIndustries.sln)
|
||
|
|
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
# shellcheck source=lib.sh
|
||
|
|
source "$SCRIPT_DIR/lib.sh"
|
||
|
|
|
||
|
|
BACKEND_DIR="${BACKEND_DIR:-$WORKSPACE_DIR/backend}"
|
||
|
|
BACKEND_SOLUTION="${BACKEND_SOLUTION:-SeaHavenIndustries.sln}"
|
||
|
|
|
||
|
|
cd "$BACKEND_DIR"
|
||
|
|
[ -f "$BACKEND_SOLUTION" ] || {
|
||
|
|
record_gate backend.restore BLOCKED "solution $BACKEND_SOLUTION not found at checkout"
|
||
|
|
record_gate backend.build BLOCKED "solution not found"
|
||
|
|
record_gate backend.test BLOCKED "solution not found"
|
||
|
|
die "backend solution $BACKEND_SOLUTION not found"
|
||
|
|
}
|
||
|
|
|
||
|
|
overall=0
|
||
|
|
|
||
|
|
if run_gate backend.restore backend-restore.log \
|
||
|
|
dotnet restore "$BACKEND_SOLUTION"; then
|
||
|
|
if run_gate backend.build backend-build.log \
|
||
|
|
dotnet build "$BACKEND_SOLUTION" --configuration Release --no-restore; then
|
||
|
|
run_gate backend.test backend-test.log \
|
||
|
|
dotnet test "$BACKEND_SOLUTION" --configuration Release --no-build --logger "console;verbosity=normal" \
|
||
|
|
|| overall=1
|
||
|
|
else
|
||
|
|
record_gate backend.test BLOCKED "build failed"
|
||
|
|
overall=1
|
||
|
|
fi
|
||
|
|
else
|
||
|
|
record_gate backend.build BLOCKED "restore failed"
|
||
|
|
record_gate backend.test BLOCKED "restore failed"
|
||
|
|
overall=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
exit "$overall"
|