Skip to content

Commit

Permalink
Parallelize CI workflow by adding Django versions to job matrix (#1219)
Browse files Browse the repository at this point in the history
* add `django-version` to job matrix

* adjust job name

* add django 2.2 and adjust exclude matrix

* remove max-parallel restriction

* change comments to be clearer

* remove extra newline

* remove whitespace

* chore: add success test

decouple successful from specific matrix builds
to avoid GH admin intervention as we update
our supported matrix.

---------

Co-authored-by: Darrel O'Pry <[email protected]>
  • Loading branch information
joshuadavidthomas and dopry authored Feb 16, 2023
1 parent 13538a6 commit bd865d6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,27 @@ on: [push, pull_request]

jobs:
build:
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
django-version: ['2.2', '3.2', '4.0', '4.1', 'main']
exclude:
# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django

# Python 3.10+ is not supported by Django 2.2
- python-version: '3.10'
django-version: '2.2'

# Python 3.7 is not supported by Django 4.0+
- python-version: '3.7'
django-version: '4.0'
- python-version: '3.7'
django-version: '4.1'
- python-version: '3.7'
django-version: 'main'

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -42,8 +57,18 @@ jobs:
- name: Tox tests
run: |
tox -v
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}

success:
needs: build
runs-on: ubuntu-latest
name: Test successful
steps:
- name: Success
run: echo Test successful
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ python =
3.10: py310
3.11: py311

[gh-actions:env]
DJANGO =
2.2: dj22
3.2: dj32
4.0: dj40
4.1: dj41
main: djmain

[pytest]
django_find_project = false
addopts =
Expand Down

0 comments on commit bd865d6

Please sign in to comment.