Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust

ci(go): validate WASM routing bindings (#1131)

Alex Fournierc209a25c366a
diff --git a/.github/workflows/go-bindings.yml b/.github/workflows/go-bindings.yml
index 964ff0bd1..f25af16ad 100644
--- a/.github/workflows/go-bindings.yml
+++ b/.github/workflows/go-bindings.yml
@@ -44,3 +44,39 @@ jobs:
cc testdata/cshared.c -I "$RUNNER_TEMP" -L "$RUNNER_TEMP" \
-Wl,-rpath,"$RUNNER_TEMP" -lswitchyard_smoke -o "$RUNNER_TEMP/shared-host"
"$RUNNER_TEMP/shared-host"
+
+ wasm:
+ name: WASM
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
+ with:
+ go-version-file: bindings/go/go.mod
+ cache-dependency-path: bindings/go/go.sum
+ - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
+ with:
+ cache-bin: false
+ save-if: ${{ github.ref == 'refs/heads/main' }}
+ - name: Build Go WASM module
+ run: |
+ rustup target add wasm32-wasip1
+ cargo build -p switchyard-ffi --target wasm32-wasip1 --release --locked --lib
+ mkdir -p bindings/go/internal/wasm
+ cp target/wasm32-wasip1/release/switchyard_ffi.wasm bindings/go/internal/wasm/switchyard.wasm
+ - name: go test (WASM, no cgo)
+ working-directory: bindings/go
+ env:
+ CGO_ENABLED: "0"
+ run: go test -count=1 ./...
+ - name: go vet (WASM, no cgo)
+ working-directory: bindings/go
+ env:
+ CGO_ENABLED: "0"
+ run: go vet ./...
+ - name: go test (WASM, race)
+ working-directory: bindings/go
+ env:
+ CGO_ENABLED: "1"
+ run: go test -count=1 -race ./...