Merge pull request #8 from kaitj/docs/readthedocs #71
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
--- | |
name: Lint and test workflow | |
on: | |
push: | |
branches: ['*', '!push-action/*'] | |
pull_request: | |
branches: ['*', '!push-action/*'] | |
jobs: | |
quality: | |
name: Lint code | |
if: github.event.pull_request.merged == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@master | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-3.10 | |
restore-keys: ${{ runner.os }}-pip-3.10 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-3.10 | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root --with dev | |
- name: yamlfix | |
run: poetry run poe yamlfix-check | |
- name: isort | |
run: poetry run poe isort-check | |
- name: black | |
run: poetry run poe black-check | |
- name: ruff | |
run: poetry run poe ruff-check | |
test: | |
runs-on: ubuntu-latest | |
needs: [quality] | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10'] | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@master | |
- name: Select Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }} | |
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version | |
}} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root --with dev | |
- name: Install library | |
run: poetry install --no-interaction --with dev | |
- name: Perform unit testing | |
run: poetry run poe test_cov | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ../cov.xml |