Skip to content

Commit

Permalink
Add linting with tox
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Mar 6, 2024
1 parent b32900b commit 8c49cb9
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: check
on:
push:
pull_request:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: test with ${{ matrix.py }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install tox
run: python -m pip install tox-gh>=1.2
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
run: tox --skip-pkg-install
36 changes: 36 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[tox]
envlist = flake8,black,isort,test

[flake8]
ignore = E731,W504,W503
max-line-length = 100
exclude =
./.tox
./.git
./.env
./.direnv
[isort]
profile = black

[testenv:flake8]
basepython = python3
skip_install = true
deps = flake8
commands = flake8 {posargs}

[testenv:black]
skip_install = true
deps = black
commands = black --check --diff {posargs:tests}

[testenv:black-format]
# this step format code automatically based on black rules
# it can be triggered manually
skip_install = true
deps = black
commands = black {posargs:tests}

[testenv:isort]
skip_install = true
deps = isort
commands = isort --check --diff {posargs:.}

0 comments on commit 8c49cb9

Please sign in to comment.