From 8f7f235ddebf4b55570692a342131209386c3095 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Wed, 7 Jan 2026 21:11:42 +0000 Subject: [PATCH] feat: add build tags support for Go tests - Add build-tags input parameter to go-test action - Add build-tags input to go-pr workflow with CGO support - Pass build-tags to go-test action in go-release-cgo workflow - Enable CGO_ENABLED=1 in go-pr test job This allows projects requiring CGO and build tags (e.g., SQLite FTS5) to properly compile and test with sqlite-vec and other CGO dependencies. Fixes test failures for projects using sqlite-vec-go-bindings. --- .github/actions/go-test/action.yml | 12 +++++++++++- .github/workflows/go-pr.yaml | 14 +++++++++++++- .github/workflows/go-release-cgo.yaml | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/actions/go-test/action.yml b/.github/actions/go-test/action.yml index e7042fc..0e713ef 100644 --- a/.github/actions/go-test/action.yml +++ b/.github/actions/go-test/action.yml @@ -10,6 +10,10 @@ inputs: description: "Working directory" required: false default: "." + build-tags: + description: "Build tags to pass to go test (e.g., 'fts5')" + required: false + default: "" runs: using: "composite" @@ -24,4 +28,10 @@ runs: working-directory: ${{ inputs.working-directory }} env: CGO_ENABLED: 1 - run: go test -race -v ./... + run: | + TAGS="${{ inputs.build-tags }}" + if [ -n "$TAGS" ]; then + go test -tags "$TAGS" -race -v ./... + else + go test -race -v ./... + fi diff --git a/.github/workflows/go-pr.yaml b/.github/workflows/go-pr.yaml index 8d46d1a..4aa4f54 100644 --- a/.github/workflows/go-pr.yaml +++ b/.github/workflows/go-pr.yaml @@ -18,6 +18,11 @@ on: required: false type: boolean default: false + build-tags: + description: "Build tags to pass to go test (e.g., 'fts5')" + required: false + type: string + default: "" # Caller must declare these permissions: # permissions: @@ -253,8 +258,15 @@ jobs: cache: true - name: Run tests with coverage + env: + CGO_ENABLED: 1 run: | - go test -race -coverprofile=coverage.out -covermode=atomic ./... + TAGS="${{ inputs.build-tags }}" + if [ -n "$TAGS" ]; then + go test -tags "$TAGS" -race -coverprofile=coverage.out -covermode=atomic ./... + else + go test -race -coverprofile=coverage.out -covermode=atomic ./... + fi go tool cover -func=coverage.out -o=coverage.txt - name: Calculate coverage diff --git a/.github/workflows/go-release-cgo.yaml b/.github/workflows/go-release-cgo.yaml index 07a7de8..6c52e03 100644 --- a/.github/workflows/go-release-cgo.yaml +++ b/.github/workflows/go-release-cgo.yaml @@ -91,6 +91,7 @@ jobs: uses: lukaszraczylo/shared-actions/.github/actions/go-test@main with: go-version: ${{ inputs.go-version }} + build-tags: "fts5" frontend: name: Build Frontend