Skip to content

Commit

Permalink
Use tox labels to tell GitHub Actions which testenvs to run
Browse files Browse the repository at this point in the history
  • Loading branch information
ely-as committed Jun 22, 2023
1 parent 9817478 commit 255bd20
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 57 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/test.yml
Expand Up @@ -3,27 +3,26 @@ name: Test
on: [push]

jobs:
build:

runs-on: ${{ matrix.os }}
test:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11']
python: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: ubuntu-20.04
python: '3.6'
python: "3.6"

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox and tox-gh-actions
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run Tox
# Run tox using the version of Python in `PATH`
run: tox
pip install tox
- name: Run tests
run: tox -m ${{ matrix.python }}
82 changes: 38 additions & 44 deletions tox.ini
@@ -1,54 +1,48 @@
[tox]
min_version = 4.0
isolated_build = True
envlist =
py36-django{111,20,21,22,30,31,32}-pytest
py38-django{22,30,31,32,40,41,42}-pytest
py39-django{22,30,31,32,40,41,42}-pytest
py310-django{32,40,41,42}-pytest
py311-django{41,42}-pytest
py311-flake8
py311-mypy

[gh-actions]
python =
3.6: py36
3.8: py38
3.9: py39
3.10: py310
3.11: py311
static-test
labels =
# Used by .github/workflows/test.yml - envs to run for each py version
3.6 = test-py36-django{111,20,21,22,30,31,32}
3.8 = test-py38-django{22,30,31,32,40,41,42}
3.9 = test-py39-django{22,30,31,32,40,41,42}
3.10 = test-py310-django{32,40,41,42}
3.11 = static, test-py311-django{41,42}

[testenv]
deps =
# https://docs.djangoproject.com/en/3.1/faq/install/#what-python-version-can-i-use-with-django
# https://docs.djangoproject.com/en/4.1/faq/install/#what-python-version-can-i-use-with-django
# all versions for python 3.6 to 3.10
py36-django111: Django>=1.11,<2
py37-django111: Django>=1.11.17,<2
py{36,37}-django20: Django>=2.0,<2.1
py{36,37}-django21: Django>=2.1,<2.2
py{36,37}-django22: Django>=2.2,<2.3
py38-django22: Django>=2.2.8,<2.3
py39-django22: Django>=2.2.17,<2.3
py{36,37,38}-django30: Django>=3.0,<3.1
py39-django30: Django>=3.0.11,<3.1
py{36,37,38}-django31: Django>=3.1,<3.2
py39-django31: Django>=3.1.3,<3.2
py{36,37,38,39}-django32: Django>=3.2,<3.3
py310-django32: Django>=3.2.9,<3.3
py{38,39,310}-django40: Django>=4.0,<4.1
py{38,39,310}-django41: Django>=4.1,<4.2
py311-django41: Django>=4.1.3,<4.2
py{38,39,310,311}-django42: Django>=4.2,<4.3
flake8: flake8
mypy: mypy
pytest: -r{toxinidir}/requirements.txt
pytest: pytest
pytest: pytest-mock
pytest: pytest-cov
django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<4.3
# minimum micro versions for Python 3.7 to 3.11, see:
# - https://docs.djangoproject.com/en/3.1/faq/install/
# - https://docs.djangoproject.com/en/4.1/faq/install/
py37-django111: Django>1.11.17
py38-django22: Django>=2.2.8
py39-django22: Django>=2.2.17
py39-django30: Django>=3.0.11
py39-django31: Django>=3.1.3
py310-django32: Django>=3.2.9
py311-django41: Django>=4.1.3
static: flake8
static: mypy
test: -r{toxinidir}/requirements.txt
test: pytest
test: pytest-mock
test: pytest-cov
commands =
flake8: flake8 {posargs}
mypy: mypy --config-file {toxinidir}/tox.ini {posargs}
pytest: pytest --cov={toxinidir} {posargs}
static: flake8 {posargs}
static: mypy --config-file {toxinidir}/tox.ini {posargs}
test: pytest --cov={toxinidir} {posargs}

[coverage:run]
omit =
Expand Down

0 comments on commit 255bd20

Please sign in to comment.