Skip to content

Commit bfc8923

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

File tree

202 files changed

+36763
-562
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

+36763
-562
lines changed
Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
on:
22
workflow_dispatch:
3-
pull_request:
43
permissions:
54
contents: read
65
pull-requests: write
@@ -17,12 +16,20 @@ jobs:
1716
uses: actions/checkout@v4
1817
- name: Build shared library
1918
working-directory: spannerlib
20-
run: go build -o spannerlib.so -buildmode=c-shared
21-
- name: Upload linux-x64
19+
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
20+
- name: Build gRPC server
21+
working-directory: spannerlib
22+
run: go build grpc_server.go
23+
- name: Upload linux-x64 shared lib
2224
uses: actions/upload-artifact@v4
2325
with:
2426
name: spannerlib-linux-x64
2527
path: spannerlib/spannerlib.so
28+
- name: Upload linux-x64 gRPC server
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: spannerlib-server-linux-x64
32+
path: spannerlib/grpc_server
2633
build-osx-arm64:
2734
runs-on: macos-latest
2835
steps:
@@ -34,28 +41,50 @@ jobs:
3441
uses: actions/checkout@v4
3542
- name: Build shared library
3643
working-directory: spannerlib
37-
run: go build -o spannerlib.dylib -buildmode=c-shared
38-
- name: Upload osx-arm64
44+
run: go build -o spannerlib.dylib -buildmode=c-shared shared_lib.go
45+
- name: Build gRPC server
46+
working-directory: spannerlib
47+
run: go build grpc_server.go
48+
- name: Upload osx-arm64 shared lib
3949
uses: actions/upload-artifact@v4
4050
with:
4151
name: spannerlib-osx-arm64
4252
path: spannerlib/spannerlib.dylib
53+
- name: Upload osx-arm64 gRPC server
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: spannerlib-server-osx-arm64
57+
path: spannerlib/grpc_server
4358
build-and-package:
4459
needs: [build-linux-x64, build-osx-arm64]
4560
runs-on: ubuntu-latest
4661
steps:
4762
- name: Checkout code
4863
uses: actions/checkout@v4
49-
- name: Download and copy linux-x64
64+
- name: Download and copy linux-x64 shared lib
5065
uses: actions/download-artifact@v4
5166
with:
5267
name: spannerlib-linux-x64
5368
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/linux-x64/
69+
- name: Download and copy linux-x64 gRPC server
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: spannerlib-server-linux-x64
73+
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/
74+
- name: Add execute permission to linux-x64 gRPC server
75+
run: chmod +x spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/grpc_server
5476
- name: Download and copy osx-arm64
5577
uses: actions/download-artifact@v4
5678
with:
5779
name: spannerlib-osx-arm64
5880
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/osx-arm64/
81+
- name: Download and copy osx-arm64 gRPC server
82+
uses: actions/download-artifact@v4
83+
with:
84+
name: spannerlib-server-osx-arm64
85+
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/osx-arm64/
86+
- name: Add execute permission to osx-arm64 gRPC server
87+
run: chmod +x spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/osx-arm64/grpc_server
5988
- name: Install dotnet
6089
uses: actions/setup-dotnet@v4
6190
with:
@@ -65,7 +94,10 @@ jobs:
6594
- name: Build native library package
6695
run: dotnet pack
6796
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native
68-
- name: Add package source
97+
- name: Build gRPC server package
98+
run: dotnet pack
99+
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc
100+
- name: Add package source for native library
69101
run: dotnet nuget add source "$PWD"/bin/Release --name local
70102
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native
71103
- name: Restore dependencies
@@ -74,15 +106,9 @@ jobs:
74106
- name: Build
75107
run: dotnet build --no-restore
76108
working-directory: spannerlib/dotnet-spannerlib
77-
- name: Unit Tests
78-
working-directory: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Tests
79-
run: dotnet test --no-build --verbosity normal
80109
- name: Publish SpannerLib.Native to nuget
81110
run: dotnet nuget push bin/Release/Experimental.SpannerLib.Native.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
82111
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
112+
- name: Publish SpannerLib.Grpc to nuget
113+
run: dotnet nuget push bin/Release/Experimental.SpannerLib.Grpc.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
114+
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)