PureYAML/scripts/check-wasm.sh
Mihaela Mihaljevic 58872248d5 fix(scripts): let check-wasm skip when the SDK is absent
check-all.sh defines exit 77 as a non-fatal infrastructure skip and
check-linux.sh already uses it for an unreachable runner, but a missing
wasm SDK hard-failed with exit 2, blocking every push from a machine
without the toolchain. The hosted CI wasm job stays authoritative; a
machine with the SDK installed still fails hard on a real build break.
2026-07-12 13:32:17 +02:00

28 lines
881 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SDK_ID="${SWIFT_WASM_SDK_ID:-swift-6.3.2-RELEASE_wasm}"
SWIFT_SELECTOR="${SWIFT_WASM_SWIFT_SELECTOR:-+6.3.2}"
swift_command() {
if command -v swiftly >/dev/null 2>&1; then
swiftly run swift "$@" "$SWIFT_SELECTOR"
else
swift "$@"
fi
}
if ! swift_command sdk list | grep -qx "$SDK_ID"; then
# A missing SDK is "infrastructure unavailable", the same class as an
# unreachable Linux runner: exit 77 so check-all.sh records a SKIP and
# the authoritative wasm gate runs on hosted CI. A machine with the SDK
# installed still fails hard on a real build break below.
echo "wasm: SKIP (missing Swift SDK '$SDK_ID' on this machine)." >&2
echo "wasm: install the SDK or set SWIFT_WASM_SDK_ID to gate locally." >&2
exit 77
fi
swift_command build --swift-sdk "$SDK_ID"
swift_command build -c release --swift-sdk "$SDK_ID"