diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4322473..070e617 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ jobs: needs: test runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - goos: linux @@ -56,6 +57,15 @@ jobs: with: go-version-file: go.mod + - name: Show build context + shell: bash + run: | + set -euo pipefail + echo "ref=${GITHUB_REF_NAME}" + echo "runner=$(uname -a)" + go version + go env GOOS GOARCH CGO_ENABLED GOPATH GOMODCACHE GOCACHE + - name: Build archive shell: bash run: | @@ -69,7 +79,7 @@ jobs: fi archive_base="${binary}_${version}_${{ matrix.goos }}_${{ matrix.goarch }}" mkdir -p "${dist}/${archive_base}" - GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" CGO_ENABLED=0 go build -o "${dist}/${archive_base}/${binary_name}" ./cmd/codegraph + GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" CGO_ENABLED=0 go build -v -x -o "${dist}/${archive_base}/${binary_name}" ./cmd/codegraph cp README.md "${dist}/${archive_base}/README.md" cp LICENSE "${dist}/${archive_base}/LICENSE" if [ "${{ matrix.archive_ext }}" = "zip" ]; then diff --git a/internal/cli/app.go b/internal/cli/app.go index 0728b9e..0d256ec 100644 --- a/internal/cli/app.go +++ b/internal/cli/app.go @@ -26,8 +26,6 @@ import ( "github.com/isink17/codegraph/internal/indexer" "github.com/isink17/codegraph/internal/logging" "github.com/isink17/codegraph/internal/mcp" - "github.com/isink17/codegraph/internal/parser" - tsparser "github.com/isink17/codegraph/internal/parser/treesitter" "github.com/isink17/codegraph/internal/platform" "github.com/isink17/codegraph/internal/query" "github.com/isink17/codegraph/internal/store" @@ -1065,22 +1063,6 @@ func openApp(ctx context.Context, cfg config.Config, repoRoot string) (*App, gra return app, graphRepo{ID: repo.ID, RootPath: repo.RootPath}, repo.ID, nil } -func newDefaultRegistry() *parser.Registry { - return parser.NewRegistry( - tsparser.NewGo(), - tsparser.NewPython(), - tsparser.NewJava(), - tsparser.NewKotlin(), - tsparser.NewCSharp(), - tsparser.NewTypeScript(), - tsparser.NewRust(), - tsparser.NewRuby(), - tsparser.NewSwift(), - tsparser.NewPHP(), - tsparser.NewCpp(), - ) -} - func newEmbedder(cfg config.EmbeddingConfig) embedding.Embedder { if !cfg.Enabled { return nil diff --git a/internal/cli/registry_cgo.go b/internal/cli/registry_cgo.go new file mode 100644 index 0000000..2d400bf --- /dev/null +++ b/internal/cli/registry_cgo.go @@ -0,0 +1,24 @@ +//go:build cgo + +package cli + +import ( + "github.com/isink17/codegraph/internal/parser" + tsparser "github.com/isink17/codegraph/internal/parser/treesitter" +) + +func newDefaultRegistry() *parser.Registry { + return parser.NewRegistry( + tsparser.NewGo(), + tsparser.NewPython(), + tsparser.NewJava(), + tsparser.NewKotlin(), + tsparser.NewCSharp(), + tsparser.NewTypeScript(), + tsparser.NewRust(), + tsparser.NewRuby(), + tsparser.NewSwift(), + tsparser.NewPHP(), + tsparser.NewCpp(), + ) +} diff --git a/internal/cli/registry_nocgo.go b/internal/cli/registry_nocgo.go new file mode 100644 index 0000000..aae2ed3 --- /dev/null +++ b/internal/cli/registry_nocgo.go @@ -0,0 +1,26 @@ +//go:build !cgo + +package cli + +import ( + "github.com/isink17/codegraph/internal/parser" + goparser "github.com/isink17/codegraph/internal/parser/golang" + heuristicparser "github.com/isink17/codegraph/internal/parser/heuristic" + pyparser "github.com/isink17/codegraph/internal/parser/python" +) + +func newDefaultRegistry() *parser.Registry { + return parser.NewRegistry( + goparser.New(), + pyparser.New(), + heuristicparser.NewJava(), + heuristicparser.NewKotlin(), + heuristicparser.NewCSharp(), + heuristicparser.NewTypeScriptJavaScript(), + heuristicparser.NewRust(), + heuristicparser.NewRuby(), + heuristicparser.NewSwift(), + heuristicparser.NewPHP(), + heuristicparser.NewCAndCpp(), + ) +} diff --git a/internal/parser/treesitter/common.go b/internal/parser/treesitter/common.go index 0f69eed..1551ba1 100644 --- a/internal/parser/treesitter/common.go +++ b/internal/parser/treesitter/common.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/cpp_adapter.go b/internal/parser/treesitter/cpp_adapter.go index ca26318..65ee1e9 100644 --- a/internal/parser/treesitter/cpp_adapter.go +++ b/internal/parser/treesitter/cpp_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/csharp_adapter.go b/internal/parser/treesitter/csharp_adapter.go index c5dad09..9b9444b 100644 --- a/internal/parser/treesitter/csharp_adapter.go +++ b/internal/parser/treesitter/csharp_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/go_adapter.go b/internal/parser/treesitter/go_adapter.go index ad09d46..cab3618 100644 --- a/internal/parser/treesitter/go_adapter.go +++ b/internal/parser/treesitter/go_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/java_adapter.go b/internal/parser/treesitter/java_adapter.go index 1417624..5c4b2e8 100644 --- a/internal/parser/treesitter/java_adapter.go +++ b/internal/parser/treesitter/java_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/kotlin_adapter.go b/internal/parser/treesitter/kotlin_adapter.go index 4015771..3dd0275 100644 --- a/internal/parser/treesitter/kotlin_adapter.go +++ b/internal/parser/treesitter/kotlin_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/php_adapter.go b/internal/parser/treesitter/php_adapter.go index 62f9bdb..549f954 100644 --- a/internal/parser/treesitter/php_adapter.go +++ b/internal/parser/treesitter/php_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/python_adapter.go b/internal/parser/treesitter/python_adapter.go index d7d00e3..aba620b 100644 --- a/internal/parser/treesitter/python_adapter.go +++ b/internal/parser/treesitter/python_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/ruby_adapter.go b/internal/parser/treesitter/ruby_adapter.go index f611b59..29cf1a8 100644 --- a/internal/parser/treesitter/ruby_adapter.go +++ b/internal/parser/treesitter/ruby_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/rust_adapter.go b/internal/parser/treesitter/rust_adapter.go index 57ba62a..40f126e 100644 --- a/internal/parser/treesitter/rust_adapter.go +++ b/internal/parser/treesitter/rust_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/swift_adapter.go b/internal/parser/treesitter/swift_adapter.go index 13eb547..617a301 100644 --- a/internal/parser/treesitter/swift_adapter.go +++ b/internal/parser/treesitter/swift_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import ( diff --git a/internal/parser/treesitter/typescript_adapter.go b/internal/parser/treesitter/typescript_adapter.go index dc6f67c..7eda10c 100644 --- a/internal/parser/treesitter/typescript_adapter.go +++ b/internal/parser/treesitter/typescript_adapter.go @@ -1,3 +1,5 @@ +//go:build cgo + package treesitter import (