Lint and rebase #134
This file contains hidden or 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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
env: | |
DEFAULT_PYTHON_VERSION: "3.10" | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
code_style: | |
name: ${{ matrix.check.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
check: | |
- name: Code Formatting | black | |
command: black --check . | |
- name: Import Ordering | isort | |
command: isort --check . | |
- name: Linting | flake8 | |
command: flake8 . | |
- name: Type Checking | mypy | |
command: mypy . --cache-dir=/dev/null | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | |
- name: Cache Python Environment | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-pyenv-${{ hashFiles('dev-requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pyenv- | |
- name: Install Development Requirements | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install -r dev-requirements.txt | |
- name: Run Code Style Check | |
run: | | |
source .venv/bin/activate | |
${{ matrix.check.command }} | |
unit_tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | |
- name: Cache Python Environment | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-pyenv-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pyenv- | |
- name: Install Development Requirements | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.txt | |
- name: Run Tests | |
run: | | |
source .venv/bin/activate | |
make tests | |