From 99cbcadc57957ec843460a8516771508b48c7533 Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:09:50 +0000 Subject: [PATCH 1/6] wip --- .github/workflows/experiment.yaml | 50 ++++++++++++++++++++++++ packages/gapic-generator/noxfile.py | 60 +++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/experiment.yaml diff --git a/.github/workflows/experiment.yaml b/.github/workflows/experiment.yaml new file mode 100644 index 000000000000..e32f1b2024a4 --- /dev/null +++ b/.github/workflows/experiment.yaml @@ -0,0 +1,50 @@ +name: Experiment centralized testing + +on: + pull_request: + paths: + - 'packages/gapic-generator/**' + - '.github/workflows/prerelease-radar.yml' + +jobs: + test-prerelease: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup Python + uses: actions/setup-python@v6 + with: + python-version: '3.14' + allow-prereleases: true + + - name: Setup Go + uses: actions/setup-go@v6 + with: + go-version: '1.26.x' + + - name: Install protoc + uses: arduino/setup-protoc@v3 + with: + version: "25.3" + + - name: Install Librarian + run: | + version=$(sed -n 's/^version: *//p' librarian.yaml) + go run "github.com/googleapis/librarian/cmd/librarian@${version}" install + + - name: Generate Redis via Librarian + run: | + version=$(sed -n 's/^version: *//p' librarian.yaml) + go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -packages=redis -output-dir=./workspace/redis + + - name: Install Nox + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install nox + + - name: Run Dynamic Prerelease Check + run: | + cd packages/gapic-generator + nox -s prerelease_deps -- ../../workspace/redis \ No newline at end of file diff --git a/packages/gapic-generator/noxfile.py b/packages/gapic-generator/noxfile.py index 8ef965740c2b..7ecbee88f410 100644 --- a/packages/gapic-generator/noxfile.py +++ b/packages/gapic-generator/noxfile.py @@ -829,11 +829,63 @@ def system(session): ) def prerelease_deps(session, protobuf_implementation): """ - Run all tests with pre-release versions of dependencies installed. + Run generated unit tests against pre-release ecosystem dependencies. + Usage: nox -s prerelease_deps -- /path/to/generated/library """ - # TODO(https://github.com/googleapis/google-cloud-python/issues/16184): - # Implement pre-release dependency logic to test against upcoming runtime changes. - session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.") + if not session.posargs: + session.error( + "You must provide the path to the generated library.\n" + "Usage: nox -s prerelease_deps -- ./workspace/redis" + ) + + target_path = session.posargs[0] + + if not os.path.exists(target_path): + session.error(f"Target path does not exist: {target_path}") + + # 1. Move into the generated library and install its baseline + session.chdir(target_path) + session.install("-e", ".") + session.install("pytest", "pytest-asyncio", "mock") + + # 2. Force install the exact pre-release ecosystem targets from PyPI + session.install( + "--pre", + "--upgrade", + "googleapis-common-protos", + "google-api-core", + "google-auth", + "grpc-google-iam-v1", + "grpcio", + "grpcio-status", + "protobuf", + "proto-plus", + ) + + # 3. Print out the versions to mimic the downstream logging verification + package_namespaces = { + "google-api-core": "google.api_core", + "google-auth": "google.auth", + "grpcio": "grpc", + "protobuf": "google.protobuf", + "proto-plus": "proto", + } + for pkg, namespace in package_namespaces.items(): + session.run( + "python", + "-c", + f"import {namespace}; print('{pkg}:', {namespace}.__version__)", + silent=False, + ) + + # 4. Run the hermetic unit tests with the specific protobuf backend + session.run( + "py.test", + "tests/unit", + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) @nox.session(python=NEWEST_PYTHON) From f6104bdd0d7f0736abda52a10fe33b539170a959 Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:12:44 +0000 Subject: [PATCH 2/6] wip --- .github/workflows/{experiment.yaml => experiment.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{experiment.yaml => experiment.yml} (96%) diff --git a/.github/workflows/experiment.yaml b/.github/workflows/experiment.yml similarity index 96% rename from .github/workflows/experiment.yaml rename to .github/workflows/experiment.yml index e32f1b2024a4..684ab493999a 100644 --- a/.github/workflows/experiment.yaml +++ b/.github/workflows/experiment.yml @@ -4,7 +4,7 @@ on: pull_request: paths: - 'packages/gapic-generator/**' - - '.github/workflows/prerelease-radar.yml' + - '.github/workflows/experiment.yml' jobs: test-prerelease: From 19d18aa00a9959239dd2d923b27fb510c6e329fe Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:15:53 +0000 Subject: [PATCH 3/6] wip --- .github/workflows/experiment.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/experiment.yml b/.github/workflows/experiment.yml index 684ab493999a..45a20b01745e 100644 --- a/.github/workflows/experiment.yml +++ b/.github/workflows/experiment.yml @@ -37,7 +37,8 @@ jobs: - name: Generate Redis via Librarian run: | version=$(sed -n 's/^version: *//p' librarian.yaml) - go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -packages=redis -output-dir=./workspace/redis + # Pass the target package path as a positional argument + go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate packages/google-cloud-redis - name: Install Nox run: | @@ -47,4 +48,5 @@ jobs: - name: Run Dynamic Prerelease Check run: | cd packages/gapic-generator - nox -s prerelease_deps -- ../../workspace/redis \ No newline at end of file + # Point the Nox engine to the newly generated package directory + nox -s prerelease_deps -- ../google-cloud-redis \ No newline at end of file From 364cfa98f106dfb6947817db6d5099a7829441be Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:26:41 +0000 Subject: [PATCH 4/6] wip --- .github/workflows/experiment.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/experiment.yml b/.github/workflows/experiment.yml index 45a20b01745e..e9e2f622fa49 100644 --- a/.github/workflows/experiment.yml +++ b/.github/workflows/experiment.yml @@ -4,7 +4,10 @@ on: pull_request: paths: - 'packages/gapic-generator/**' - - '.github/workflows/experiment.yml' + - '.github/workflows/prerelease-radar.yml' + +env: + SYNTHTOOL_TEMPLATES: /home/runner/synthtool/synthtool/gcp/templates jobs: test-prerelease: @@ -29,6 +32,10 @@ jobs: with: version: "25.3" + - name: Clone Synthtool Templates + run: | + git clone --recurse-submodules --single-branch https://github.com/googleapis/synthtool.git /home/runner/synthtool + - name: Install Librarian run: | version=$(sed -n 's/^version: *//p' librarian.yaml) @@ -37,8 +44,7 @@ jobs: - name: Generate Redis via Librarian run: | version=$(sed -n 's/^version: *//p' librarian.yaml) - # Pass the target package path as a positional argument - go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate packages/google-cloud-redis + go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate redis - name: Install Nox run: | From 4b05653f0c584074b701f2d7888212b7dfcda18a Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:36:53 +0000 Subject: [PATCH 5/6] fix library name --- .github/workflows/experiment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/experiment.yml b/.github/workflows/experiment.yml index e9e2f622fa49..e30cfcfb766d 100644 --- a/.github/workflows/experiment.yml +++ b/.github/workflows/experiment.yml @@ -44,7 +44,7 @@ jobs: - name: Generate Redis via Librarian run: | version=$(sed -n 's/^version: *//p' librarian.yaml) - go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate redis + go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate google-cloud-redis - name: Install Nox run: | From 3563d24a6df0b3527bad56d6f2e644497abc8ad3 Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 29 May 2026 23:41:18 +0000 Subject: [PATCH 6/6] install pandoc --- .github/workflows/experiment.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/experiment.yml b/.github/workflows/experiment.yml index e30cfcfb766d..06b8041ef2be 100644 --- a/.github/workflows/experiment.yml +++ b/.github/workflows/experiment.yml @@ -31,6 +31,13 @@ jobs: uses: arduino/setup-protoc@v3 with: version: "25.3" + + - name: Install pandoc + run: | + mkdir -p /tmp/pandoc + curl -fsSL --retry 5 -o /tmp/pandoc.tar.gz https://github.com/jgm/pandoc/releases/download/3.8.2/pandoc-3.8.2-linux-amd64.tar.gz + tar -xvf /tmp/pandoc.tar.gz -C /tmp/pandoc --strip-components=1 + echo "/tmp/pandoc/bin" >> $GITHUB_PATH - name: Clone Synthtool Templates run: |