Skip to content

Commit 6c6c303

Browse files
ci(python): run lint / unit tests / docs as GH actions (#473)
* 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 bug in templates Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent d453974 commit 6c6c303

File tree

5 files changed

+138
-1
lines changed

5 files changed

+138
-1
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:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828
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.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=96

owlbot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def cover(session):""",
176176
[".github/header-checker-lint.yml"], '"Google LLC"', '"pandas-gbq Authors"',
177177
)
178178

179+
# Work around bug in templates https://github.com/googleapis/synthtool/pull/1335
180+
s.replace(".github/workflows/unittest.yml", "--fail-under=100", "--fail-under=96")
181+
179182
# ----------------------------------------------------------------------------
180183
# Samples templates
181184
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)