Skip to content

Commit 95e41ff

Browse files
ci(python): run lint / unit tests / docs as GH actions (#336)
* 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 * revert changes to unittest gh action * move mypy check into separate workflow * update .sync-repo-settings to reflect changes to gh checks * use python 3.7 for lint check Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 5e5ad37 commit 95e41ff

File tree

6 files changed

+65
-16
lines changed

6 files changed

+65
-16
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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

.github/sync-repo-settings.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ branchProtectionRules:
99
requiredStatusCheckContexts:
1010
- 'cla/google'
1111
# No Kokoro: the following are Github actions
12-
- 'lint-mypy'
12+
- 'lint'
13+
- 'mypy'
1314
- 'unit-3.6'
1415
- 'unit-3.7'
1516
- 'unit-3.8'
@@ -24,6 +25,7 @@ branchProtectionRules:
2425
- 'unit_wo_grpc-3.10'
2526
- 'cover'
2627
- 'docs'
28+
- 'docfx'
2729
permissionRules:
2830
- team: actools-python
2931
permission: admin

.github/workflows/docs.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
name: "Docs"
2-
31
on:
42
pull_request:
53
branches:
64
- main
5+
name: docs
76
jobs:
8-
run-docs:
9-
name: docs
7+
docs:
108
runs-on: ubuntu-latest
119
steps:
1210
- name: Checkout
1311
uses: actions/checkout@v2
1412
- name: Setup Python
1513
uses: actions/setup-python@v2
1614
with:
17-
python-version: "3.7"
15+
python-version: "3.10"
1816
- name: Install nox
1917
run: |
2018
python -m pip install --upgrade setuptools pip wheel
2119
python -m pip install nox
2220
- name: Run docs
2321
run: |
24-
nox -s docs docfx
25-
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: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: "Lint"
2-
31
on:
42
pull_request:
53
branches:
64
- main
5+
name: lint
76
jobs:
8-
run-lint-mypy:
9-
name: lint-mypy
7+
lint:
108
runs-on: ubuntu-latest
119
steps:
1210
- name: Checkout
@@ -25,6 +23,3 @@ jobs:
2523
- name: Run lint_setup_py
2624
run: |
2725
nox -s lint_setup_py
28-
- name: Run mypy
29-
run: |
30-
nox -s mypy

.github/workflows/mypy.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: mypy
6+
jobs:
7+
mypy:
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.7"
16+
- name: Install nox
17+
run: |
18+
python -m pip install --upgrade setuptools pip wheel
19+
python -m pip install nox
20+
- name: Run mypy
21+
run: |
22+
nox -s mypy

owlbot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
".flake8", # flake8-import-order, layout
2929
".coveragerc", # layout
3030
"CONTRIBUTING.rst", # no systests
31+
".github/workflows/unittest.yml", # exclude unittest gh action
3132
]
3233
templated_files = common.py_library(microgenerator=True, cov_level=100)
3334
s.move(templated_files, excludes=excludes)
@@ -44,4 +45,7 @@
4445
""",
4546
)
4647

48+
s.replace(".github/workflows/lint.yml", "python-version: \"3.10\"", "python-version: \"3.7\"")
49+
50+
4751
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 commit comments

Comments
 (0)