Skip to content

Commit 653aba1

Browse files
committed
refactor: add grpc server
1 parent 94a3746 commit 653aba1

File tree

202 files changed

+36456
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+36456
-570
lines changed

.github/workflows/release-dotnet-native-spanner-lib.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@ jobs:
1717
uses: actions/checkout@v4
1818
- name: Build shared library
1919
working-directory: spannerlib
20-
run: go build -o spannerlib.so -buildmode=c-shared
21-
- name: Upload linux-x64
20+
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
21+
- name: Build gRPC server
22+
working-directory: spannerlib
23+
run: go build grpc_server.go
24+
- name: Upload linux-x64 shared lib
2225
uses: actions/upload-artifact@v4
2326
with:
2427
name: spannerlib-linux-x64
2528
path: spannerlib/spannerlib.so
29+
- name: Upload linux-x64 gRPC server
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: spannerlib-server-linux-x64
33+
path: spannerlib/grpc_server
2634
build-osx-arm64:
2735
runs-on: macos-latest
2836
steps:
@@ -34,28 +42,50 @@ jobs:
3442
uses: actions/checkout@v4
3543
- name: Build shared library
3644
working-directory: spannerlib
37-
run: go build -o spannerlib.dylib -buildmode=c-shared
38-
- name: Upload osx-arm64
45+
run: go build -o spannerlib.dylib -buildmode=c-shared shared_lib.go
46+
- name: Build gRPC server
47+
working-directory: spannerlib
48+
run: go build grpc_server.go
49+
- name: Upload osx-arm64 shared lib
3950
uses: actions/upload-artifact@v4
4051
with:
4152
name: spannerlib-osx-arm64
4253
path: spannerlib/spannerlib.dylib
54+
- name: Upload osx-arm64 gRPC server
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: spannerlib-server-osx-arm64
58+
path: spannerlib/grpc_server
4359
build-and-package:
4460
needs: [build-linux-x64, build-osx-arm64]
4561
runs-on: ubuntu-latest
4662
steps:
4763
- name: Checkout code
4864
uses: actions/checkout@v4
49-
- name: Download and copy linux-x64
65+
- name: Download and copy linux-x64 shared lib
5066
uses: actions/download-artifact@v4
5167
with:
5268
name: spannerlib-linux-x64
5369
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/linux-x64/
70+
- name: Download and copy linux-x64 gRPC server
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: spannerlib-server-linux-x64
74+
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/
75+
- name: Add execute permission to linux-x64 gRPC server
76+
run: chmod +x spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/grpc_server
5477
- name: Download and copy osx-arm64
5578
uses: actions/download-artifact@v4
5679
with:
5780
name: spannerlib-osx-arm64
5881
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/osx-arm64/
82+
- name: Download and copy osx-arm64 gRPC server
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: spannerlib-server-osx-arm64
86+
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/osx-arm64/
87+
- name: Add execute permission to osx-arm64 gRPC server
88+
run: chmod +x spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/osx-arm64/grpc_server
5989
- name: Install dotnet
6090
uses: actions/setup-dotnet@v4
6191
with:
@@ -65,7 +95,10 @@ jobs:
6595
- name: Build native library package
6696
run: dotnet pack
6797
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native
68-
- name: Add package source
98+
- name: Build gRPC server package
99+
run: dotnet pack
100+
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc
101+
- name: Add package source for native library
69102
run: dotnet nuget add source "$PWD"/bin/Release --name local
70103
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native
71104
- name: Restore dependencies
@@ -80,9 +113,6 @@ jobs:
80113
- name: Publish SpannerLib.Native to nuget
81114
run: dotnet nuget push bin/Release/Experimental.SpannerLib.Native.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
82115
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native
83-
- name: Build SpannerLib
84-
run: dotnet pack
85-
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib
86-
- name: Publish SpannerLib to nuget
87-
run: dotnet nuget push bin/Release/Experimental.SpannerLib.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
88-
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib
116+
- name: Publish SpannerLib.Grpc to nuget
117+
run: dotnet nuget push bin/Release/Experimental.SpannerLib.Grpc.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
118+
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
workflow_dispatch:
3+
# pull_request:
4+
permissions:
5+
contents: read
6+
pull-requests: write
7+
name: Build and Release Google.Cloud.SpannerLib
8+
jobs:
9+
build-and-package:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Install dotnet
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: '9.0.x'
18+
- name: dotnet version
19+
run: dotnet --version
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
working-directory: spannerlib/dotnet-spannerlib
23+
- name: Build
24+
run: dotnet build --no-restore
25+
working-directory: spannerlib/dotnet-spannerlib
26+
- name: Unit Tests
27+
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Tests
28+
run: dotnet test --no-build --verbosity normal
29+
# - name: Pack SpannerLib
30+
# run: dotnet pack
31+
# working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib
32+
# - name: Publish SpannerLib to nuget
33+
# run: dotnet nuget push bin/Release/Experimental.SpannerLib.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
34+
# working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib

.github/workflows/spanner-lib-tests.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
2323
- name: Run unit tests
24-
working-directory: spannerlib/exported
24+
working-directory: spannerlib/lib
2525
run: go test -race -short
2626

2727
build-lib:
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@v4
4040
- name: Build shared lib
4141
working-directory: spannerlib
42-
run: go build -o spannerlib.so -buildmode=c-shared
42+
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
4343

4444
test-dotnet-ubuntu:
4545
runs-on: ubuntu-latest
@@ -52,12 +52,20 @@ jobs:
5252
uses: actions/checkout@v4
5353
- name: Build shared lib
5454
working-directory: spannerlib
55-
run: go build -o spannerlib.so -buildmode=c-shared
55+
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
5656
- name: Copy lib to dotnet folder
5757
working-directory: spannerlib
5858
run: |
5959
mkdir -p dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/any
6060
cp spannerlib.so dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/any/spannerlib.so
61+
- name: Build gRPC server
62+
working-directory: spannerlib
63+
run: go build grpc_server.go
64+
- name: Copy gRPC server to dotnet folder
65+
working-directory: spannerlib
66+
run: |
67+
mkdir -p dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/any
68+
cp grpc_server dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/any/grpc_server
6169
- name: Install dotnet
6270
uses: actions/setup-dotnet@v4
6371
with:

spannerlib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
spannerlib.h
22
spannerlib.so
3+
grpc_server

0 commit comments

Comments
 (0)