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(python): run lint / unit tests / docs as GH actions #336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/.OwlBot.lock.yaml
@@ -1,3 +1,16 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3
digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6
4 changes: 3 additions & 1 deletion .github/sync-repo-settings.yaml
Expand Up @@ -9,7 +9,8 @@ branchProtectionRules:
requiredStatusCheckContexts:
- 'cla/google'
# No Kokoro: the following are Github actions
- 'lint-mypy'
- 'lint'
- 'mypy'
- 'unit-3.6'
- 'unit-3.7'
- 'unit-3.8'
Expand All @@ -24,6 +25,7 @@ branchProtectionRules:
- 'unit_wo_grpc-3.10'
- 'cover'
- 'docs'
- 'docfx'
permissionRules:
- team: actools-python
permission: admin
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/docs.yml
@@ -1,25 +1,38 @@
name: "Docs"

on:
pull_request:
branches:
- main
name: docs
jobs:
run-docs:
name: docs
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.10"
- name: Install nox
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install nox
- name: Run docs
run: |
nox -s docs docfx

nox -s docs
docfx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install nox
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install nox
- name: Run docfx
run: |
nox -s docfx
9 changes: 2 additions & 7 deletions .github/workflows/lint.yml
@@ -1,12 +1,10 @@
name: "Lint"

on:
pull_request:
branches:
- main
name: lint
jobs:
run-lint-mypy:
name: lint-mypy
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -25,6 +23,3 @@ jobs:
- name: Run lint_setup_py
run: |
nox -s lint_setup_py
- name: Run mypy
run: |
nox -s mypy
22 changes: 22 additions & 0 deletions .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@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install nox
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install nox
- name: Run mypy
run: |
nox -s mypy
4 changes: 4 additions & 0 deletions owlbot.py
Expand Up @@ -28,6 +28,7 @@
".flake8", # flake8-import-order, layout
".coveragerc", # layout
"CONTRIBUTING.rst", # no systests
".github/workflows/unittest.yml", # exclude unittest gh action
]
templated_files = common.py_library(microgenerator=True, cov_level=100)
s.move(templated_files, excludes=excludes)
Expand All @@ -44,4 +45,7 @@
""",
)

s.replace(".github/workflows/lint.yml", "python-version: \"3.10\"", "python-version: \"3.7\"")


s.shell.run(["nox", "-s", "blacken"], hide_output=False)