-
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(python): run lint / unit tests / docs as GH actions (#1333)
* ci: run lint / unit tests / docs as GH actions * remove hardcoded versions * remove jinja escaping
- Loading branch information
Showing
3 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
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,38 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
name: docs | ||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "{{ unit_test_python_versions | last }}" | ||
- 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: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "{{ unit_test_python_versions | last }}" | ||
- name: Install nox | ||
run: | | ||
python -m pip install --upgrade setuptools pip wheel | ||
python -m pip install nox | ||
- name: Run docfx | ||
run: | | ||
nox -s docfx |
25 changes: 25 additions & 0 deletions
25
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,25 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
name: lint | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "{{ unit_test_python_versions | last }}" | ||
- 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 |
57 changes: 57 additions & 0 deletions
57
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,57 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
name: unittest | ||
jobs: | ||
unit: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: {{unit_test_python_versions}} | ||
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.python {{ '}}' }} | ||
run: | | ||
nox -s unit-${{ '{{' }} matrix.python {{ '}}' }} | ||
- name: Upload coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage-artifacts | ||
path: .coverage-${{ '{{' }} matrix.python {{ '}}' }} | ||
|
||
cover: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- unit | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "{{ unit_test_python_versions | last }}" | ||
- 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 |