Skip to content

Commit

Permalink
ci: run lint / unit tests / docs as GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Jan 17, 2022
1 parent 620b9ca commit 27494be
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
27 changes: 27 additions & 0 deletions synthtool/gcp/templates/python_library/.github/workflows/docs.yml
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 synthtool/gcp/templates/python_library/.github/workflows/lint.yml
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 %}
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 %}

0 comments on commit 27494be

Please sign in to comment.