diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 14b61b5..7a76579 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -14,7 +14,7 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup .NET Core 8.x
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index ac32337..123d46b 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -21,17 +21,22 @@ on:
jobs:
build_chdb:
- name: Build chdb-${{ matrix.rid }}
+ name: Build chdb-${{ matrix.RID }}
runs-on: ${{ matrix.os }}
+ env:
+ RID: ${{ matrix.RID }}
strategy:
matrix:
include:
- os: ubuntu-latest
- rid: linux-x64
+ RID: linux-x64
+ # github runner not available yet
+ # - os: ubuntu-latest
+ # RID: linux-arm64
- os: macos-latest
- rid: osx-x64
+ RID: osx-x64
- os: macos-14
- rid: osx-arm64
+ RID: osx-arm64
steps:
- name: 'Print manual run reason'
@@ -42,7 +47,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup .NET Core
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
@@ -72,17 +77,27 @@ jobs:
dotnet build --no-restore --configuration Release
- name: Test
- run: dotnet test -c Release --no-build --logger trx --results-directory "TestResults-${{ matrix.rid }}"
+ run: dotnet test -c Release --no-build --logger trx --results-directory "TestResults-${{ matrix.RID }}"
+
+ - name: Pack chdb-${{ matrix.RID }}
+ run: |
+ cp libchdb.so src/chdb/libchdb.so
+ ls -lahS src/chdb/libchdb*
+ dotnet pack src/chdb/chdb.csproj -c Release --include-symbols
+ ls -lahS nupkg
+
+ - name: Publish chdb-${{ matrix.RID }} package to nuget.org
+ run: dotnet nuget push nupkg/chd-.*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
# - name: Upload dotnet test results
# uses: actions/upload-artifact@v4
# with:
- # name: dotnet-results-${{ matrix.rid }}
- # path: TestResults-${{ matrix.rid }}
+ # name: dotnet-results-${{ matrix.RID }}
+ # path: TestResults-${{ matrix.RID }}
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
- # - name: Pack chdb-${{ matrix.rid }}
+ # - name: Pack chdb-${{ matrix.RID }}
# run: |
# dotnet pack src/chdb/chdb.csproj -c Release
# ls -lahS nupkg
@@ -92,8 +107,8 @@ jobs:
# env:
# NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
- # - name: Publish chdb-${{ matrix.rid }} package to GPR
- # run: dotnet nuget push nupkg/chdb-${{ matrix.rid }}.*.nupkg --skip-duplicate --api-key ${{ secrets.PACKAGES_TOKEN }} --source https://nuget.pkg.github.com/chdb-io/index.json
+ # - name: Publish chdb-${{ matrix.RID }} package to GPR
+ # run: dotnet nuget push nupkg/chdb-${{ matrix.RID }}.*.nupkg --skip-duplicate --api-key ${{ secrets.PACKAGES_TOKEN }} --source https://nuget.pkg.github.com/chdb-io/index.json
# env:
# NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
@@ -101,7 +116,7 @@ jobs:
# #run: ls -l nupkg/*.nupkg
# uses: actions/upload-artifact@v4
# with:
- # name: dotnet-nupkg-${{ matrix.rid }}
+ # name: dotnet-nupkg-${{ matrix.RID }}
# path: nupkg
push_chdb:
@@ -126,7 +141,8 @@ jobs:
run: |
cp libchdb.so src/chdb/libchdb.so
ls -lahS src/chdb/libchdb*
- dotnet pack src/chdb/chdb.csproj -c Release --include-symbols
+ dotnet nuget sources add -n chdb ./nupkg
+ dotnet pack src/chdb-meta/chdb-meta.csproj -c Release --include-symbols
ls -lahS nupkg
- name: Publish the package to nuget.org
diff --git a/README.md b/README.md
index 42c6e14..b0406b3 100644
--- a/README.md
+++ b/README.md
@@ -11,27 +11,13 @@ A .NET Core binding for [chdb](https://doc.chdb.io) library.
Running on platforms: linux, osx, windows, and architectures: x64, arm64.
->Note for windows users - there is no windows bild in sight, but you can still use it in WSL.
-
-Currently the librairy is too large to be packed into a nuget package, so you need to install it manually. Use the [update_libchdb.sh](update_libchdb.sh) script to download the library for your platform and architecture.
+>Note for windows users - there is no windows build in sight, but you can still use it in WSL.
```bash
-# download the latest version of the library - it takes a version as an optional argument
-./update_libchdb.sh
# install the package to your project
dotnet add package chdb
```
-Also place the library in appropriate folder, and add following to your csproj file:
-
-```xml
-
-
- PreserveNewest
-
-
-```
-
Then you can use it in your code like this:
```csharp
diff --git a/src/chdb-meta/chdb-meta.csproj b/src/chdb-meta/chdb-meta.csproj
index 2b229b2..1faa074 100644
--- a/src/chdb-meta/chdb-meta.csproj
+++ b/src/chdb-meta/chdb-meta.csproj
@@ -1,6 +1,7 @@
+ netstandard2.1
chdb
chdb
chdb native bindings for dotnet core
@@ -8,7 +9,7 @@
-
+
diff --git a/src/chdb/ChDb.cs b/src/chdb/ChDb.cs
index f3c2130..41b8cab 100644
--- a/src/chdb/ChDb.cs
+++ b/src/chdb/ChDb.cs
@@ -9,10 +9,10 @@ internal static class NativeMethods
private const string __DllName = "libchdb.so";
[DllImport(__DllName, EntryPoint = "query_stable_v2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern IntPtr query_stable_v2(int argc, string[] argv);
+ internal static extern nint query_stable_v2(int argc, string[] argv);
[DllImport(__DllName, EntryPoint = "free_result_v2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void free_result_v2(IntPtr result);
+ internal static extern void free_result_v2(nint result);
}
///
diff --git a/src/chdb/chdb.csproj b/src/chdb/chdb.csproj
index 58d8e8e..9813fd3 100644
--- a/src/chdb/chdb.csproj
+++ b/src/chdb/chdb.csproj
@@ -3,17 +3,18 @@
tests
netstandard2.1
+ $(RID)
- chdb
+ chdb-$(RID)
chdb
chdb native bindings for dotnet core
true
-
+