Skip to content

chore: Github action for Node spannerlib wrapper - #896

Merged
surbhigarg92 merged 3 commits into
mainfrom
node-wrapper-release
Aug 19, 2026
Merged

chore: Github action for Node spannerlib wrapper#896
surbhigarg92 merged 3 commits into
mainfrom
node-wrapper-release

Conversation

@surbhigarg92

@surbhigarg92 surbhigarg92 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces the automated build and release pipeline for the Node N-API wrapper, alongside structural improvements to how the native addon is linked and distributed.

Key Changes:

  • Release Workflow: Adds a GitHub Actions workflow (release-node-wrapper.yml) to build, package, and publish platform-specific binaries (macOS, Linux, Windows) to the Wombat registry.
  • Static Linking: Switches from dynamic linking (c-shared) to static linking (c-archive) for the Go library on macOS and Linux. This embeds the library directly into the N-API module, simplifying distribution and removing the need for rpath patching.
  • Windows Build Fallbacks: Enhances the Windows shared library build script to gracefully fall back to gendef/dlltool for MSVC .lib generation.
  • Dependency & Engine Updates: Bumps the minimum supported Node version to >=22 and moves node-addon-api to devDependencies (as we now distribute pre-built binaries).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the package.json for the Node.js wrapper to include build/Release/libspanner.* in the published files. The reviewer recommends explicitly listing the platform-specific shared library files (.so, .dylib, and .dll) instead of using a wildcard to avoid including unnecessary build artifacts.

Comment thread spannerlib/wrappers/spannerlib-node/package.json Outdated
@surbhigarg92
surbhigarg92 force-pushed the node-wrapper-release branch 6 times, most recently from b4fe6ef to 450ffb8 Compare August 19, 2026 08:00
@surbhigarg92 surbhigarg92 changed the title Node wrapper release chore: Github action for Node spannerlib wrapper Aug 19, 2026
@surbhigarg92
surbhigarg92 marked this pull request as ready for review August 19, 2026 08:00
@surbhigarg92
surbhigarg92 requested a review from a team as a code owner August 19, 2026 08:00
os_name: darwin
cpu_name: arm64
pkg_name: "@google-cloud/spannerlib-node-darwin-arm64"
- os: ubuntu-latest

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use ubuntu-22.04 here. That ensures that the build uses glibc v2.35. That ensures that it can run on many more linux versions than if you build this on ubuntu-24.

Also, we should change the build mode for the shared library from c-shared to c-archive. That will create just one file, instead of multiple files. So like this:

go build -C "$SHARED_LIB_DIR" -o libspanner.a -buildmode=c-archive shared_lib.go

And then also update binding.gyp to reference this new file instead of the list of files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented this for mac and linux . However c-archive cant be used for Windows.

Comment thread .github/workflows/release-node-wrapper.yml Outdated
Comment thread spannerlib/wrappers/spannerlib-node/package.json Outdated
"dependencies": {
"node-addon-api": "^8.0.0",
"bindings": "^1.5.0",
"@google-cloud/spanner": "^8.7.1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if we could remove or at least 'reduce' this dependency. All we need are the protobuf definitions, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is another TODO in the list, currently node does not publish a separate package for protos, so there is no alternate for us. Another option which I explored was to generate the protos for this, but that was also not straight forward to just generate for spanner.

https://github.com/googleapis/go-sql-spanner/blob/main/spannerlib/wrappers/spannerlib-node/src/lib/rows.ts#L18

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We should try to find a solution, because adding the Spanner client library here, adds a significant amount of files (and MBs) to the totals set of files that a customer installs when installing the node driver.

Comment thread .github/workflows/release-node-wrapper.yml
@surbhigarg92
surbhigarg92 force-pushed the node-wrapper-release branch 6 times, most recently from 20d6cf3 to 747c0e7 Compare August 19, 2026 12:17
Comment thread spannerlib/wrappers/spannerlib-node/BUILD_AND_RELEASE.md Outdated
Comment thread spannerlib/wrappers/spannerlib-node/BUILD_AND_RELEASE.md Outdated
"dependencies": {
"node-addon-api": "^8.0.0",
"bindings": "^1.5.0",
"@google-cloud/spanner": "^8.7.1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We should try to find a solution, because adding the Spanner client library here, adds a significant amount of files (and MBs) to the totals set of files that a customer installs when installing the node driver.

@surbhigarg92
surbhigarg92 merged commit 9d3d51d into main Aug 19, 2026
58 checks passed
@surbhigarg92
surbhigarg92 deleted the node-wrapper-release branch August 19, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants