Skip to content

Commit 6da1be9

Browse files
authored
Merge pull request #1 from chdb-io/init
Initial Pull Request
2 parents b329165 + df1aeaf commit 6da1be9

File tree

18 files changed

+1481
-0
lines changed

18 files changed

+1481
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: publish dotnet packages
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
packages: write
12+
contents: read
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
- name: Setup .NET Core 8.x
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: |
20+
6.x
21+
8.x
22+
cache: true
23+
- name: Download chdb library
24+
run: ./update_libchdb.sh
25+
- run: dotnet build --configuration Release
26+
- name: Create the packages
27+
run: dotnet pack --configuration Release --include-symbols
28+
- name: Publish the package to nuget.org
29+
run: dotnet nuget push nupkg/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
30+
env:
31+
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}

.github/workflows/dotnet.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: build
5+
6+
env:
7+
DOTNET_NOLOGO: 1
8+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
9+
10+
on:
11+
push:
12+
branches: [ "main" ]
13+
pull_request:
14+
branches: [ "main" ]
15+
workflow_dispatch:
16+
inputs:
17+
reason:
18+
description: 'The reason for running the workflow'
19+
required: true
20+
default: 'Manual run'
21+
22+
jobs:
23+
build_chdb:
24+
name: Build chdb-${{ matrix.rid }}
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
include:
29+
- os: ubuntu-latest
30+
rid: linux-x64
31+
- os: macos-latest
32+
rid: osx-x64
33+
- os: macos-14
34+
rid: osx-arm64
35+
36+
steps:
37+
- name: 'Print manual run reason'
38+
if: ${{ github.event_name == 'workflow_dispatch' }}
39+
run: |
40+
echo 'Reason: ${{ github.event.inputs.reason }}'
41+
42+
- uses: actions/checkout@v4
43+
44+
- name: Setup .NET Core
45+
uses: actions/setup-dotnet@v3
46+
with:
47+
dotnet-version: |
48+
6.0.x
49+
8.0.x
50+
source-url: https://nuget.pkg.github.com/vilinski/index.json
51+
env:
52+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
53+
- name: Display dotnet version
54+
run: |
55+
dotnet --version
56+
echo "GITHUB_WORKSPACE $GITHUB_WORKSPACE"
57+
echo "GITHUB_ACTION $GITHUB_ACTION"
58+
echo "GITHUB_RUN_ID $GITHUB_RUN_ID"
59+
echo "GITHUB_RUN_NUMBER $GITHUB_RUN_NUMBER"
60+
61+
- name: Restore
62+
run: dotnet restore
63+
64+
- name: Download chdb library
65+
run: ./update_libchdb.sh
66+
67+
- name: Build
68+
run: |
69+
# copy to the correct location
70+
cp libchdb.so src/chdb/libchdb.so
71+
ls -lahS src/chdb/libchdb*
72+
dotnet build --no-restore --configuration Release
73+
74+
- name: Test
75+
run: dotnet test -c Release --no-build --logger trx --results-directory "TestResults-${{ matrix.rid }}"
76+
77+
# - name: Upload dotnet test results
78+
# uses: actions/upload-artifact@v4
79+
# with:
80+
# name: dotnet-results-${{ matrix.rid }}
81+
# path: TestResults-${{ matrix.rid }}
82+
# # Use always() to always run this step to publish test results when there are test failures
83+
# if: ${{ always() }}
84+
85+
# - name: Pack chdb-${{ matrix.rid }}
86+
# run: |
87+
# dotnet pack src/chdb/chdb.csproj -c Release
88+
# ls -lahS nupkg
89+
90+
# - name: Publish the package to nuget.org
91+
# run: dotnet nuget push nupkg/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
92+
# env:
93+
# NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
94+
95+
# - name: Publish chdb-${{ matrix.rid }} package to GPR
96+
# 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
97+
# env:
98+
# NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
99+
100+
# - name: Upload nupkg
101+
# #run: ls -l nupkg/*.nupkg
102+
# uses: actions/upload-artifact@v4
103+
# with:
104+
# name: dotnet-nupkg-${{ matrix.rid }}
105+
# path: nupkg
106+
107+
push_chdb:
108+
if: github.event.pull_request.merged
109+
name: Push chdb
110+
needs: build_chdb
111+
runs-on: ubuntu-latest
112+
steps:
113+
114+
- uses: actions/checkout@v4
115+
116+
- name: Download chdb library
117+
run: ./update_libchdb.sh
118+
119+
# - name: Upload libchdb Artifact
120+
# uses: actions/upload-artifact@v4
121+
# with:
122+
# name: libchdb
123+
# path: libchdb.so
124+
125+
- name: Pack
126+
run: |
127+
cp libchdb.so src/chdb/libchdb.so
128+
ls -lahS src/chdb/libchdb*
129+
dotnet pack src/chdb/chdb.csproj -c Release --include-symbols
130+
ls -lahS nupkg
131+
132+
- name: Publish the package to nuget.org
133+
run: dotnet nuget push nupkg/chdb.*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
134+
135+
136+
push_tool:
137+
if: github.event.pull_request.merged
138+
name: Push chdb-tool
139+
needs: push_chdb
140+
runs-on: ubuntu-latest
141+
env:
142+
PUSH_TOOL: true
143+
steps:
144+
- uses: actions/checkout@v4
145+
146+
- name: Download chdb library
147+
run: ./update_libchdb.sh
148+
149+
- name: Pack
150+
run: |
151+
ls -lahS .
152+
ls -lahS src/chdb/*
153+
cp libchdb.so src/chdb/
154+
ls -lahS src/chdb/libchdb*
155+
dotnet nuget sources add -n chdb ./nupkg
156+
dotnet pack src/chdb-tool/chdb-tool.csproj -c Release --include-symbols
157+
ls -lahS nupkg
158+
159+
- name: Publish
160+
run: dotnet nuget push nupkg/chdb-tool.*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_AUTH_TOKEN_CHDB }}
161+
162+
- name: Test chdb-tool
163+
run: |
164+
./update_libchdb.sh
165+
dotnet tool install --add-source ./nupkg --global chdb-tool
166+
which chdb
167+
cp libchdb.so /home/runner/.dotnet/tools/
168+
chdb --help
169+
chdb "select version()" PrettyCompact

0 commit comments

Comments
 (0)