diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0616c32..5ad5ffe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,33 +9,31 @@ on: permissions: {} jobs: - build: - + test: + name: test with ${{ matrix.env }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - platform: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] - python-version: [3.9, "3.10", 3.11, 3.12, 3.13] - - name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} - runs-on: ${{ matrix.platform }} - + env: [3.9, "3.10", 3.11, 3.12, 3.13] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: submodules: true persist-credentials: false - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2 - pip install setuptools tox tox-gh-actions - - - name: Test with tox - run: tox + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + - name: Install tox + run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv --with tox-gh + - name: Install Python + if: matrix.env != '3.13' + run: uv python install --python-preference only-managed ${{ matrix.env }} + - name: Setup test suite + run: tox run -vv --notest --skip-missing-interpreters false + env: + TOX_GH_MAJOR_MINOR: ${{ matrix.env }} + - name: Run test suite + run: tox run --skip-pkg-install + env: + TOX_GH_MAJOR_MINOR: ${{ matrix.env }} diff --git a/pyproject.toml b/pyproject.toml index 613305d..386c596 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,6 @@ classifiers = [ dev = [ "pytest>=8.3.5", "pytest-httpserver>=1.0.10", - "types-requests>=2.32.0.20250328", ] lint = [ "black>=25.1.0", @@ -44,6 +43,7 @@ lint = [ "mypy>=1.15.0", "pylint>=3.3.6", "ruff>=0.11.6", + "types-requests>=2.32.0.20250328", ] [project.urls] @@ -96,3 +96,43 @@ ignorelist = ["id"] [tool.setuptools.package-data] minfraud = ["py.typed"] + +[tool.tox] +env_list = [ + "3.9", + "3.10", + "3.11", + "3.12", + "3.13", + "lint", +] +skip_missing_interpreters = false + +[tool.tox.env_run_base] +dependency_groups = [ + "dev", +] +commands = [ + ["pytest", "tests"], +] + +[tool.tox.env.lint] +description = "Code linting" +python = "3.13" +dependency_groups = [ + "dev", + "lint", +] +commands = [ + ["black", "--check", "--diff", "."], + ["flake8", "minfraud"], + ["mypy", "minfraud", "tests"], + ["pylint", "minfraud"], +] + +[tool.tox.gh.python] +"3.13" = ["3.13", "lint"] +"3.12" = ["3.12"] +"3.11" = ["3.11"] +"3.10" = ["3.10"] +"3.9" = ["3.9"] diff --git a/setup.cfg b/setup.cfg index 76e975f..a8d4688 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,42 +1,3 @@ [flake8] # black uses 88 : ¯\_(ツ)_/¯ max-line-length = 88 - -[tox:tox] -envlist = {py39,py310,py311,py313}-test,py313-{black,lint,flake8,mypy} - -[gh-actions] -python = - 3.9: py39 - 3.10: py310 - 3.11: py311 - 3.12: py312 - 3.13: py313,black,lint,flake8,mypy - -[testenv:{py38,py39,py310,py311,py312,py313}-test] -deps = - pytest-httpserver - pytest - -commands = pytest tests - -[testenv:py313-black] -deps = black -commands = black --check --diff . - -[testenv:py313-lint] -deps = pylint -commands = pylint minfraud - -[testenv:py313-flake8] -deps = flake8 -commands = flake8 minfraud - -[testenv:py313-mypy] -deps = - mypy - pytest_httpserver - pytest - types-requests - voluptuous-stubs -commands = mypy minfraud tests