-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: run lint / unit tests / docs as GH actions
- Loading branch information
Showing
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
synthtool/gcp/templates/python_library/.github/workflows/docs.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% raw -%} | ||
name: "Docs" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-docs: | ||
name: docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
- 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 | ||
{% endraw %} |
30 changes: 30 additions & 0 deletions
30
synthtool/gcp/templates/python_library/.github/workflows/lint.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% raw -%} | ||
name: "Lint" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
- name: Install nox | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install nox | ||
- name: Run lint | ||
run: | | ||
nox -s lint | ||
- name: Run lint_setup_py | ||
run: | | ||
nox -s lint_setup_py | ||
{% endraw %} |
68 changes: 68 additions & 0 deletions
68
synthtool/gcp/templates/python_library/.github/workflows/unittest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{% raw -%} | ||
name: "Unit tests" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-unittests: | ||
name: unit-${{ matrix.python }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Install nox | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install nox | ||
- name: Run unit tests | ||
env: | ||
COVERAGE_FILE: .coverage${{ matrix.option }}-${{matrix.python }} | ||
run: | | ||
nox -s unit${{ matrix.option }}-${{ matrix.python }} | ||
- name: Upload coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage-artifacts | ||
path: .coverage${{ matrix.option }}-${{ matrix.python }} | ||
|
||
report-coverage: | ||
name: cover | ||
runs-on: ubuntu-latest | ||
needs: | ||
- run-unittests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- name: Install coverage | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install coverage | ||
- name: Download coverage results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: coverage-artifacts | ||
path: .coverage-results/ | ||
- name: Report coverage results | ||
run: | | ||
coverage combine .coverage-results/.coverage* | ||
coverage report --show-missing --fail-under=100 | ||
{% endraw %} |