From 8c49cb9c661788ddbb8b39088ec61e1c6b712ff4 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 6 Mar 2024 17:21:22 -0500 Subject: [PATCH] Add linting with tox --- .github/workflows/check.yml | 34 ++++++++++++++++++++++++++++++++++ tox.ini | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/check.yml create mode 100644 tox.ini diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..8378bf5 --- /dev/null +++ b/.github/workflows/check.yml @@ -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 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..aa578ba --- /dev/null +++ b/tox.ini @@ -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:.}