From 8fe1ad0fe790ffc55c92f31366d99abd1069d5eb Mon Sep 17 00:00:00 2001 From: ARYAN-NIKNEZHAD Date: Fri, 16 Aug 2024 05:27:30 +0430 Subject: [PATCH] :wrench: chore: Add Tox configuration and update CI workflow for multi-environment testing - Added to configure automated testing across multiple Python and Django versions. - Updated GitHub Actions workflow to incorporate Tox for testing. - Ensured CI runs Tox tests before building and publishing the package to PyPI. - Included for seamless integration of Tox with GitHub Actions. - Set conditional steps to build and publish the package only if all tests pass. --- .github/workflows/ci.yml | 2 ++ pyproject.toml | 4 +++- tox.ini | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tox.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86406f5..b0659af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: coverage run -m pytest - name: Generate coverage report run: coverage xml + - name: Run Tox tests + run: tox - name: Upload coverage to Codecov run: codecov env: diff --git a/pyproject.toml b/pyproject.toml index 99e8c9a..e8a9444 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,9 @@ authors = ["Sepehr Akbarzadeh "] license = "GNU" keywords = ["django", "iranian", "cities"] repository = "https://github.com/sageteamorg/django-iranian-cities" - +packages = [ + {include = "iranian_cities"} +] [tool.poetry.dependencies] python = ">=3.8,<4.0" django = ">=3.2,<6.0" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..9621450 --- /dev/null +++ b/tox.ini @@ -0,0 +1,29 @@ +[tox] +envlist = + py38-django32, py39-django32, py310-django32, py311-django32, py312-django32, + py38-django40, py39-django40, py310-django40, py311-django40, py312-django40, + py310-django50, py311-django50, py312-django50 + +[gh-actions] +python = + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 + +[testenv] +usedevelop = True +deps = + django32: django>=3.2,<3.3 + django40: django>=4.0,<4.3 + django50: django>=5.0,<5.3 + pytest + pytest-django + pytest-cov + django-stubs +commands = + pytest --cov + +setenv = + DJANGO_SETTINGS_MODULE = kernel.settings \ No newline at end of file