ci(release): native runners per target, enable CGO for tree-sitter bindings (#1)

The v1.0.0 release build failed because go-tree-sitter and
tree-sitter-c-sharp/bindings/go (pulled in transitively by
./cmd/wasmforge via internal/patch) are CGO-only — every .go file in
those packages has `//go:build cgo` constraints, so CGO_ENABLED=0
excludes them entirely and `go build` errors with "build constraints
exclude all Go files".

The dependency landed in commit e760329 (May 27, 2026, AST patcher
Phase 3.1) — after the last successful v0.5.7 release on May 14, so
the CGO_ENABLED=0 cross-compile worked then but silently broke once
tree-sitter joined the import graph.

Fix:
- Switch the build matrix from a single ubuntu-latest runner doing
  4-way cross-compile to one native runner per target: ubuntu-latest
  (linux/amd64), windows-latest (windows/amd64), macos-13 (darwin
  Intel), macos-latest (darwin ARM64). Each runner ships with a
  matching C toolchain (gcc / mingw / clang) for tree-sitter's C core.
- Set CGO_ENABLED=1 in the Build step.

generate-assets and release jobs stay on ubuntu-latest — cmd/gen-build-assets
does not import tree-sitter (verified via `go list -deps`), and the
final action-gh-release step only collects pre-built artifacts.

Note: this fix needs to be cherry-picked into wasmforge-internal as
well so future syncs don't lose it. The two repos currently share this
file byte-for-byte.
This commit is contained in:
michaelweber
2026-06-16 15:24:07 -04:00
committed by GitHub
parent 8cd2c35aeb
commit 4baf319f98
+9 -5
View File
@@ -32,22 +32,26 @@ jobs:
build:
needs: generate-assets
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- goos: windows
goarch: amd64
ext: .exe
- goos: linux
goarch: amd64
ext: ''
runs-on: ubuntu-latest
- goos: windows
goarch: amd64
ext: .exe
runs-on: windows-latest
- goos: darwin
goarch: amd64
ext: ''
runs-on: macos-13
- goos: darwin
goarch: arm64
ext: ''
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
@@ -67,7 +71,7 @@ jobs:
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
CGO_ENABLED: '1'
GOWORK: 'off'
run: go build -trimpath -o wasmforge-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }} ./cmd/wasmforge