Skip to content

Commit

Permalink
fix: accept 4.x protobuf for gapic-generator-python (#1453)
Browse files Browse the repository at this point in the history
Also update github actions configs and make SHOWCASE and PROTOC global environment variables
This is needed because newest version of grpc already require protobuf 4.x and it makes our showcase tests fail
  • Loading branch information
vam-google authored Sep 19, 2022
1 parent ae3e6bf commit d9099dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ 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
Expand Down Expand Up @@ -66,8 +70,6 @@ jobs:
tar -xf showcase-*
./gapic-showcase run &
cd -
env:
SHOWCASE_VERSION: 0.25.0
- name: Install nox.
run: python -m pip install nox
- name: Install protoc
Expand All @@ -78,8 +80,6 @@ jobs:
cd /usr/src/protoc/
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
env:
PROTOC_VERSION: 3.19.0
- name: Run showcase tests.
run: nox -s ${{ matrix.target }}
showcase-mtls:
Expand Down Expand Up @@ -108,13 +108,13 @@ jobs:
sudo apt-get install -y curl pandoc unzip gcc
- name: Install nox.
run: python -m pip install nox
- name: Install protoc 3.19.0.
- 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/v3.19.0/protoc-3.19.0-linux-x86_64.zip --output /usr/src/protoc/protoc-3.19.0.zip
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-3.19.0.zip
unzip protoc-${PROTOC_VERSION}.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
cd -
- name: Run showcase tests.
Expand All @@ -127,8 +127,6 @@ jobs:
cd ..
nox -s ${{ matrix.target }}
env:
SHOWCASE_VERSION: 0.19.0
# TODO(yon-mg): add compute unit tests
showcase-unit:
strategy:
Expand All @@ -147,20 +145,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip gcc
- name: Install protoc 3.19.0.
- 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/v3.19.0/protoc-3.19.0-linux-x86_64.zip --output /usr/src/protoc/protoc-3.19.0.zip
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-3.19.0.zip
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 }}
env:
SHOWCASE_VERSION: 0.19.0
showcase-unit-add-iam-methods:
runs-on: ubuntu-latest
steps:
Expand All @@ -174,20 +170,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip gcc
- name: Install protoc 3.19.0.
- 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/v3.19.0/protoc-3.19.0-linux-x86_64.zip --output /usr/src/protoc/protoc-3.19.0.zip
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-3.19.0.zip
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
env:
SHOWCASE_VERSION: 0.19.0
showcase-mypy:
runs-on: ubuntu-latest
strategy:
Expand All @@ -204,20 +198,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y curl pandoc unzip gcc
- name: Install protoc 3.19.0.
- 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/v3.19.0/protoc-3.19.0-linux-x86_64.zip --output /usr/src/protoc/protoc-3.19.0.zip
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-3.19.0.zip
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 }}
env:
SHOWCASE_VERSION: 0.19.0
snippetgen:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"googleapis-common-protos >= 1.55.0",
"grpcio >= 1.24.3",
"jinja2 >= 2.10",
"protobuf >= 3.18.0, <4.0.0dev",
"protobuf >= 3.18.0, < 5.0.0dev",
"pypandoc >= 1.4",
"PyYAML >= 5.1.1",
"grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev",
Expand Down

0 comments on commit d9099dd

Please sign in to comment.