diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index c2f3673fcc..37874a6888 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -12,6 +12,7 @@ branchProtectionRules: - 'cla/google' - 'docs' - 'lint' + - 'mypy' - 'unit (3.9)' - 'unit (3.10)' - 'unit (3.11)' diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000000..e6a79291d0 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,22 @@ +on: + pull_request: + branches: + - main +name: mypy +jobs: + mypy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run mypy + run: | + nox -s mypy diff --git a/noxfile.py b/noxfile.py index a08ef27781..bb2828faf4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -145,7 +145,12 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", BLACK_VERSION) + session.install("flake8", BLACK_VERSION, ISORT_VERSION) + session.run( + "isort", + "--check", + *LINT_PATHS, + ) session.run( "black", "--check",