Skip to content

Commit 7ddfa46

Browse files
committed
Raised version
2 parents 1de9b15 + 3a580e2 commit 7ddfa46

File tree

5 files changed

+134
-54
lines changed

5 files changed

+134
-54
lines changed

.github/workflows/main.yml

Lines changed: 76 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
runs-on: ${{ matrix.os }}
1212
container: ${{ matrix.container && matrix.container || '' }}
13-
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'ios-sim' && matrix.name != 'ios' && matrix.name != 'apple-xcframework' && matrix.name != 'android-aar' && ' + test' || ''}}
13+
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'ios-sim' && matrix.name != 'ios' && matrix.name != 'apple-xcframework' && matrix.name != 'android-aar' && ( matrix.name != 'macos' || matrix.arch != 'x86_64' ) && ' + test' || ''}}
1414
timeout-minutes: 20
1515
strategy:
1616
fail-fast: false
@@ -31,6 +31,14 @@ jobs:
3131
name: linux-musl
3232
- os: macos-15
3333
name: macos
34+
- os: macos-15
35+
arch: x86_64
36+
name: macos
37+
make: ARCH=x86_64
38+
- os: macos-15
39+
arch: arm64
40+
name: macos
41+
make: ARCH=arm64
3442
- os: windows-2022
3543
arch: x86_64
3644
name: windows
@@ -171,7 +179,7 @@ jobs:
171179
adb shell "sh /data/local/tmp/commands.sh"
172180
173181
- name: test sqlite-vector
174-
if: contains(matrix.name, 'linux') || matrix.name == 'windows' || matrix.name == 'macos'
182+
if: contains(matrix.name, 'linux') || matrix.name == 'windows' || ( matrix.name == 'macos' && matrix.arch != 'x86_64' )
175183
run: ${{ matrix.name == 'linux-musl' && matrix.arch == 'arm64' && 'docker exec alpine' || '' }} make test ${{ matrix.make && matrix.make || ''}}
176184

177185
- uses: actions/upload-artifact@v4.6.2
@@ -198,12 +206,76 @@ jobs:
198206
with:
199207
path: artifacts
200208

209+
- name: zip artifacts
210+
run: |
211+
VERSION=$(make version)
212+
for folder in "artifacts"/*; do
213+
if [ -d "$folder" ]; then
214+
name=$(basename "$folder")
215+
if [[ "$name" != "vector-apple-xcframework" && "$name" != "vector-android-aar" ]]; then
216+
tar -czf "${name}-${VERSION}.tar.gz" -C "$folder" .
217+
fi
218+
if [[ "$name" != "vector-android-aar" ]]; then
219+
(cd "$folder" && zip -rq "../../${name}-${VERSION}.zip" .)
220+
else
221+
cp "$folder"/*.aar "${name}-${VERSION}.aar"
222+
fi
223+
fi
224+
done
225+
201226
- name: release tag version from sqlite-vector.h
202227
id: tag
203228
run: |
204229
VERSION=$(make version)
205230
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
206-
LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
231+
LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
232+
LATEST=$(echo "$LATEST_RELEASE" | jq -r '.name')
233+
234+
# Check artifact sizes against previous release
235+
if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
236+
echo "Checking artifact sizes against previous release: $LATEST"
237+
FAILED=0
238+
239+
for artifact in vector-*-${VERSION}.*; do
240+
if [ ! -f "$artifact" ]; then
241+
continue
242+
fi
243+
244+
# Get current artifact size
245+
NEW_SIZE=$(stat -c%s "$artifact" 2>/dev/null || stat -f%z "$artifact")
246+
247+
# Get artifact name for previous release
248+
ARTIFACT_NAME=$(echo "$artifact" | sed "s/${VERSION}/${LATEST}/")
249+
250+
# Get previous artifact size from GitHub API
251+
OLD_SIZE=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name == \"$(basename "$ARTIFACT_NAME")\") | .size")
252+
253+
if [ -z "$OLD_SIZE" ] || [ "$OLD_SIZE" = "null" ]; then
254+
echo "⚠️ Previous artifact not found: $(basename "$ARTIFACT_NAME"), skipping comparison"
255+
continue
256+
fi
257+
258+
# Calculate percentage increase
259+
INCREASE=$(awk "BEGIN {printf \"%.2f\", (($NEW_SIZE - $OLD_SIZE) / $OLD_SIZE) * 100}")
260+
261+
echo "📦 $artifact: $OLD_SIZE → $NEW_SIZE bytes (${INCREASE}% change)"
262+
263+
# Check if increase is more than 5%
264+
if (( $(echo "$INCREASE > 5" | bc -l) )); then
265+
echo "❌ ERROR: $artifact size increased by ${INCREASE}% (limit: 5%)"
266+
FAILED=1
267+
fi
268+
done
269+
270+
if [ $FAILED -eq 1 ]; then
271+
echo ""
272+
echo "❌ One or more artifacts exceeded the 5% size increase limit"
273+
exit 1
274+
fi
275+
276+
echo "✅ All artifacts within 5% size increase limit"
277+
fi
278+
207279
if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
208280
echo "version=$VERSION" >> $GITHUB_OUTPUT
209281
else
@@ -234,23 +306,6 @@ jobs:
234306
git add modules/sqlite-vector
235307
git commit -m "Bump sqlite-vector version to ${{ steps.tag.outputs.version }}"
236308
git push origin main
237-
238-
- name: zip artifacts
239-
if: steps.tag.outputs.version != ''
240-
run: |
241-
for folder in "artifacts"/*; do
242-
if [ -d "$folder" ]; then
243-
name=$(basename "$folder")
244-
if [[ "$name" != "vector-apple-xcframework" && "$name" != "vector-android-aar" ]]; then
245-
tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" .
246-
fi
247-
if [[ "$name" != "vector-android-aar" ]]; then
248-
(cd "$folder" && zip -rq "../../${name}-${{ steps.tag.outputs.version }}.zip" .)
249-
else
250-
cp "$folder"/*.aar "${name}-${{ steps.tag.outputs.version }}.aar"
251-
fi
252-
fi
253-
done
254309
255310
- uses: actions/setup-java@v4
256311
if: steps.tag.outputs.version != ''
@@ -260,12 +315,7 @@ jobs:
260315

261316
- name: release android aar to maven central
262317
if: steps.tag.outputs.version != ''
263-
run: cd packages/android && ./gradlew publishToCentralPortal -PVERSION=${{ steps.tag.outputs.version }}
264-
env:
265-
SONATYPE_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
266-
SONATYPE_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
267-
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
268-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
318+
run: cd packages/android && ./gradlew publishAggregationToCentralPortal -PSIGNING_KEY="${{ secrets.SIGNING_KEY }}" -PSIGNING_PASSWORD="${{ secrets.SIGNING_PASSWORD }}" -PSONATYPE_USERNAME="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PSONATYPE_PASSWORD="${{ secrets.MAVEN_CENTRAL_TOKEN }}" -PVERSION="${{ steps.tag.outputs.version }}" -PAAR_PATH="../../artifacts/vector-android-aar/vector.aar"
269319

270320
- uses: softprops/action-gh-release@v2.2.1
271321
if: steps.tag.outputs.version != ''

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@ ifeq ($(PLATFORM),windows)
4848
STRIP = strip --strip-unneeded $@
4949
else ifeq ($(PLATFORM),macos)
5050
TARGET := $(DIST_DIR)/vector.dylib
51-
LDFLAGS += -arch x86_64 -arch arm64 -dynamiclib -undefined dynamic_lookup
52-
CFLAGS += -arch x86_64 -arch arm64
51+
ifndef ARCH
52+
LDFLAGS += -arch x86_64 -arch arm64
53+
CFLAGS += -arch x86_64 -arch arm64
54+
else
55+
LDFLAGS += -arch $(ARCH)
56+
CFLAGS += -arch $(ARCH)
57+
endif
58+
LDFLAGS += -dynamiclib -undefined dynamic_lookup -headerpad_max_install_names
5359
STRIP = strip -x -S $@
5460
else ifeq ($(PLATFORM),android)
5561
ifndef ARCH # Set ARCH to find Android NDK's Clang compiler, the user should set the ARCH
@@ -69,13 +75,13 @@ else ifeq ($(PLATFORM),android)
6975
else ifeq ($(PLATFORM),ios)
7076
TARGET := $(DIST_DIR)/vector.dylib
7177
SDK := -isysroot $(shell xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=11.0
72-
LDFLAGS += -dynamiclib $(SDK)
78+
LDFLAGS += -dynamiclib $(SDK) -headerpad_max_install_names
7379
CFLAGS += -arch arm64 $(SDK)
7480
STRIP = strip -x -S $@
7581
else ifeq ($(PLATFORM),ios-sim)
7682
TARGET := $(DIST_DIR)/vector.dylib
7783
SDK := -isysroot $(shell xcrun --sdk iphonesimulator --show-sdk-path) -miphonesimulator-version-min=11.0
78-
LDFLAGS += -arch x86_64 -arch arm64 -dynamiclib $(SDK)
84+
LDFLAGS += -arch x86_64 -arch arm64 -dynamiclib $(SDK) -headerpad_max_install_names
7985
CFLAGS += -arch x86_64 -arch arm64 $(SDK)
8086
STRIP = strip -x -S $@
8187
else # linux

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ Download the appropriate pre-built binary for your platform from the official [R
4040
- Android
4141
- iOS
4242

43+
### Loading the Extension
44+
45+
```sql
46+
-- In SQLite CLI
47+
.load ./vector
48+
49+
-- In SQL
50+
SELECT load_extension('./vector');
51+
```
52+
53+
Or embed it directly into your application.
54+
4355
### WASM Version
4456

4557
You can download the WebAssembly (WASM) version of SQLite with the SQLite Vector extension enabled from: https://www.npmjs.com/package/@sqliteai/sqlite-wasm
@@ -67,17 +79,28 @@ log("vector_version(): \(String(cString: sqlite3_column_text(stmt, 0)))")
6779
sqlite3_close(db)
6880
```
6981

70-
### Loading the Extension
82+
### Android Package
7183

72-
```sql
73-
-- In SQLite CLI
74-
.load ./vector
84+
Add the [following](https://central.sonatype.com/artifact/ai.sqlite/vector) to your Gradle dependencies:
7585

76-
-- In SQL
77-
SELECT load_extension('./vector');
86+
```gradle
87+
implementation 'ai.sqlite:vector:0.9.34'
7888
```
7989

80-
Or embed it directly into your application.
90+
Here's an example of how to use the package:
91+
```java
92+
SQLiteCustomExtension vectorExtension = new SQLiteCustomExtension(getApplicationInfo().nativeLibraryDir + "/vector", null);
93+
SQLiteDatabaseConfiguration config = new SQLiteDatabaseConfiguration(
94+
getCacheDir().getPath() + "/vector_test.db",
95+
SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE,
96+
Collections.emptyList(),
97+
Collections.emptyList(),
98+
Collections.singletonList(vectorExtension)
99+
);
100+
SQLiteDatabase db = SQLiteDatabase.openDatabase(config, null, null);
101+
```
102+
103+
**Note:** Additional settings and configuration are required for a complete setup. For full implementation details, see the [complete Android example](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/android/README.md).
81104

82105
### Python Package
83106

packages/android/build.gradle

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
}
1010

1111
plugins {
12-
id 'com.gradleup.nmcp' version '1.2.0'
12+
id 'com.gradleup.nmcp.aggregation' version '1.2.0'
1313
}
1414

1515
apply plugin: 'com.android.library'
@@ -60,7 +60,7 @@ afterEvaluate {
6060
artifactId = 'vector'
6161
version = project.hasProperty('VERSION') ? project.VERSION : ['make', 'version'].execute(null, file('../..')).text.trim()
6262

63-
artifact tasks.named("bundleReleaseAar").get().outputs.files.singleFile
63+
artifact(project.hasProperty('AAR_PATH') ? project.AAR_PATH : "$buildDir/outputs/aar/android-release.aar")
6464

6565
// Maven Central metadata
6666
pom {
@@ -94,27 +94,28 @@ afterEvaluate {
9494
}
9595
}
9696
}
97-
}
9897

99-
// Signing configuration for Maven Central
100-
signing {
101-
required { project.hasProperty("SIGNING_KEY") }
102-
if (project.hasProperty("SIGNING_KEY")) {
103-
useInMemoryPgpKeys(
104-
project.property("SIGNING_KEY").toString(),
105-
project.property("SIGNING_PASSWORD").toString()
106-
)
107-
sign publishing.publications.release
98+
// Signing configuration for Maven Central
99+
signing {
100+
required { project.hasProperty("SIGNING_KEY") }
101+
if (project.hasProperty("SIGNING_KEY")) {
102+
useInMemoryPgpKeys(
103+
project.property("SIGNING_KEY").toString(),
104+
project.property("SIGNING_PASSWORD").toString()
105+
)
106+
sign publishing.publications.release
107+
}
108108
}
109109
}
110110

111-
// Maven Central publishing via NMCP
112-
nmcp {
111+
// Maven Central publishing via NMCP aggregation
112+
nmcpAggregation {
113113
if (project.hasProperty("SONATYPE_USERNAME") && project.hasProperty("SONATYPE_PASSWORD")) {
114-
publishAllPublications {
114+
centralPortal {
115115
username = project.property("SONATYPE_USERNAME")
116116
password = project.property("SONATYPE_PASSWORD")
117-
publicationType = "AUTOMATIC"
117+
publishingType = "AUTOMATIC"
118118
}
119+
publishAllProjectsProbablyBreakingProjectIsolation()
119120
}
120121
}

src/sqlite-vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern "C" {
2525
#endif
2626

27-
#define SQLITE_VECTOR_VERSION "0.9.30"
27+
#define SQLITE_VECTOR_VERSION "0.9.36"
2828

2929
SQLITE_VECTOR_API int sqlite3_vector_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
3030

0 commit comments

Comments
 (0)