|
| 1 | +name: Gapic Generator Specialized Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'packages/gapic-generator/**' |
| 7 | + - '.github/workflows/gapic-generator-tests.yml' |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + paths: |
| 11 | + - 'packages/gapic-generator/**' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: gapic-gen-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +env: |
| 18 | + SHOWCASE_VERSION: 0.35.0 |
| 19 | + PROTOC_VERSION: 3.20.2 |
| 20 | + OLDEST_PYTHON: 3.9 |
| 21 | + LATEST_STABLE_PYTHON: 3.14 |
| 22 | + PREVIEW_PYTHON_VERSION: 3.14 |
| 23 | + ALL_PYTHON: "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']" |
| 24 | + |
| 25 | +jobs: |
| 26 | + # Preserve the workaround for env variables in matrix |
| 27 | + python_config: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + outputs: |
| 30 | + all_python: ${{ env.ALL_PYTHON }} |
| 31 | + oldest_python: ${{ env.OLDEST_PYTHON }} |
| 32 | + latest_stable_python: ${{ env.LATEST_STABLE_PYTHON }} |
| 33 | + steps: |
| 34 | + - run: echo "Initializing config" |
| 35 | + |
| 36 | + showcase-unit: |
| 37 | + needs: python_config |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + python: ${{ fromJSON(needs.python_config.outputs.all_python) }} |
| 42 | + variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async] |
| 43 | + logging_scope: ["", "google"] |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v5 |
| 47 | + - name: Set up Python |
| 48 | + uses: actions/setup-python@v6 |
| 49 | + with: |
| 50 | + python-version: "${{ matrix.python }}" |
| 51 | + - name: Install System Deps & Protoc |
| 52 | + run: | |
| 53 | + sudo apt-get update && sudo apt-get install -y curl pandoc unzip |
| 54 | + sudo mkdir -p /usr/src/protoc/ && sudo chown -R ${USER} /usr/src/ |
| 55 | + 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 |
| 56 | + cd /usr/src/protoc/ && unzip protoc.zip |
| 57 | + sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc |
| 58 | + - name: Run Nox |
| 59 | + env: |
| 60 | + GOOGLE_SDK_PYTHON_LOGGING_SCOPE: ${{ matrix.logging_scope }} |
| 61 | + run: | |
| 62 | + pip install nox |
| 63 | + cd packages/gapic-generator |
| 64 | + nox -s showcase_unit${{ matrix.variant }}-${{ matrix.python }} |
| 65 | +
|
| 66 | + goldens: |
| 67 | + needs: python_config |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v5 |
| 71 | + - name: Set up Python |
| 72 | + uses: actions/setup-python@v6 |
| 73 | + with: |
| 74 | + python-version: ${{ env.LATEST_STABLE_PYTHON }} |
| 75 | + - name: Run Goldens (Lint/Unit) |
| 76 | + run: | |
| 77 | + pip install nox |
| 78 | + cd packages/gapic-generator |
| 79 | + # Running the logic from goldens-lint and goldens-unit combined |
| 80 | + for pkg in credentials eventarc logging redis; do |
| 81 | + nox -f tests/integration/goldens/$pkg/noxfile.py -s format lint unit-${{ env.LATEST_STABLE_PYTHON }} |
| 82 | + done |
| 83 | +
|
| 84 | + fragment-snippet: |
| 85 | + needs: python_config |
| 86 | + strategy: |
| 87 | + matrix: |
| 88 | + python: ["3.10", "3.14"] # Reduced matrix for efficiency, or use all_python |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v5 |
| 92 | + - name: Set up Python |
| 93 | + uses: actions/setup-python@v6 |
| 94 | + with: |
| 95 | + python-version: ${{ matrix.python }} |
| 96 | + - name: Run Tests |
| 97 | + run: | |
| 98 | + pip install nox |
| 99 | + cd packages/gapic-generator |
| 100 | + nox -s fragment-${{ matrix.python }} snippetgen |
0 commit comments