summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/publish-check.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/publish-check.sh b/scripts/publish-check.sh
new file mode 100755
index 0000000..b975d60
--- /dev/null
+++ b/scripts/publish-check.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+# Release publish regression guard.
+#
+# `dotnet publish -c Release` fails when a resumable state machine cannot be
+# statically compiled (FS3511) because the API project sets
+# TreatWarningsAsErrors=true. Debug builds never emit it, so this check runs the
+# Release publish and fails if it exits non-zero or reports FS3511.
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+PROJECT="${1:-$ROOT/src/FundLab.Api/FundLab.Api.fsproj}"
+OUT_DIR="$(mktemp -d /tmp/pubcheck-XXXXXX)"
+LOG_FILE="$(mktemp /tmp/pubcheck-XXXXXX.log)"
+trap 'rm -rf "$OUT_DIR" "$LOG_FILE"' EXIT
+
+printf '[publish-check] dotnet publish -c Release %s\n' "$PROJECT"
+
+if ! dotnet publish "$PROJECT" -c Release -o "$OUT_DIR" >"$LOG_FILE" 2>&1; then
+ cat "$LOG_FILE" >&2
+ printf '[publish-check] FAIL: release publish exited non-zero\n' >&2
+ exit 1
+fi
+
+if grep -q "FS3511" "$LOG_FILE"; then
+ grep -n "FS3511" "$LOG_FILE" >&2
+ printf '[publish-check] FAIL: FS3511 present in release publish output\n' >&2
+ exit 1
+fi
+
+printf '[publish-check] PASS: release publish clean (no FS3511)\n'