Update linters + fixes (#27) #38
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
prepare-env: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Install dependencies | |
run: poetry install --with test,dev | |
- name: Cache Poetry installation | |
id: cache-poetry-install | |
uses: actions/cache@v2 | |
with: | |
path: ~/.poetry | |
key: ${{ runner.os }}-poetry-installation-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry-installation- | |
- name: Cache Poetry virtual environment | |
id: cache-poetry-venv | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-venv-${{ hashFiles('**/poetry.lock') }}-3.9 | |
restore-keys: | | |
${{ runner.os }}-poetry-venv-${{ hashFiles('**/poetry.lock') }}- | |
checks: | |
needs: prepare-env | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
command: | |
- "black --check ." | |
- "isort --check ." | |
- "ruff ." | |
- "mypy ." | |
- "pytest -v ." | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Cache Poetry installation | |
uses: actions/cache@v2 | |
with: | |
path: ~/.poetry | |
key: ${{ runner.os }}-poetry-installation-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry-installation- | |
- name: Cache Poetry virtual environment | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-venv-${{ hashFiles('**/poetry.lock') }}-3.9 | |
restore-keys: | | |
${{ runner.os }}-poetry-venv-${{ hashFiles('**/poetry.lock') }}- | |
- name: Install Poetry | |
if: steps.cache-poetry-install.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Install dependencies | |
if: steps.cache-poetry-venv.outputs.cache-hit != 'true' | |
run: poetry install | |
- name: Run check | |
run: | | |
source $(poetry env info --path)/bin/activate | |
${{ matrix.command }} | |