#!/bin/sh
# The race gate, as its own reported step. It is not part of `make ci`,
# which AGENTS.md keeps cgo-free; `-race` refuses to build without cgo,
# so this is the one step that sets CGO_ENABLED=1. It builds a test
# binary and never a release.
#
# The guard: `-race` needs a C compiler, and the cloud runner's
# provisioning (amadan/docs/ci-cloud-runner.md) installs the Go
# toolchain and Node and never names one. A step that failed on every
# push would be worse than no step, so this skips loudly instead.
# When somebody confirms cc on the runner, delete the guard — a race
# gate that can silently skip is half a gate.
set -e
if ! command -v cc >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then
	echo "race: SKIPPED — no C compiler on this runner, and -race requires cgo."
	echo "race: install one (apt-get install -y gcc) and delete the guard in .amadan/ci.d/50-race."
	exit 0
fi
exec make race
