chore: release main #1007
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| permissions: | |
| contents: read | |
| name: Gapic Generator Specialized Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: gapic-gen-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| SHOWCASE_VERSION: 0.35.0 | |
| PROTOC_VERSION: 3.20.2 | |
| LATEST_STABLE_PYTHON: 3.14 | |
| PRERELEASE_PYTHON: 3.15 | |
| ALL_PYTHON: "['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']" | |
| TRIMMED_PYTHON: "['3.10', '3.14', '3.15']" | |
| # Workaround: Allows libcst to compile on Python 3.15+ while PyO3 catches up | |
| # Can be removed once libcst releases a version with native Python 3.15 wheels | |
| # Follow https://github.com/Instagram/LibCST/issues/1445 for updates. | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" | |
| jobs: | |
| # Check if the gapic-generator was changed. If so, execute specialized tests | |
| check_changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_generator: ${{ steps.filter.outputs.generator }} | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4 | |
| id: filter | |
| with: | |
| filters: | | |
| generator: | |
| - 'packages/gapic-generator/**' | |
| - '.github/workflows/gapic-generator-tests.yml' | |
| # Preserve the workaround for env variables in matrix | |
| python_config: | |
| needs: check_changes | |
| if: ${{ needs.check_changes.outputs.run_generator == 'true' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| all_python: ${{ env.ALL_PYTHON }} | |
| latest_stable_python: ${{ env.LATEST_STABLE_PYTHON }} | |
| prerelease_python: ${{ env.PRERELEASE_PYTHON }} | |
| trimmed_python: ${{ env.TRIMMED_PYTHON }} | |
| steps: | |
| - run: echo "Initializing config for gapic-generator" | |
| showcase-unit: | |
| needs: python_config | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ${{ fromJSON(needs.python_config.outputs.all_python) }} | |
| variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async] | |
| logging_scope: ["", "google"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "${{ matrix.python }}" | |
| allow-prereleases: true | |
| # Caches compiled wheels locally to prevent building heavy libraries | |
| # such as grpcio, which we build from scratch on every run for Python 3.15+. | |
| # Follow https://github.com/grpc/grpc/issues/41010 for updates. | |
| cache: 'pip' | |
| cache-dependency-path: '**/requirements*.txt' | |
| - name: Install System Deps & Protoc | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y curl pandoc unzip | |
| sudo mkdir -p /usr/src/protoc/ && sudo chown -R ${USER} /usr/src/ | |
| curl --location https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip --output /usr/src/protoc/protoc.zip | |
| cd /usr/src/protoc/ && unzip protoc.zip | |
| sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc | |
| - name: Run Nox | |
| env: | |
| GOOGLE_SDK_PYTHON_LOGGING_SCOPE: ${{ matrix.logging_scope }} | |
| MATRIX_PYTHON: ${{ matrix.python }} | |
| run: | | |
| pip install nox | |
| cd packages/gapic-generator | |
| nox -s showcase_unit${{ matrix.variant }}-${MATRIX_PYTHON} | |
| showcase-mypy: | |
| needs: python_config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ needs.python_config.outputs.latest_stable_python }} | |
| - name: Install System Deps | |
| run: sudo apt-get update && sudo apt-get install -y pandoc | |
| - name: Run Mypy | |
| run: | | |
| pip install nox | |
| cd packages/gapic-generator | |
| nox -s showcase_mypy | |
| goldens: | |
| needs: python_config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ needs.python_config.outputs.latest_stable_python }} | |
| - name: Install System Deps | |
| run: sudo apt-get update && sudo apt-get install -y pandoc | |
| - name: Run Goldens | |
| env: | |
| LATEST_STABLE_PYTHON: ${{ needs.python_config.outputs.latest_stable_python }} | |
| run: | | |
| pip install nox | |
| cd packages/gapic-generator | |
| for pkg in credentials eventarc logging redis; do | |
| nox -f tests/integration/goldens/$pkg/noxfile.py -s format lint unit-${LATEST_STABLE_PYTHON} | |
| done | |
| # Run pylint (errors-only) over the goldens so generator regressions | |
| # like undefined names or import-time breakage that ruff/flake8 do | |
| # not flag are caught at PR time. | |
| # See https://github.com/googleapis/google-cloud-python/issues/16393. | |
| - name: Pylint goldens (errors only) | |
| run: | | |
| pip install --quiet pylint | |
| cd packages/gapic-generator/tests/integration/goldens | |
| for pkg in credentials eventarc logging redis; do | |
| pylint --rcfile=.pylintrc --errors-only --recursive=y "$pkg/google" | |
| done | |
| goldens-prerelease: | |
| needs: python_config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ needs.python_config.outputs.prerelease_python }} | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ needs.python_config.outputs.prerelease_python }} | |
| allow-prereleases: true | |
| # Caches compiled wheels locally to prevent building heavy libraries | |
| # such as grpcio, which we build from scratch on every run for Python 3.15+. | |
| # Follow https://github.com/grpc/grpc/issues/41010 for updates. | |
| cache: 'pip' | |
| cache-dependency-path: '**/requirements*.txt' | |
| - name: Install System Deps | |
| run: sudo apt-get update && sudo apt-get install -y pandoc | |
| - name: Run Goldens (Prerelease) | |
| run: | | |
| pip install nox | |
| cd packages/gapic-generator | |
| for pkg in credentials eventarc logging redis; do | |
| nox -f tests/integration/goldens/$pkg/noxfile.py -s core_deps_from_source prerelease_deps | |
| done | |
| fragment-snippet: | |
| needs: python_config | |
| strategy: | |
| matrix: | |
| python: ${{ fromJSON(needs.python_config.outputs.trimmed_python) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| allow-prereleases: true | |
| # Caches compiled wheels locally to prevent building heavy libraries | |
| # such as grpcio, which we build from scratch on every run for Python 3.15+. | |
| # Follow https://github.com/grpc/grpc/issues/41010 for updates. | |
| cache: 'pip' | |
| cache-dependency-path: '**/requirements*.txt' | |
| - name: Install System Deps & Protoc | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y curl pandoc unzip | |
| sudo mkdir -p /usr/src/protoc/ && sudo chown -R ${USER} /usr/src/ | |
| curl --location https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip --output /usr/src/protoc/protoc.zip | |
| cd /usr/src/protoc/ && unzip protoc.zip | |
| sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc | |
| - name: Run Tests | |
| run: | | |
| pip install nox | |
| cd packages/gapic-generator | |
| # Run fragment for current matrix python | |
| nox -s fragment-${MATRIX_PYTHON} | |
| # Run snippetgen only on the latest stable to avoid the "Python not found" error | |
| if [ "${MATRIX_PYTHON}" == "${LATEST_STABLE_PYTHON}" ]; then | |
| nox -s snippetgen | |
| fi | |
| env: | |
| MATRIX_PYTHON: ${{ matrix.python }} | |
| LATEST_STABLE_PYTHON: ${{ needs.python_config.outputs.latest_stable_python }} | |
| integration: | |
| needs: python_config | |
| # Only runs if the Gatekeeper passed | |
| if: ${{ needs.python_config.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| container: gcr.io/gapic-images/googleapis # zizmor: ignore[unpinned-images] | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Cache Bazel files | |
| id: cache-bazel | |
| uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5 | |
| with: | |
| path: ~/.cache/bazel | |
| # Ensure CACHE_VERSION is defined in the mono-repo secrets! | |
| key: ${{ runner.os }}-bazel-20210105-${{ secrets.CACHE_VERSION }} | |
| - name: Run Bazel Integration Tests | |
| run: | | |
| # We need to move into the package directory if the | |
| # WORKSPACE file is located there. | |
| cd packages/gapic-generator | |
| bazelisk test //tests/integration/... --test_output=errors | |
| # Final job to simplify branch protection rules. | |
| # This job will be reported as 'Success' if all its dependencies either | |
| # pass or are skipped due to path filtering. | |
| status: | |
| needs: [check_changes, python_config, showcase-unit, showcase-mypy, goldens, goldens-prerelease, fragment-snippet, integration] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check all jobs for failure | |
| env: | |
| NEEDS_JSON: ${{ toJson(needs) }} | |
| run: | | |
| # 1. Print a human-readable list of each dependency job and its final status. | |
| echo "Job Results:" | |
| echo "$NEEDS_JSON" | jq -r 'to_entries[] | " - \(.key): \(.value.result)"' | |
| # 2. Evaluate if any job actually failed or was cancelled. | |
| if echo "$NEEDS_JSON" | jq -e 'to_entries[].value | select(.result == "failure" or .result == "cancelled")' >/dev/null; then | |
| echo "Error: One or more required jobs failed or were cancelled." | |
| exit 1 | |
| fi | |
| echo "All checks passed or were successfully skipped." | |