diff --git a/.github/workflows/python-build-test.yml b/.github/workflows/python-build-test.yml index 1064db3..1dae4f6 100644 --- a/.github/workflows/python-build-test.yml +++ b/.github/workflows/python-build-test.yml @@ -18,23 +18,11 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 - with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest mypy black - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - flake8 src/pyprojroot tests - - name: MyPy (type) checking - run: | - mypy --strict src/pyprojroot - - name: Format with black - run: | - black --check --diff src/pyprojroot tests - - name: Test with pytest - run: | - PYTHONPATH=src pytest + pip install tox tox-gh-actions + - name: Run all tests with tox + run: tox diff --git a/pyproject.toml b/pyproject.toml index 1189c5c..75678c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ dev = [ "flake8~=3.8.4", "twine~=4.0.2", "build~=0.10.0", + "tox~=4.4.7" ] test = [ "pytest>=6.2.5", diff --git a/tox.ini b/tox.ini index da1f29b..6452cbd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,38 @@ [tox] -env_list = - py{37,38,39,310,311} +env_list = lint, format, type, py{37,38,39,310,311} minversion = 4.4.7 [testenv] description = run the tests with pytest package = wheel wheel_build_env = .pkg -deps = - pytest>=6.2.5 -commands = - pytest {tty:--color=yes} {posargs} +deps = pytest>=6.2.5 +commands = pytest {tty:--color=yes} {posargs} + +[testenv:lint] +description = run flake8 +skip_install = true +basepython = python3.11 +deps = flake8~=3.8.4 +commands = flake8 {posargs:src/pyprojroot tests} + +[testenv:format] +description = run black +basepython = python3.11 +deps = black~=19.3b0 +skip_install = true +commands = black --check --diff src/pyprojroot tests + +[testenv:type] +description = run type checks +basepython = python3.11 +deps = mypy~=0.720 +commands = mypy --strict {posargs:src/pyprojroot} + +[gh-actions] +python = + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311, lint, format, type