Skip to content

Commit e1bbbd6

Browse files
Merge branch 'dev' into main
2 parents 34292d4 + 6553071 commit e1bbbd6

18 files changed

Lines changed: 457 additions & 61 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
name: Build and Release
1+
name: Build Release
22

33
on:
44
push:
55
branches:
66
- main
7-
- dev
8-
paths-ignore:
9-
- 'docs/**'
10-
- mkdocs.yml
11-
pull_request:
12-
branches:
13-
- main
14-
- dev
157
paths-ignore:
168
- 'docs/**'
179
- mkdocs.yml
@@ -39,6 +31,15 @@ jobs:
3931
- name: Build
4032
run: dotnet build --configuration Release --no-restore
4133

34+
- name: Run tests with code coverage
35+
run: dotnet test --no-build --verbosity normal --results-directory "./TestResults/Coverage/" --collect:"XPlat Code Coverage"
36+
37+
- name: Upload test results artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: test-results
41+
path: '**/TestResults/**'
42+
4243
- name: Performance Test
4344
run: dotnet run --project SharpVectorPerformance --configuration Release
4445

.github/workflows/dotnet-tests.yml

Lines changed: 135 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
name: .NET Tests
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- dev
8-
paths-ignore:
9-
- 'docs/**'
10-
- 'mkdocs.yml'
114
pull_request:
125
branches:
136
- main
@@ -18,7 +11,7 @@ on:
1811
workflow_dispatch:
1912

2013
jobs:
21-
build:
14+
tests:
2215
runs-on: ubuntu-latest
2316
defaults:
2417
run:
@@ -40,10 +33,143 @@ jobs:
4033
run: dotnet build --no-restore
4134

4235
- name: Run tests with code coverage
43-
run: dotnet test --no-build --verbosity normal --results-directory "./TestResults/Coverage/" --collect:"XPlat Code Coverage"
36+
run: dotnet test --no-build --verbosity normal --results-directory "./TestResults/Coverage/" --logger "trx;LogFileName=test_results.trx" --collect:"XPlat Code Coverage"
37+
38+
# - name: Publish test results
39+
# uses: dorny/test-reporter@v1
40+
# with:
41+
# name: tests
42+
# path: src/TestResults/Coverage/test_results.trx
43+
# reporter: dotnet-trx
44+
# fail-on-error: true
4445

4546
- name: Upload test results artifact
4647
uses: actions/upload-artifact@v4
4748
with:
4849
name: test-results
4950
path: '**/TestResults/**'
51+
52+
53+
54+
55+
- name: Install xmlstarlet
56+
run: sudo apt-get update && sudo apt-get install -y xmlstarlet
57+
58+
- name: Summarize test results from .trx
59+
run: |
60+
TRX_FILE="TestResults/Coverage/test_results.trx"
61+
62+
# Register the namespace (ns) and query using that
63+
PASSED=$(xmlstarlet sel -N ns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" -t -v "count(//ns:UnitTestResult[@outcome='Passed'])" "$TRX_FILE")
64+
FAILED=$(xmlstarlet sel -N ns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" -t -v "count(//ns:UnitTestResult[@outcome='Failed'])" "$TRX_FILE")
65+
SKIPPED=$(xmlstarlet sel -N ns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" -t -v "count(//ns:UnitTestResult[@outcome='NotExectured'])" "$TRX_FILE")
66+
TOTAL=$(xmlstarlet sel -N ns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" -t -v "count(//ns:UnitTestResult)" "$TRX_FILE")
67+
68+
echo "## 🧪 Test Results Summary" >> $GITHUB_STEP_SUMMARY
69+
70+
# Write message based on test outcome
71+
if [ "$FAILED" -eq 0 ]; then
72+
echo "✅ All tests passed!" >> $GITHUB_STEP_SUMMARY
73+
else
74+
echo "❌ $FAILED test(s) failed!" >> $GITHUB_STEP_SUMMARY
75+
fi
76+
77+
BAR_LENGTH=10
78+
79+
make_bar() {
80+
COUNT=$1
81+
TOTAL=$2
82+
CHAR=$3
83+
FILLED=$(( (COUNT * BAR_LENGTH + TOTAL / 2) / TOTAL ))
84+
EMPTY=$(( BAR_LENGTH - FILLED ))
85+
86+
BAR=""
87+
for ((i=0; i<FILLED; i++)); do BAR+="$CHAR"; done
88+
for ((i=0; i<EMPTY; i++)); do BAR+="⬜"; done
89+
echo "$BAR"
90+
}
91+
92+
format_pct() {
93+
COUNT=$1
94+
TOTAL=$2
95+
echo "$(echo "scale=1; $COUNT*100/$TOTAL" | bc)%"
96+
}
97+
98+
PASSED_BAR=$(make_bar $PASSED $TOTAL "🟩")
99+
FAILED_BAR=$(make_bar $FAILED $TOTAL "🟥")
100+
SKIPPED_BAR=$(make_bar $SKIPPED $TOTAL "🟨")
101+
102+
PASSED_PCT=$(format_pct $PASSED $TOTAL)
103+
FAILED_PCT=$(format_pct $FAILED $TOTAL)
104+
SKIPPED_PCT=$(format_pct $SKIPPED $TOTAL)
105+
106+
{
107+
echo ""
108+
echo "| | Count | Percent | |"
109+
echo "|-----------|--------|---------|-------------|"
110+
echo "| ✅ Passed | $PASSED | $PASSED_PCT | $PASSED_BAR |"
111+
echo "| ❌ Failed | $FAILED | $FAILED_PCT | $FAILED_BAR |"
112+
echo "| ➖ Skipped | $SKIPPED | $SKIPPED_PCT | $SKIPPED_BAR |"
113+
echo "| 📊 Total | $TOTAL | | |"
114+
} >> $GITHUB_STEP_SUMMARY
115+
116+
117+
118+
119+
- name: Install ReportGenerator
120+
run: dotnet tool install -g dotnet-reportgenerator-globaltool
121+
122+
- name: Generate Markdown report
123+
run: |
124+
reportgenerator \
125+
-reports:./TestResults/Coverage/**/coverage.cobertura.xml \
126+
-targetdir:./coveragereport \
127+
-reporttypes:MarkdownSummaryGithub
128+
129+
- name: Append coverage to summary
130+
run: |
131+
echo "## Code Coverage Summary" >> $GITHUB_STEP_SUMMARY
132+
cat ./coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
133+
134+
- name: Upload code coverage report
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: CodeCoverage
138+
path: ./src/TestResults/Coverage/**/coverage.cobertura.xml
139+
140+
141+
142+
performance:
143+
runs-on: ubuntu-latest
144+
defaults:
145+
run:
146+
working-directory: src
147+
148+
steps:
149+
- name: Checkout code
150+
uses: actions/checkout@v2
151+
152+
- name: Setup .NET Core
153+
uses: actions/setup-dotnet@v2
154+
with:
155+
dotnet-version: '8.0.x' # Adjust the version as needed
156+
157+
- name: Restore dependencies
158+
run: dotnet restore
159+
160+
- name: Build
161+
run: dotnet build --no-restore
162+
163+
- name: Performance Test
164+
run: dotnet run --project SharpVectorPerformance --configuration Release
165+
166+
- name: Performance Results
167+
run: |
168+
echo "## Performance Results" > $GITHUB_STEP_SUMMARY
169+
cat ./BenchmarkDotNet.Artifacts/results/SharpVectorPerformance.MemoryVectorDatabasePerformance-report-github.md >> $GITHUB_STEP_SUMMARY
170+
171+
- name: Upload Performance artifact
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: performance-results
175+
path: './src/BenchmarkDotNet.Artifacts/*'

.github/workflows/ghpages-mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- .github/workflows/ghpages-mkdocs.yml
1010
- docs/**
1111
- mkdocs.yml
12+
paths-ignore:
13+
- .github/**
1214
workflow_dispatch:
1315

1416
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## vNext
9+
10+
Add:
11+
12+
- Added `IVectorTextResultItem.Similarity` and marked `IVectorTextResultItem.VectorComparison` obsolete. `VectorComparison` will be removed in the future.
13+
- Added more comment metadata to code
14+
815
## v2.1.2
916

1017
Fixed:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
`Build5Nines.SharpVector` is an in-memory vector database library designed for .NET applications. It allows you to store, search, and manage text data using vector representations. The library is customizable and extensible, enabling support for different vector comparison methods, preprocessing techniques, and vectorization strategies.
44

5-
[![.NET Core Tests](https://github.com/Build5Nines/SharpVector/actions/workflows/dotnet-tests.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/dotnet-tests.yml)
6-
[![Build and Release](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml)
5+
[![Release Build](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml)
76
![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/build5nines/sharpvector)
87

98
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

docs/docs/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ description: The lightweight, in-memory, semantic search, text vector database f
66

77
**Build5Nines.SharpVector** is the lightweight, in-memory, semantic search, text vector database built for .NET applications. It enables fast and flexible vector-based similarity search for text data — ideal for search engines, recommendation systems, semantic analysis, and AI-enhanced features.
88

9-
[![.NET Core Tests](https://github.com/Build5Nines/SharpVector/actions/workflows/dotnet-tests.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/dotnet-tests.yml)
10-
[![Build and Release](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml)
9+
[![Release Build](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml/badge.svg)](https://github.com/Build5Nines/SharpVector/actions/workflows/build-release.yml)
1110
![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/build5nines/sharpvector)
1211

1312
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

docs/docs/resources/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Here's a couple helpful tutorial links with additional documentation and example
1313
- [Enhanced In-Memory Text Vector Search in .NET with SharpVector and OpenAI Embeddings](https://build5nines.com/enhanced-in-memory-text-vector-search-in-net-with-sharpvector-and-openai-embeddings/?utm_source=github&utm_medium=sharpvector) by Chris Pietschmann
1414
- [Build a Generative AI + RAG App in C# with Phi-3, ONNX, and SharpVector](https://build5nines.com/build-a-generative-ai-rag-app-in-c-with-phi-3-onnx-and-sharpvector/?utm_source=github&utm_medium=sharpvector) by Chris Pietschmann
1515
- [Implementing Local RAG using Phi-3 ONNX Runtime and Sidecar Pattern on Linux App Service](https://azure.github.io/AppService/2024/09/03/Phi3-vector.html) by Tulika Chaudharie (Principal Product Manager at Microsoft for Azure App Service)
16+
- [Semantic Search PDF Files Locally using .NET / C# and Build5Nines.SharpVector](https://build5nines.com/semantic-search-pdf-files-locally-using-c-and-build5nines-sharpvector/) by Chris Pietschmann

0 commit comments

Comments
 (0)