Skip to content

Commit e120e88

Browse files
committed
Merge branch 'main' into timestamp-bound-exec-option
2 parents b23cf5c + 2e97f4c commit e120e88

File tree

227 files changed

+41815
-577
lines changed

Some content is hidden

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

227 files changed

+41815
-577
lines changed

.github/workflows/integration-tests-on-emulator.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ on:
22
push:
33
branches: [ main ]
44
pull_request:
5+
56
name: Integration tests on emulator
7+
68
jobs:
7-
test:
9+
# This is the original job, renamed for clarity
10+
test-go:
11+
name: Go Integration Tests
812
runs-on: ubuntu-latest
913
services:
1014
emulator:
@@ -19,10 +23,36 @@ jobs:
1923
go-version: 1.25.x
2024
- name: Checkout code
2125
uses: actions/checkout@v5
22-
- name: Run integration tests on emulator
26+
- name: Run Go integration tests on emulator
2327
run: go test -race
2428
env:
2529
JOB_TYPE: test
2630
SPANNER_EMULATOR_HOST: localhost:9010
2731
SPANNER_TEST_PROJECT: emulator-test-project
2832
SPANNER_TEST_INSTANCE: test-instance
33+
34+
test-ruby:
35+
name: Ruby Integration Tests
36+
runs-on: ubuntu-latest
37+
services:
38+
emulator:
39+
image: gcr.io/cloud-spanner-emulator/emulator:latest
40+
ports:
41+
- 9010:9010
42+
- 9020:9020
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v5
46+
- name: Set up Ruby
47+
uses: ruby/setup-ruby@v1
48+
with:
49+
ruby-version: '3.4.7'
50+
working-directory: spannerlib/wrappers/spannerlib-ruby
51+
bundler-cache: true
52+
- name: Compile and Run Ruby Integration Tests
53+
working-directory: spannerlib/wrappers/spannerlib-ruby
54+
env:
55+
SPANNER_EMULATOR_HOST: localhost:9010
56+
run: |
57+
bundle exec rake compile:x86_64-linux
58+
bundle exec rspec spec/integration/

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
working-directory: spannerlib
2222
run: go build grpc_server.go
2323
- name: Upload linux-x64 shared lib
24-
uses: actions/upload-artifact@v4
24+
uses: actions/upload-artifact@v5
2525
with:
2626
name: spannerlib-linux-x64
2727
path: spannerlib/spannerlib.so
2828
- name: Upload linux-x64 gRPC server
29-
uses: actions/upload-artifact@v4
29+
uses: actions/upload-artifact@v5
3030
with:
3131
name: spannerlib-server-linux-x64
3232
path: spannerlib/grpc_server
@@ -46,12 +46,12 @@ jobs:
4646
working-directory: spannerlib
4747
run: go build grpc_server.go
4848
- name: Upload osx-arm64 shared lib
49-
uses: actions/upload-artifact@v4
49+
uses: actions/upload-artifact@v5
5050
with:
5151
name: spannerlib-osx-arm64
5252
path: spannerlib/spannerlib.dylib
5353
- name: Upload osx-arm64 gRPC server
54-
uses: actions/upload-artifact@v4
54+
uses: actions/upload-artifact@v5
5555
with:
5656
name: spannerlib-server-osx-arm64
5757
path: spannerlib/grpc_server
@@ -62,24 +62,24 @@ jobs:
6262
- name: Checkout code
6363
uses: actions/checkout@v5
6464
- name: Download and copy linux-x64 shared lib
65-
uses: actions/download-artifact@v5
65+
uses: actions/download-artifact@v6
6666
with:
6767
name: spannerlib-linux-x64
6868
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/linux-x64/
6969
- name: Download and copy linux-x64 gRPC server
70-
uses: actions/download-artifact@v5
70+
uses: actions/download-artifact@v6
7171
with:
7272
name: spannerlib-server-linux-x64
7373
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/
7474
- name: Add execute permission to linux-x64 gRPC server
7575
run: chmod +x spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/linux-x64/grpc_server
7676
- name: Download and copy osx-arm64
77-
uses: actions/download-artifact@v5
77+
uses: actions/download-artifact@v6
7878
with:
7979
name: spannerlib-osx-arm64
8080
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Native/libraries/osx-arm64/
8181
- name: Download and copy osx-arm64 gRPC server
82-
uses: actions/download-artifact@v5
82+
uses: actions/download-artifact@v6
8383
with:
8484
name: spannerlib-server-osx-arm64
8585
path: spannerlib/dotnet-spannerlib/Google.Cloud.SpannerLib.Grpc/binaries/osx-arm64/
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build and Publish Native Ruby Gem
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-shared-library-binaries:
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-13, windows-latest]
11+
include:
12+
# Config for Linux
13+
- os: ubuntu-latest
14+
platform_tasks: "compile:aarch64-linux compile:x86_64-linux"
15+
artifact_name: "linux-binaries"
16+
artifact_path: "spannerlib/wrappers/spannerlib-ruby/lib/spannerlib/*-linux/"
17+
18+
# Config for macOS (Apple Silicon + Intel)
19+
# Note: macos-13 is an Intel runner (x86_64) but can cross-compile to Apple Silicon (aarch64)
20+
- os: macos-13
21+
platform_tasks: "compile:aarch64-darwin compile:x86_64-darwin"
22+
artifact_name: "darwin-binaries"
23+
artifact_path: "spannerlib/wrappers/spannerlib-ruby/lib/spannerlib/*-darwin/"
24+
25+
# Config for Windows
26+
- os: windows-latest
27+
platform_tasks: "compile:x64-mingw32"
28+
artifact_name: "windows-binaries"
29+
artifact_path: "spannerlib/wrappers/spannerlib-ruby/lib/spannerlib/x64-mingw32/"
30+
31+
runs-on: ${{ matrix.os }}
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v5
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v6
39+
with:
40+
go-version: 1.25.x
41+
42+
- name: Set up Ruby
43+
uses: ruby/setup-ruby@v1
44+
with:
45+
ruby-version: '3.4.7'
46+
bundler-cache: true
47+
working-directory: 'spannerlib/wrappers/spannerlib-ruby'
48+
49+
- name: Install cross-compilers (Linux)
50+
if: matrix.os == 'ubuntu-latest'
51+
run: |
52+
sudo apt-get update
53+
# GCC cross toolchain and binutils for aarch64
54+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
55+
# Mingw-w64 cross toolchain for Windows target (x86_64)
56+
sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
57+
echo "=== cross compiler versions ==="
58+
aarch64-linux-gnu-gcc --version || true
59+
aarch64-linux-gnu-g++ --version || true
60+
x86_64-w64-mingw32-gcc --version || true
61+
which aarch64-linux-gnu-gcc || true
62+
which x86_64-w64-mingw32-gcc || true
63+
64+
# The cross-compiler step for macOS is removed,
65+
# as the built-in Clang on macOS runners can handle both Intel and ARM.
66+
67+
- name: Compile Binaries
68+
working-directory: spannerlib/wrappers/spannerlib-ruby
69+
run: |
70+
# This runs the specific Rake tasks for this OS
71+
# e.g., "rake compile:aarch64-linux compile:x86_64-linux"
72+
bundle exec rake ${{ matrix.platform_tasks }}
73+
74+
- name: Upload Binaries as Artifact
75+
uses: actions/upload-artifact@v5
76+
with:
77+
name: ${{ matrix.artifact_name }}
78+
path: ${{ matrix.artifact_path }}
79+
80+
publish:
81+
name: Package and Publish Gem
82+
# This job runs only after all 'build' jobs have succeeded
83+
needs: build-shared-library-binaries
84+
runs-on: ubuntu-latest
85+
86+
# This gives the job permission to publish to RubyGems
87+
permissions:
88+
id-token: write
89+
contents: read
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v5
94+
95+
- name: Set up Ruby
96+
uses: ruby/setup-ruby@v1
97+
with:
98+
ruby-version: '3.4.7'
99+
bundler-cache: true
100+
working-directory: 'spannerlib/wrappers/spannerlib-ruby'
101+
102+
- name: Download all binaries
103+
uses: actions/download-artifact@v6
104+
with:
105+
# No name means it downloads ALL artifacts from this workflow
106+
# The binaries will be placed in their original paths
107+
path: spannerlib/wrappers/spannerlib-ruby/lib/spannerlib/
108+
109+
- name: List downloaded files (for debugging)
110+
run: ls -R spannerlib/wrappers/spannerlib-ruby/lib/spannerlib/
111+
112+
- name: Build Gem
113+
working-directory: spannerlib/wrappers/spannerlib-ruby
114+
run: gem build spannerlib-ruby.gemspec
115+
116+
- name: Publish to RubyGems
117+
working-directory: spannerlib/wrappers/spannerlib-ruby
118+
run: |
119+
# Make all built .gem files available to be pushed
120+
mkdir -p $HOME/.gem
121+
touch $HOME/.gem/credentials
122+
chmod 0600 $HOME/.gem/credentials
123+
124+
# This uses the new "Trusted Publishing" feature.
125+
# https://guides.rubygems.org/publishing/#publishing-with-github-actions
126+
printf -- "---\n:rubygems_api_key: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
127+
128+
# Push the gem
129+
gem push *.gem
130+
env:
131+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
132+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# .github/workflows/lint.yml
2+
3+
name: RuboCop Linter
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
11+
jobs:
12+
ruby-wrapper-lint:
13+
runs-on: ubuntu-latest
14+
15+
defaults:
16+
run:
17+
working-directory: spannerlib/wrappers/spannerlib-ruby
18+
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v5
22+
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: '3.4.7'
27+
bundler-cache: true
28+
working-directory: spannerlib/wrappers/spannerlib-ruby
29+
30+
- name: Run RuboCop
31+
run: bundle exec rubocop
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Ruby Wrapper Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: Test ${{ matrix.os }} (Ruby ${{ matrix.ruby-version }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
ruby-version: ['3.3']
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
working-directory: ./spannerlib/wrappers/spannerlib-ruby
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v5
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v6
30+
with:
31+
go-version: '1.25.x'
32+
33+
- name: Set up Ruby
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: ${{ matrix.ruby-version }}
37+
bundler-cache: true
38+
working-directory: ./spannerlib/wrappers/spannerlib-ruby
39+
40+
- name: Build shared library (Linux)
41+
if: runner.os == 'Linux'
42+
run: bundle exec rake compile:x86_64-linux
43+
44+
- name: Build shared library (macOS)
45+
if: runner.os == 'macOS'
46+
run: |
47+
ARCH=$(uname -m)
48+
if [ "$ARCH" == "arm64" ]; then
49+
bundle exec rake compile:aarch64-darwin
50+
else
51+
bundle exec rake compile:x86_64-darwin
52+
fi
53+
- name: Build shared library (Windows)
54+
if: runner.os == 'Windows'
55+
run: |
56+
CC=gcc CXX=g++ AR=ar RANLIB=ranlib bundle exec rake compile:x64-mingw32
57+
58+
- name: Run Tests
59+
run: |
60+
bundle exec ruby -Ilib -Ispec spec/spannerlib_ruby_spec.rb

0 commit comments

Comments
 (0)