Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: run goldens through mypy #1096

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ jobs:
echo "The old one will disappear after 7 days."
- name: Integration Tests
run: bazel test tests/integration:asset tests/integration:credentials tests/integration:logging tests/integration:redis
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install nox.
run: |
python -m pip install nox
- name: Typecheck the generated output.
run: nox -s goldens_mypy
style-check:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 16 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def run_showcase_unit_tests(session, fail_under=100):
*(session.posargs or [path.join("tests", "unit")]),
)


@nox.session(python=ALL_PYTHON)
def showcase_unit(
session, templates="DEFAULT", other_opts: typing.Iterable[str] = (),
Expand Down Expand Up @@ -370,6 +369,22 @@ def showcase_mypy_alternative_templates(session):
showcase_mypy(session, templates=ADS_TEMPLATES, other_opts=("old-naming",))


@nox.session(python=NEWEST_PYTHON)
def goldens_mypy(session):
"""Perform typecheck analysis on the golden generated libraries

This may catch additional issues that are not found in the showcase protos."""

session.install("mypy", "types-pkg-resources")
goldens_dir = Path("tests/integration/goldens").absolute()

for library_dir in goldens_dir.glob("*/"):
session.chdir(library_dir.absolute())
session.install(".")

session.run("mypy", "--explicit-package-bases", "google")


@nox.session(python=NEWEST_PYTHON)
def snippetgen(session):
# Clone googleapis/api-common-protos which are referenced by the snippet
Expand Down