Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main, develop ]

env:
GO_VERSION: '1.21'
GO_VERSION: '1.23'

jobs:
test:
Expand All @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -37,11 +37,12 @@ jobs:
run: go test -race -covermode=atomic -coverprofile=coverage.out -v ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: Build
Expand All @@ -52,7 +53,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -70,7 +71,7 @@ jobs:
run: ./bin/lil-rag --help

- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: binaries
path: bin/
Expand All @@ -84,13 +85,13 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
Expand All @@ -104,7 +105,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -127,17 +128,17 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Run Gosec Security Scanner
uses: securecodewarrior/github-action-gosec@master
uses: securecodewarrior/github-action-gosec@v1.3.0
with:
args: '-no-fail -fmt sarif -out results.sarif ./...'

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*'

env:
GO_VERSION: '1.21'
GO_VERSION: '1.23'

jobs:
build-and-release:
Expand All @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt

- name: Create release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
/bin/
/dist/

# Example binaries
examples/library/library
examples/profile/profile

# Test binary, built with `go test -c`
*.test

Expand Down
8 changes: 1 addition & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ linters-settings:
goimports:
local-prefixes: lil-rag

golint:
min-confidence: 0.8

goconst:
min-len: 3
min-occurrences: 3
Expand All @@ -61,7 +58,6 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
Expand All @@ -71,7 +67,7 @@ linters:
- gocritic
- gofmt
- goimports
- golint
- revive # replaces golint
- gosec
- gosimple
- govet
Expand All @@ -81,13 +77,11 @@ linters:
- nakedret
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

issues:
Expand Down
8 changes: 4 additions & 4 deletions internal/handlers/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestNew(t *testing.T) {
if err != nil {
t.Fatalf("Failed to create MiniRag: %v", err)
}

handler := New(ragInstance)

if handler == nil {
Expand All @@ -48,12 +48,12 @@ func createTestHandler(t *testing.T) *Handler {
MaxTokens: 100,
Overlap: 20,
}

ragInstance, err := minirag.New(config)
if err != nil {
t.Fatalf("Failed to create MiniRag: %v", err)
}

return New(ragInstance)
}

Expand Down Expand Up @@ -752,4 +752,4 @@ func BenchmarkHandler_Health(b *testing.B) {
b.Fatalf("Expected successful health response, got status %d", w.Code)
}
}
}
}
2 changes: 1 addition & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,4 +453,4 @@ func TestConfig_RoundTrip_YAML(t *testing.T) {
if loadedConfig.Server.Port != originalConfig.Server.Port {
t.Errorf("Server port mismatch: got %d, want %d", loadedConfig.Server.Port, originalConfig.Server.Port)
}
}
}
44 changes: 22 additions & 22 deletions pkg/minirag/chunker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,34 +247,34 @@ func TestTextChunker_getOverlapText(t *testing.T) {
sentences := []string{"First sentence", "Second sentence", "Third sentence", "Fourth sentence"}

tests := []struct {
name string
currentIndex int
name string
currentIndex int
overlapTokens int
expected string
expected string
}{
{
name: "no overlap at start",
currentIndex: 0,
name: "no overlap at start",
currentIndex: 0,
overlapTokens: 2,
expected: "",
expected: "",
},
{
name: "zero overlap tokens",
currentIndex: 2,
name: "zero overlap tokens",
currentIndex: 2,
overlapTokens: 0,
expected: "",
expected: "",
},
{
name: "single sentence overlap",
currentIndex: 2,
name: "single sentence overlap",
currentIndex: 2,
overlapTokens: 2,
expected: "Second sentence",
expected: "Second sentence",
},
{
name: "multiple sentence overlap",
currentIndex: 3,
name: "multiple sentence overlap",
currentIndex: 3,
overlapTokens: 4,
expected: "Second sentence Third sentence",
expected: "Second sentence Third sentence",
},
}

Expand All @@ -292,7 +292,7 @@ func TestTextChunker_findStartPosition(t *testing.T) {
chunker := NewTextChunker(100, 20)

text := "This is a test sentence. This is another sentence."

tests := []struct {
name string
sentence string
Expand Down Expand Up @@ -366,7 +366,7 @@ func TestTextChunker_splitLongChunkByWords(t *testing.T) {
reconstructedWords := strings.Fields(allText.String())

if len(reconstructedWords) < len(originalWords)-2 { // Allow some variation due to overlap
t.Errorf("Lost too many words during splitting: original %d, reconstructed %d",
t.Errorf("Lost too many words during splitting: original %d, reconstructed %d",
len(originalWords), len(reconstructedWords))
}
}
Expand Down Expand Up @@ -395,10 +395,10 @@ func TestTextChunker_splitLongChunkByWords_ShortChunk(t *testing.T) {

func TestGetChunkID(t *testing.T) {
tests := []struct {
name string
documentID string
chunkIndex int
expected string
name string
documentID string
chunkIndex int
expected string
}{
{
name: "first chunk",
Expand Down Expand Up @@ -549,4 +549,4 @@ func TestTextChunker_RealWorldExample(t *testing.T) {
if len(chunkWords) < len(originalWords) {
t.Errorf("Lost words during chunking: original %d, chunks %d", len(originalWords), len(chunkWords))
}
}
}
Loading
Loading