Skip to content

Commit f2fb52e

Browse files
ci(python): run lint / unit tests / docs as GH actions (#172)
* ci(python): run lint / unit tests / docs as GH actions Source-Link: googleapis/synthtool@57be0cd Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 * add commit to trigger gh actions * work around template bug * add testing for python 3.10 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 7f90f37 commit f2fb52e

File tree

8 files changed

+143
-11
lines changed

8 files changed

+143
-11
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
docker:
215
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
3-
digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3
16+
digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6
17+

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: docs
6+
jobs:
7+
docs:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.10"
16+
- name: Install nox
17+
run: |
18+
python -m pip install --upgrade setuptools pip wheel
19+
python -m pip install nox
20+
- name: Run docs
21+
run: |
22+
nox -s docs
23+
docfx:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
- name: Setup Python
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: "3.10"
32+
- name: Install nox
33+
run: |
34+
python -m pip install --upgrade setuptools pip wheel
35+
python -m pip install nox
36+
- name: Run docfx
37+
run: |
38+
nox -s docfx

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: lint
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.10"
16+
- name: Install nox
17+
run: |
18+
python -m pip install --upgrade setuptools pip wheel
19+
python -m pip install nox
20+
- name: Run lint
21+
run: |
22+
nox -s lint
23+
- name: Run lint_setup_py
24+
run: |
25+
nox -s lint_setup_py

.github/workflows/unittest.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: unittest
6+
jobs:
7+
unit:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Setup Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- name: Install nox
20+
run: |
21+
python -m pip install --upgrade setuptools pip wheel
22+
python -m pip install nox
23+
- name: Run unit tests
24+
env:
25+
COVERAGE_FILE: .coverage-${{ matrix.python }}
26+
run: |
27+
nox -s unit-${{ matrix.python }}
28+
- name: Upload coverage results
29+
uses: actions/upload-artifact@v2
30+
with:
31+
name: coverage-artifacts
32+
path: .coverage-${{ matrix.python }}
33+
34+
cover:
35+
runs-on: ubuntu-latest
36+
needs:
37+
- unit
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
- name: Setup Python
42+
uses: actions/setup-python@v2
43+
with:
44+
python-version: "3.10"
45+
- name: Install coverage
46+
run: |
47+
python -m pip install --upgrade setuptools pip wheel
48+
python -m pip install coverage
49+
- name: Download coverage results
50+
uses: actions/download-artifact@v2
51+
with:
52+
name: coverage-artifacts
53+
path: .coverage-results/
54+
- name: Report coverage results
55+
run: |
56+
coverage combine .coverage-results/.coverage*
57+
coverage report --show-missing --fail-under=99

CONTRIBUTING.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.
25+
3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7272

7373
- To run a single unit test::
7474

75-
$ nox -s unit-3.9 -- -k <name of test>
75+
$ nox -s unit-3.10 -- -k <name of test>
7676

7777

7878
.. note::
@@ -225,11 +225,13 @@ We support:
225225
- `Python 3.7`_
226226
- `Python 3.8`_
227227
- `Python 3.9`_
228+
- `Python 3.10`_
228229

229230
.. _Python 3.6: https://docs.python.org/3.6/
230231
.. _Python 3.7: https://docs.python.org/3.7/
231232
.. _Python 3.8: https://docs.python.org/3.8/
232233
.. _Python 3.9: https://docs.python.org/3.9/
234+
.. _Python 3.10: https://docs.python.org/3.10/
233235

234236

235237
Supported versions can be found in our ``noxfile.py`` `config`_.

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
DEFAULT_PYTHON_VERSION = "3.8"
3131
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
32-
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
32+
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
3333

3434
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
3535

owlbot.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
microgenerator=True,
1111
cov_level=99,
1212
unit_test_external_dependencies=["click"],
13-
unit_test_python_versions=["3.6", "3.7", "3.8", "3.9"],
1413
)
1514
s.move(templated_files, excludes=[
1615
"docs/multiprocessing.rst"
@@ -36,11 +35,7 @@
3635
'"--cov=google_auth_oauthlib",',
3736
)
3837

39-
# Block pushing non-cloud libraries to Cloud RAD
40-
s.replace(
41-
".kokoro/docs/common.cfg",
42-
r'value: "docs-staging-v2"',
43-
r'value: "docs-staging-v2-staging"'
44-
)
38+
# Work around bug in templates https://github.com/googleapis/synthtool/pull/1335
39+
s.replace(".github/workflows/unittest.yml", "--fail-under=100", "--fail-under=99")
4540

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

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"Programming Language :: Python :: 3.7",
5555
"Programming Language :: Python :: 3.8",
5656
"Programming Language :: Python :: 3.9",
57+
"Programming Language :: Python :: 3.10",
5758
"Development Status :: 3 - Alpha",
5859
"Intended Audience :: Developers",
5960
"License :: OSI Approved :: Apache Software License",

0 commit comments

Comments
 (0)