From 34514459ead1be76873f256e1b3325c575fcaac4 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Tue, 12 May 2026 21:21:59 +0200 Subject: [PATCH] ci(release): wire wasi-sdk into build-test-evidence; drop continue-on-error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #269/#271/#272. The spar wasm32-wasip2 build pulls in highs-sys (a C++ solver); building C/C++ for that target needs a full WASI toolchain — a sysroot with libc/libc++/libc++abi plus libclang_rt.builtins-wasm32.a, and a wasm linker. The runner image no longer ships any of it, so even with `lld` (wasm-ld) and wasm-component-ld installed, wasm-ld errored on `crt1.o` / `-lc` / `-lc++`. #272 made the job continue-on-error so the release wasn't blocked (v0.9.0 shipped 8/9 assets, missing only test-evidence.tar.gz). This installs wasi-sdk 25.0 to /opt/wasi-sdk, puts its bin/ on PATH (so wasm-component-ld finds wasm-ld and the cc/cmake build scripts pick up the right clang), and pins CC_/CXX_/AR_wasm32_wasip2 + the wasip2 sysroot via CFLAGS_/CXXFLAGS_wasm32_wasip2 — so both the CMake CXX-ABI probe and the highs-sys compile resolve their headers/libs. `lld` stays as a belt-and-braces wasm-ld source. Drops `continue-on-error` — if test-evidence breaks again it should block the release until fixed. Not verified locally (spar isn't checked out here); the wasip2 sysroot flags or the wasi-sdk version may need a tweak after the first CI run. Alternative for a hermetic toolchain (out of scope here): migrate the spar-wasm build to Bazel rules_wasm_component — a change in the spar repo. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release.yml | 55 ++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97001c4..f13149f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -168,15 +168,6 @@ jobs: build-test-evidence: name: Build test evidence runs-on: ubuntu-latest - # Non-blocking: the test-evidence bundle is a compliance artifact, not - # something users install. Building the spar wasm32-wasip2 assets needs - # a full WASI C/C++ SDK (sysroot + libc/libc++ + clang_rt builtins), - # which the runner image no longer ships — wasm-ld can't find crt1.o / - # -lc / libclang_rt.builtins-wasm32.a even with lld + wasm-component-ld - # installed (#269, #271). Until wasi-sdk is wired in (tracked separately), - # let this job fail without blocking Create GitHub Release — the release - # then ships 8/9 assets (everything except rivet-vX.Y.Z-test-evidence.tar.gz). - continue-on-error: true steps: - uses: actions/checkout@v6 @@ -192,19 +183,49 @@ jobs: with: tool: cargo-nextest,cargo-llvm-cov - # wasm32-wasip2 builds need two linkers that recent toolchains/runner - # images no longer provide out of the box: - # - wasm-component-ld: the WASI Preview 2 component linker (nightly - # stopped bundling it with the target's tools). - # - wasm-ld: the LLVM wasm linker, invoked by clang++ when a C/C++ - # dependency (e.g. highs-sys, pulled in transitively by spar) - # does a CMake CXX-ABI probe targeting wasm. Provided by `lld`. - - name: Install wasm linkers + # The spar wasm32-wasip2 build pulls in highs-sys (a C++ solver), and + # building C/C++ for that target needs a full WASI toolchain: + # - wasm-component-ld: the WASI Preview 2 component linker that cargo + # uses as the wasm32-wasip2 linker (recent nightlies stopped bundling + # it with the target's tools — #269); + # - wasm-ld: the LLVM wasm linker wasm-component-ld and clang++ shell + # out to (`lld` package — #271; also in wasi-sdk's bin/); + # - a WASI sysroot + libc/libc++/libc++abi + libclang_rt.builtins-wasm32.a + # (the runner image no longer ships these, so wasm-ld errored on + # crt1.o / -lc / -lc++). + # wasi-sdk supplies the sysroot + clang/clang++/llvm-ar/wasm-ld. Put its + # bin/ on PATH (so wasm-component-ld can find wasm-ld and the `cc`/`cmake` + # build scripts pick up the right clang), and pin CC_/CXX_/AR_ + + # the wasip2 sysroot so the CMake CXX-ABI probe and the highs-sys compile + # both resolve their headers/libs. `lld` stays as a belt-and-braces + # wasm-ld source. + - name: Install wasm-component-ld + lld run: | sudo apt-get update sudo apt-get install -y lld cargo install --locked wasm-component-ld + - name: Install WASI SDK + env: + WASI_SDK_VERSION: "25.0" + run: | + set -euo pipefail + major="${WASI_SDK_VERSION%%.*}" + url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${major}/wasi-sdk-${WASI_SDK_VERSION}-x86_64-linux.tar.gz" + curl -fsSL "$url" -o /tmp/wasi-sdk.tar.gz + sudo mkdir -p /opt/wasi-sdk + sudo tar -xzf /tmp/wasi-sdk.tar.gz -C /opt/wasi-sdk --strip-components=1 + sysroot="/opt/wasi-sdk/share/wasi-sysroot" + echo "/opt/wasi-sdk/bin" >> "$GITHUB_PATH" + { + echo "WASI_SDK_PATH=/opt/wasi-sdk" + echo "CC_wasm32_wasip2=/opt/wasi-sdk/bin/clang" + echo "CXX_wasm32_wasip2=/opt/wasi-sdk/bin/clang++" + echo "AR_wasm32_wasip2=/opt/wasi-sdk/bin/llvm-ar" + echo "CFLAGS_wasm32_wasip2=--target=wasm32-wasip2 --sysroot=${sysroot}" + echo "CXXFLAGS_wasm32_wasip2=--target=wasm32-wasip2 --sysroot=${sysroot}" + } >> "$GITHUB_ENV" + - name: Build spar WASM assets run: | git clone --depth 1 https://github.com/pulseengine/spar.git ../spar