From 37fd01fc0619d3d9b8e2d952b305d47ca3680936 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 13 Aug 2025 22:15:05 -0700 Subject: [PATCH] fix: package version parsing when loading from git also fixed other tests, added unit tests as part of CI --- .github/workflows/build.yaml | 3 +++ pkg/agentfs/docker_test.go | 6 ++++-- pkg/agentfs/sdk_version_check.go | 6 ++++++ pkg/agentfs/sdk_version_check_test.go | 18 ++++++++++++++++++ pkg/agentfs/tar.go | 1 + pkg/loadtester/loadtest.go | 2 +- 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a929b85a..bb193ff7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -46,3 +46,6 @@ jobs: with: version: "latest" install-go: false + + - name: Run Go tests + run: go test -v ./... diff --git a/pkg/agentfs/docker_test.go b/pkg/agentfs/docker_test.go index 77c36f90..f13d94a9 100644 --- a/pkg/agentfs/docker_test.go +++ b/pkg/agentfs/docker_test.go @@ -8,8 +8,10 @@ func TestLoadDockerFiles(t *testing.T) { expectedFiles := []string{ "examples/node.Dockerfile", "examples/node.dockerignore", - "examples/python.Dockerfile", - "examples/python.dockerignore", + "examples/python.pip.Dockerfile", + "examples/python.pip.dockerignore", + "examples/python.uv.Dockerfile", + "examples/python.uv.dockerignore", } for _, file := range expectedFiles { diff --git a/pkg/agentfs/sdk_version_check.go b/pkg/agentfs/sdk_version_check.go index c0899f6c..b42a33cc 100644 --- a/pkg/agentfs/sdk_version_check.go +++ b/pkg/agentfs/sdk_version_check.go @@ -134,6 +134,12 @@ func checkPackageInFile(filePath string, projectType ProjectType, pythonMinVersi // parsePythonPackageVersion parses a Python package line and extracts the version func parsePythonPackageVersion(line string) (string, bool) { + // Git URLs don't have traditional versions, so we treat them as "latest" + gitPattern := regexp.MustCompile(`(?i)^livekit-agents(?:\[[^\]]+\])?\s*@\s*git\+`) + if gitPattern.MatchString(line) { + return "latest", true + } + // match with optional extras and version specifiers pattern := regexp.MustCompile(`(?i)^livekit-agents(?:\[[^\]]+\])?\s*([=~>