Skip to content

ci(gapic-generator-typescript): install system protoc for generator tests#8003

Open
GautamSharda wants to merge 5 commits intomainfrom
pr-2-ci
Open

ci(gapic-generator-typescript): install system protoc for generator tests#8003
GautamSharda wants to merge 5 commits intomainfrom
pr-2-ci

Conversation

@GautamSharda
Copy link
Copy Markdown
Contributor

@GautamSharda GautamSharda commented Apr 9, 2026

This PR explicitly installs the protoc (v25.3) binary into the GitHub Actions runner environment for gapic-generator-typescript tests.

Currently, the generator-tests.yaml workflow relies on Bazel to download, compile, and manage the protoc binary from source. This compilation adds significant overhead to the CI pipeline (4+ minutes). By downloading the pre-compiled binary directly to /usr/local/bin/protoc, we make the system-level protoc instantly available to the runner.

This is Part 2 of 3 in the broader effort to completely remove Bazel from the generator (For googleapis/librarian#4593
). Pre-installing this system dependency prepares the CI environment for the final removal of Bazel, ensuring the tests can still compile protos natively in the next step.

This change completely removes the Bazel dependency from the
gapic-generator-typescript project. All Bazel configuration files
have been deleted and package.json scripts have been updated to
use the standard TypeScript compiler (tsc) directly.

Bazel was originally introduced to export build rules for the
googleapis monorepo. However, following the consolidation of
the generator into google-cloud-node/core, Bazel is no longer
necessary and adds significant overhead (e.g., 4+ minute
installations via npm run compile). Since tsc provides all the
compilation functionality needed natively, stripping Bazel
simplifies the toolchain and significantly speeds up CI pipelines
without losing capabilities.

To verify this change does not break functionality, the project
was locally compiled successfully using `npx tsc -p .` in under
7 seconds. The test scripts were also run, and the overall
Librarian CI workflow has been verified to pass with these
changes, confirming that the generator builds and executes
correctly without Bazel.

For googleapis/librarian#4593
# Conflicts:
#	core/generator/gapic-generator-typescript/.bazeliskrc
#	core/generator/gapic-generator-typescript/.bazelrc
#	core/generator/gapic-generator-typescript/WORKSPACE
#	core/generator/gapic-generator-typescript/repositories.bzl
…outside of bazel

This PR improves the robustness of the generator scripts so they can execute successfully outside of a Bazel sandbox environment.

When the generator is invoked directly (e.g., via tsc and node), it previously failed due to missing executable permissions on protoc-plugin.js, strict file path checks for the system protoc binary, and crashes when parsing modern protos without the --experimental_editions flag. This commit addresses those by:
- Dynamically applying chmod +x to the generated plugin script.
- Trusting the system PATH for protoc (bypassing fs.existsSync for the string 'protoc').
- Explicitly passing --experimental_editions to protoc.
- Explicitly invoking the baseline tests with the node runtime to avoid shebang permission issues.
…ests

This PR explicitly installs the protoc (v25.3) binary into the GitHub Actions runner environment for gapic-generator-typescript tests.

Currently, the generator-tests.yaml workflow relies on Bazel to download, compile, and manage the protoc binary from source. This compilation adds significant overhead to the CI pipeline (4+ minutes). By downloading the pre-compiled binary directly to /usr/local/bin/protoc, we make the system-level protoc instantly available to the runner.

This is Part 2 of 3 in the broader effort to completely remove Bazel from the generator (For #4593, see full vision in PR #<INSERT_BIG_PR_NUMBER>). Pre-installing this system dependency prepares the CI environment for the final removal of Bazel, ensuring the tests can still compile protos natively in the next step.
@GautamSharda GautamSharda requested a review from a team as a code owner April 9, 2026 21:31
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.

1 participant