Skip to content

Commit

Permalink
add lint and type check jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
collerek committed Jan 25, 2024
1 parent a737001 commit c5a10fb
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 657 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: lint

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master ]

jobs:
lint:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install poetry==1.4.2
poetry install --extras "all"
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Lint
run: make style
31 changes: 31 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: type_check

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master ]

jobs:
lint:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install poetry==1.4.2
poetry install --extras "all"
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Lint
run: make type_check
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ test:
coverage:
pytest --cov=ormar --cov=tests --cov-fail-under=100 --cov-report=term-missing

black:
black ormar tests

fmt:
poetry run python -m black --line-length=120 .

type_check:
mkdir -p .mypy_cache && poetry run python -m mypy . --ignore-missing-imports --install-types --non-interactive

lint:
black ormar tests
flake8 ormar
poetry run python -m ruff . --fix

mypy:
mypy ormar tests
style: fmt lint
Loading

0 comments on commit c5a10fb

Please sign in to comment.