Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple django and python versions from other dependencies #459

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.10", "3.11"]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -28,26 +28,29 @@ jobs:
run: tox
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably speed things up with tox --parallel

env:
PLATFORM: ${{ matrix.platform }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage-results
name: coverage-results-${{ matrix.python-version }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coverage results are supposed to be a single combined coverage report. I haven't actually checked if the outputs are being gathered correctly across all branches on github, but it is in tox.

path: .coverage.*

coverage:
needs: tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/checkout@v3
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install coverage
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverage-results
name: coverage-results-${{ matrix.python-version }}
- name: Coverage check
run: |
coverage combine
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Expand Down
34 changes: 17 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
distribute = False
envlist =
coverage_setup
# Latest
py311-latest{-pyuca,-noi18n}
# Historical Python, Django and DRF versions
py310-previous
# Legacy
py37-legacy
# Package checks
# Currently supported django/python combinations
# https://www.djangoproject.com/download/#supported-versions
py{38,39}-django{32}-{legacy,previous,latest}
py{38,39,310,311,312}-django{42}-{latest}
py{310,311,312}-django{50}-{latest}{-pyuca,-noi18n}
readme
bandit
mypy
Expand All @@ -18,9 +16,11 @@ ignore_basepython_conflict = True

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311, readme, bandit, mypy
3.11: py311
3.12: py312, readme, bandit, mypy

[testenv]
basepython = python3
Expand All @@ -30,14 +30,14 @@ setenv =
DJANGO_SETTINGS_MODULE = django_countries.tests.settings
deps =
coverage
django32: Django>=3.2,<4.0
django42: Django>=4.2,<4.3
django50: Django>=5.0,<5.1
legacy: djangorestframework==3.11.*
previous: djangorestframework==3.14.*
latest: djangorestframework==3.15.*
pyuca,legacy: pyuca
legacy: Django==3.2.*
previous: Django==4.2.*
latest: Django==5.*
latest: graphene-django==3.0.*
latest: graphene-django==3.2.*
depends = coverage_setup
commands = coverage run -m pytest {posargs}

Expand All @@ -50,7 +50,7 @@ commands =
rst2html.py --report=info --halt=warning README.rst /dev/null
rst2html.py --report=info --halt=warning CHANGES.rst /dev/null

[py311-latest-noi18n]
[py311-django50-latest-noi18n]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section can be removed and just use a conditional setenv in the standard section:

    noi18n: DJANGO_SETTINGS_MODULE = django_countries.tests.settings_noi18n

setenv =
DJANGO_SETTINGS_MODULE = django_countries.tests.settings_noi18n

Expand All @@ -73,9 +73,9 @@ commands = coverage erase
skip_install = True
parallel_show_output = True
depends =
py311-latest{-pyuca,-noi18n}
py310-previous
py37-legacy
py312-django50-latest{-pyuca,-noi18n}
py311-django42-latest
py39-django32-latest
Comment on lines +76 to +78
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These depends have to match the ones in envlist. A comment in envlist would be useful to ensure these are kept up to date when someone next updates them too.

commands =
coverage combine
coverage html
Expand Down