mirror of
https://github.com/lukaszraczylo/shared-actions.git
synced 2026-06-05 22:43:43 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user