Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Check go mod tidy
run: make check-go-mod-tidy

- name: Build Rust library
run: make rust

Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ pre-commit run --all-files
- Use meaningful variable and function names
- Add comments for exported functions and types
- Write unit tests for new functionality
- **Keep Go modules tidy:** Run `go mod tidy` in the appropriate directory after adding or removing dependencies
- For `candle-binding`: `cd candle-binding && go mod tidy`
- For `src/semantic-router`: `cd src/semantic-router && go mod tidy`
- The CI will automatically check that `go.mod` and `go.sum` files are tidy using `make check-go-mod-tidy`

### Rust Code
- Follow Rust formatting (`cargo fmt`)
Expand All @@ -242,6 +246,11 @@ pre-commit run --all-files
python e2e-tests/run_all_tests.py
```

The `make test` command includes:
- `go vet` for static analysis
- `check-go-mod-tidy` for Go module dependency verification
- Unit tests for all components

2. **Create a pull request** with:
- Clear description of changes
- Reference to any related issues
Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ vet:
@cd candle-binding && go vet ./...
@cd src/semantic-router && go vet ./...

# Check go mod tidy for all Go modules
check-go-mod-tidy:
@echo "Checking go mod tidy for all Go modules..."
@echo "Checking candle-binding..."
@cd candle-binding && go mod tidy && \
(git diff --exit-code go.mod 2>/dev/null || (echo "ERROR: go.mod file is not tidy in candle-binding. Please run 'go mod tidy' in candle-binding directory and commit the changes." && git diff go.mod && exit 1)) && \
(test ! -f go.sum || git diff --exit-code go.sum 2>/dev/null || (echo "ERROR: go.sum file is not tidy in candle-binding. Please run 'go mod tidy' in candle-binding directory and commit the changes." && git diff go.sum && exit 1))
@echo "✅ candle-binding go mod tidy check passed"
@echo "Checking src/semantic-router..."
@cd src/semantic-router && go mod tidy && \
if ! git diff --exit-code go.mod go.sum; then \
echo "ERROR: go.mod or go.sum files are not tidy in src/semantic-router. Please run 'go mod tidy' in src/semantic-router directory and commit the changes."; \
git diff go.mod go.sum; \
exit 1; \
fi
@echo "✅ src/semantic-router go mod tidy check passed"
@echo "✅ All go mod tidy checks passed"

# Test the Rust library
test-binding: rust
@echo "Running Go tests with static library..."
Expand Down Expand Up @@ -92,7 +110,7 @@ test-semantic-router: build-router
cd src/semantic-router && CGO_ENABLED=1 go test -v ./...

# Test the Rust library and the Go binding
test: vet download-models test-binding test-semantic-router
test: vet check-go-mod-tidy download-models test-binding test-semantic-router

# Clean built artifacts
clean:
Expand Down
4 changes: 2 additions & 2 deletions src/semantic-router/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ replace (

require (
github.com/envoyproxy/go-control-plane/envoy v1.32.4
github.com/fsnotify/fsnotify v1.7.0
github.com/onsi/ginkgo/v2 v2.23.4
github.com/onsi/gomega v1.38.0
github.com/openai/openai-go v1.12.0
github.com/prometheus/client_golang v1.23.0
github.com/vllm-project/semantic-router/candle-binding v0.0.0-00010101000000-000000000000
go.uber.org/zap v1.27.0
google.golang.org/grpc v1.71.1
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -24,7 +26,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
Expand All @@ -41,7 +42,6 @@ require (
github.com/tidwall/sjson v1.2.5 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
Expand Down
Loading