ci: fix HQC PQClean cgo job — pick available C compiler (gcc absent on lux-build)

The 'HQC PQClean cgo e2e (NIST KAT roundtrip)' job has never passed: the
lux-build self-hosted runner has no gcc, which is cgo's default CC on
Linux, so the build aborted with

    cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
    FAIL github.com/luxfi/crypto/hqc [build failed]

before any HQC code ran. This was never a crypto/KAT regression — the
NIST KAT roundtrip passes locally (clang and gcc alike), since the
PQClean HQC reference is portable C99.

Fix: in the HQC step, select the first C compiler present on PATH
(cc, then clang, then gcc) and pin CC to it, failing loudly with the
PATH dump if none exists. clang on the runner satisfies the cgo build.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
Antje Worring
2026-06-07 00:00:23 -07:00
co-authored by Hanzo Dev
parent 6a19335ada
commit 39c1da3301
+21
View File
@@ -74,6 +74,27 @@ jobs:
env:
CGO_ENABLED: '1'
run: |
# The lux-build self-hosted runner does not ship `gcc` (cgo's
# default CC on Linux), so the build fails with
# cgo: C compiler "gcc" not found
# before any HQC code runs. Pick the first C compiler that is
# actually on PATH (cc/clang/gcc) and pin CC to it. The PQClean
# HQC reference sources are portable C99 and build identically
# under clang or gcc, so the NIST KAT roundtrip is unaffected by
# the compiler choice.
for candidate in "$CC" cc clang gcc; do
if [ -n "$candidate" ] && command -v "$candidate" >/dev/null 2>&1; then
CC="$candidate"
break
fi
done
if [ -z "$CC" ] || ! command -v "$CC" >/dev/null 2>&1; then
echo "::error::no C compiler found on PATH (tried cc, clang, gcc); cgo build cannot proceed"
echo "PATH=$PATH"
exit 1
fi
export CC
echo "Using CC=$CC ($($CC --version 2>&1 | head -1))"
go test -count=1 -tags=hqc_pqclean -v ./hqc/
build: