Skip to content

test: update version of googleapis/googleapis used for goldens #2575

test: update version of googleapis/googleapis used for goldens

test: update version of googleapis/googleapis used for goldens #2575

Workflow file for this run

name: Tests
# Controls when the action will run.
on:
pull_request:
push:
branches: [ $default-branch ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: tests-${{ github.head_ref }}
cancel-in-progress: true
env:
SHOWCASE_VERSION: 0.25.0
PROTOC_VERSION: 3.20.2
jobs:
docs:
# Don't upgrade python version; there's a bug in 3.10 sphinx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: 'pip'
- name: Install nox.
run: python -m pip install nox
- name: Build the documentation.
run: nox -s docs
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install nox.
run: python -m pip install nox
- name: Check type annotations.
run: nox -s mypy
showcase:
strategy:
matrix:
target: [showcase, showcase_alternative_templates]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install showcase
run: |
sudo mkdir -p /usr/src/showcase
sudo chown -R ${USER} /usr/src/
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz
cd /usr/src/showcase/
tar -xf showcase-*
./gapic-showcase run &
cd -
- name: Install nox.
run: python -m pip install nox
- name: Install protoc
run: |
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-${PROTOC_VERSION}.zip
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Run showcase tests.
run: nox -s ${{ matrix.target }}
showcase-mtls:
if: ${{ false }} # TODO(dovs): reenable when #1218 is fixed
strategy:
matrix:
target: [showcase_mtls, showcase_mtls_alternative_templates]
max-parallel: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup temp directory
run: |
sudo mkdir -p /tmp/workspace/tests/cert/
sudo chown -R ${USER} /tmp/workspace/
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Copy mtls files
run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install nox.
run: python -m pip install nox
- name: Install protoc.
run: |
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-${PROTOC_VERSION}.zip
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
cd -
- name: Run showcase tests.
run: |
sudo mkdir gapic_showcase
sudo chown ${USER} gapic_showcase
cd gapic_showcase
curl -sSL https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz | tar xz
./gapic-showcase run --mtls-ca-cert=/tmp/workspace/tests/cert/mtls.crt --mtls-cert=/tmp/workspace/tests/cert/mtls.crt --mtls-key=/tmp/workspace/tests/cert/mtls.key &
cd ..
nox -s ${{ matrix.target }}
# TODO(yon-mg): add compute unit tests
showcase-unit:
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "${{ matrix.python }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python }}"
cache: 'pip'
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install protoc.
run: |
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-${PROTOC_VERSION}.zip
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Install nox.
run: python -m pip install nox
- name: Run unit tests.
run: nox -s showcase_unit${{ matrix.variant }}-${{ matrix.python }}
showcase-unit-add-iam-methods:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install protoc.
run: |
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-${PROTOC_VERSION}.zip
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Install nox.
run: python -m pip install nox
- name: Run unit tests.
run: nox -s showcase_unit_add_iam_methods
showcase-mypy:
runs-on: ubuntu-latest
strategy:
matrix:
variant: ['', _alternative_templates]
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install protoc.
run: |
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-${PROTOC_VERSION}.zip
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Install nox.
run: python -m pip install nox
- name: Typecheck the generated output.
run: nox -s showcase_mypy${{ matrix.variant }}
snippetgen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip
- name: Install nox.
run: python -m pip install nox
- name: Check autogenerated snippets.
run: nox -s snippetgen
unit:
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc gcc git
- name: Install nox.
run: |
python -m pip install nox
- name: Run unit tests.
run: nox -s unit-${{ matrix.python }}
fragment:
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
variant: ['', _alternative_templates]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc gcc git
- name: Install nox.
run: |
python -m pip install nox
- name: Run fragment tests.
run: nox -s fragment${{ matrix.variant }}-${{ matrix.python }}
integration:
runs-on: ubuntu-latest
container: gcr.io/gapic-images/googleapis
steps:
- uses: actions/checkout@v3
- name: Cache Bazel files
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
# Note: if the container is updated, the key needs to be updated as well.
key: ${{ runner.os }}-bazel-20210105-${{ secrets.CACHE_VERSION }}
- name: Cache not found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Cache found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/gapic-generator-python/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."
- name: Integration Tests
run: bazel test //tests/integration/... --test_output=errors
goldens-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install nox.
run: |
python -m pip install nox
- name: Run blacken and lint on the generated output.
run: |
nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.11 blacken lint_setup_py lint
nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.11 blacken lint_setup_py lint
nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.11 blacken lint_setup_py lint
nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.11 blacken lint_setup_py lint
nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.11 blacken lint_setup_py lint
style-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.11"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- name: Install autopep8
run: |
python -m pip install autopep8
- name: Check diff
run: |
find gapic tests -name "*.py" -not -path 'tests/**/goldens/*' | xargs autopep8 --diff --exit-code