Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 4 additions & 130 deletions .github/workflows/generator-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,136 +41,10 @@ jobs:
run: npm install
working-directory: core/generator/gapic-generator-typescript

- name: Run bazel build
working-directory: core/generator/gapic-generator-typescript
run: bazelisk build --noremote_accept_cached '//...'

- name: Run bazel test
working-directory: core/generator/gapic-generator-typescript
run: bazelisk test --test_output=errors --noremote_accept_cached //...

- name: Verify error conformance
- name: Strip local GCC 15 flags for CI
working-directory: core/generator/gapic-generator-typescript
run: |
curl -sSL https://github.com/googleapis/gapic-config-validator/releases/download/v0.6.0/gapic-config-validator-0.6.0-linux-amd64.tar.gz > config-validator.tar.gz
tar xzf config-validator.tar.gz --no-same-owner
chmod +x gapic-error-conformance
chmod +x bazel-bin/protoc_plugin_/protoc_plugin
./gapic-error-conformance -plugin="bazel-bin/protoc_plugin_/protoc_plugin"
run: sed -i '/--gsframe/d' .bazelrc

- name: Prepare baseline artifacts
working-directory: core/generator/gapic-generator-typescript
run: |
mkdir -p ~/artifacts
cp bazel-testlogs/unit_tests/test.outputs/outputs.zip ~/artifacts/
bazelisk run -- @pnpm//:pnpm --dir $PWD install
tar cfz ~/artifacts/node_modules.tar.gz node_modules

- name: Save artifacts
uses: actions/upload-artifact@v5
with:
name: artifacts
path: ~/artifacts

- name: Test generated libraries
working-directory: core/generator/gapic-generator-typescript
run: |
set -ex
unzip ~/artifacts/outputs.zip -d library
for lib in showcase kms translate monitoring dlp texttospeech showcase-legacy compute logging bigquery-v2 redis retail; do
echo "--- Testing library $lib ---"
cd library/.test-out-$lib
npm install
npm test
npm run fix
rm -rf build
npm run compile
npm run system-test
npm run docs
cd ../..
done

- name: Test generated ESM libraries
working-directory: core/generator/gapic-generator-typescript
run: |
set -ex
for lib in showcase kms translate monitoring dlp texttospeech showcase-legacy compute logging bigquery-v2 redis retail; do
echo "--- Testing ESM library $lib ---"
cd library/.test-out-$lib-esm
npm install
npm test
npm run fix
rm -rf build
npm run compile
npm run system-test
cd ../..
done
- name: Test combined library (Speech)
if: steps.generator-changes.outputs.changes == 'true'
env:
TEST_ENV_DESTINATION_PATH: generator/gapic-generator-typescript/test-fixtures/google-cloud-speech
run: generator/gapic-generator-typescript/rules_typescript_gapic/combine_script.sh generator/gapic-generator-typescript/test-fixtures/google-cloud-speech-nodejs v1 "" "" generator/gapic-generator-typescript/node_modules/gapic-tools/build/src/compileProtos.js generator/gapic-generator-typescript/node_modules/gapic-node-processing/build/src/cli.js ""

- name: Run tests for combined library (Speech)
if: steps.generator-changes.outputs.changes == 'true'
run: |
set -ex
cd generator/gapic-generator-typescript/test-fixtures/google-cloud-speech
npm install
npm test
npm run system-test

- name: Test combined library (Tasks)
if: steps.generator-changes.outputs.changes == 'true'
env:
TEST_ENV_DESTINATION_PATH: generator/gapic-generator-typescript/test-fixtures/google-cloud-tasks
run: generator/gapic-generator-typescript/rules_typescript_gapic/combine_script.sh generator/gapic-generator-typescript/test-fixtures/google-cloud-tasks-nodejs v2 "" "" generator/gapic-generator-typescript/node_modules/gapic-tools/build/src/compileProtos.js generator/gapic-generator-typescript/node_modules/gapic-node-processing/build/src/cli.js ""

- name: Run tests for combined library (Tasks)
if: steps.generator-changes.outputs.changes == 'true'
run: |
set -ex
cd generator/gapic-generator-typescript/test-fixtures/google-cloud-tasks
npm install
npm test
npm run system-test

continuous:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container: gcr.io/gapic-images/googleapis:20250404
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2 # Need at least two commits for HEAD~..

- name: Mark repo as safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Compute GIT_DIFF_ARG
id: diff-logic
run: |
# For continuous build, we want to know the difference in the last
# commit. This assumes we use squash commit when merging PRs.
git fetch origin main --deepen=1
echo "GIT_DIFF_ARG=HEAD~.." >> $GITHUB_ENV

- name: Cache Bazel files
id: cache-bazel
uses: actions/cache@v5
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-googleapis-20250422-${{ secrets.CACHE_VERSION }}

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 18.x

- name: Install Node dependencies with npm
run: npm install
working-directory: core/generator/gapic-generator-typescript

- name: Run bazel build
working-directory: core/generator/gapic-generator-typescript
run: bazelisk build --noremote_accept_cached '//...'
Expand Down Expand Up @@ -235,7 +109,7 @@ jobs:
npm run system-test
cd ../..
done
- name: Test combined library (Speech)
- name: Test combined library (Speech)
if: steps.generator-changes.outputs.changes == 'true'
env:
TEST_ENV_DESTINATION_PATH: generator/gapic-generator-typescript/test-fixtures/google-cloud-speech
Expand Down Expand Up @@ -263,4 +137,4 @@ jobs:
cd generator/gapic-generator-typescript/test-fixtures/google-cloud-tasks
npm install
npm test
npm run system-test
npm run system-test
2 changes: 1 addition & 1 deletion core/generator/gapic-generator-typescript/.bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# See https://github.com/bazelbuild/bazelisk
USE_BAZEL_VERSION=6.3.0
USE_BAZEL_VERSION=7.7.1
42 changes: 26 additions & 16 deletions core/generator/gapic-generator-typescript/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
# Copied from https://github.com/googleapis/googleapis/blob/master/.bazelrc
# Need because absl library requires C++14 while the Bazel default is C++0x
common --noenable_bzlmod

# --- C++ Toolchain & Compilation ---
# Force C++17 for Protobuf 31 / gRPC 1.74 compatibility
build --cxxopt='-std=c++17'
build --host_cxxopt='-std=c++17'
build --action_env=BAZEL_CXXOPTS="-std=c++17"
build --copt='-Wa,--gsframe=no'
build --host_copt='-Wa,--gsframe=no'


# --- Java Toolchain & Runtime (JDK 21) ---
build --java_language_version=21
build --java_runtime_version=remotejdk_21
build --javacopt="-Xep:ImpossibleNullComparison:OFF"

# --- Protobuf & gRPC ---
build --proto_toolchain_for_java="@com_google_protobuf//:java_toolchain"
build --define=grpc_no_ares=true
# To make proto_library rules to include source info in the descriptor
build --protocopt=--include_source_info
build --protocopt=--experimental_allow_proto3_optional
# New boringssl requires C++14
build --repo_env=BAZEL_CXXOPTS="-std=c++14"

# --- Test Environment Fixes ---
test --jvmopt="-Djava.security.manager=allow"
test --jvmopt="--add-opens=java.base/java.lang=ALL-UNNAMED"

# This is to avoid JVM SIGBUS crashes on highly parallel builds,
# see https://github.com/bazelbuild/bazel/issues/3236 for more details
build --enable_platform_specific_config
# --- Linux Specific Config ---
build:linux --sandbox_tmpfs_path=/tmp
common:linux --experimental_convenience_symlinks=ignore

build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17

common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig

# Between Bazel 6.0 and 6.3, you need all of this, to avoid discarding the analysis cache:
build --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
fetch --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
query --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
# --- Performance & Analysis ---
# Bazel 6.4+: 'common' applies to all commands that support the flag
common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
13 changes: 13 additions & 0 deletions core/generator/gapic-generator-typescript/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ workspace(
# How this workspace would be referenced with absolute labels from another workspace
name = "gapic_generator_typescript",
)


load("//:repositories.bzl", "gapic_generator_typescript_repositories", "NODE_VERSION")
gapic_generator_typescript_repositories()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_java",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/7.11.1/rules_java-7.11.1.tar.gz",
],
sha256 = "6f3ce0e9fba979a844faba2d60467843fbf5191d8ca61fa3d2ea17655b56bb8c",
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()



load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"@babel/preset-typescript": "^7.28.5",
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.12",
"@types/sinon": "^17.0.4",
"@types/sinon": "^20.0.0",
"babel-plugin-replace-import-extension": "^1.1.5",
"c8": "^10.1.3",
"gapic-tools": "^1.0.3",
Expand All @@ -92,9 +92,9 @@
"jsdoc-fresh": "^5.0.2",
"long": "^5.3.2",
"mocha": "^11.7.4",
"pack-n-play": "^4.2.1",
"typescript": "5.8.3",
"sinon": "^21.0.0",
"pack-n-play": "^4.2.1",
"sinon": "^20.0.0",
"ts-loader": "^8.4.0",
"webpack": "^5.102.1",
"webpack-cli": "^6.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.12",
"@types/sinon": "^17.0.4",
"@types/sinon": "^20.0.0",
"c8": "^10.1.3",
"gapic-tools": "^1.0.3",
"gts": "^6.0.2",
Expand All @@ -50,7 +50,7 @@
"mocha": "^11.7.4",
"pack-n-play": "^4.2.1",
"typescript": "5.8.3",
"sinon": "^21.0.0"
"sinon": "^20.0.0"
},
"engines": {
"node": ">=v18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('📦 pack-n-play test', () => {
packageDir: process.cwd(),
sample: {
description: 'JavaScript user can use the library',
ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
}
};
await packNTest(options);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"@babel/preset-typescript": "^7.28.5",
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.12",
"@types/sinon": "^17.0.4",
"@types/sinon": "^20.0.0",
"babel-plugin-replace-import-extension": "^1.1.5",
"c8": "^10.1.3",
"gapic-tools": "^1.0.3",
Expand All @@ -92,9 +92,9 @@
"jsdoc-fresh": "^5.0.2",
"long": "^5.3.2",
"mocha": "^11.7.4",
"pack-n-play": "^4.2.1",
"typescript": "5.8.3",
"sinon": "^21.0.0",
"pack-n-play": "^4.2.1",
"sinon": "^20.0.0",
"ts-loader": "^8.4.0",
"webpack": "^5.102.1",
"webpack-cli": "^6.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.12",
"@types/sinon": "^17.0.4",
"@types/sinon": "^20.0.0",
"c8": "^10.1.3",
"gapic-tools": "^1.0.3",
"gts": "^6.0.2",
Expand All @@ -50,7 +50,7 @@
"mocha": "^11.7.4",
"pack-n-play": "^4.2.1",
"typescript": "5.8.3",
"sinon": "^21.0.0"
"sinon": "^20.0.0"
},
"engines": {
"node": ">=v18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('📦 pack-n-play test', () => {
packageDir: process.cwd(),
sample: {
description: 'JavaScript user can use the library',
ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString()
}
};
await packNTest(options);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@babel/preset-typescript": "^7.28.5",
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.12",
"@types/sinon": "^17.0.4",
"@types/sinon": "^20.0.0",
"babel-plugin-replace-import-extension": "^1.1.5",
"c8": "^10.1.3",
"gapic-tools": "^1.0.3",
Expand All @@ -98,9 +98,9 @@
"jsdoc-fresh": "^5.0.2",
"long": "^5.3.2",
"mocha": "^11.7.4",
"pack-n-play": "^4.2.1",
"typescript": "5.8.3",
"sinon": "^21.0.0",
"pack-n-play": "^4.2.1",
"sinon": "^20.0.0",
"ts-loader": "^8.4.0",
"webpack": "^5.102.1",
"webpack-cli": "^6.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
Loading
Loading