| 1 |
name: Test |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
build: |
| 7 |
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) |
| 8 |
runs-on: ubuntu-latest |
| 9 |
strategy: |
| 10 |
fail-fast: false |
| 11 |
matrix: |
| 12 |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 13 |
django-version: ['4.2', '5.0', 'main'] |
| 14 |
exclude: |
| 15 |
# Django 5.0 dropped support for Python <3.10 |
| 16 |
- django-version: '5.0' |
| 17 |
python-version: '3.8' |
| 18 |
- django-version: '5.0' |
| 19 |
python-version: '3.9' |
| 20 |
- django-version: 'main' |
| 21 |
python-version: '3.8' |
| 22 |
- django-version: 'main' |
| 23 |
python-version: '3.9' |
| 24 |
|
| 25 |
steps: |
| 26 |
- uses: actions/checkout@v2 |
| 27 |
|
| 28 |
- name: Set up Python ${{ matrix.python-version }} |
| 29 |
uses: actions/setup-python@v2 |
| 30 |
with: |
| 31 |
python-version: ${{ matrix.python-version }} |
| 32 |
|
| 33 |
- name: Get pip cache dir |
| 34 |
id: pip-cache |
| 35 |
run: | |
| 36 |
echo "::set-output name=dir::$(pip cache dir)" |
| 37 |
|
| 38 |
- name: Cache |
| 39 |
uses: actions/cache@v2 |
| 40 |
with: |
| 41 |
path: ${{ steps.pip-cache.outputs.dir }} |
| 42 |
key: |
| 43 |
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} |
| 44 |
restore-keys: | |
| 45 |
${{ matrix.python-version }}-v1- |
| 46 |
|
| 47 |
- name: Install dependencies |
| 48 |
run: | |
| 49 |
python -m pip install --upgrade pip |
| 50 |
python -m pip install --upgrade tox tox-gh-actions |
| 51 |
|
| 52 |
- name: Tox tests |
| 53 |
run: | |
| 54 |
tox -v |
| 55 |
env: |
| 56 |
DJANGO: ${{ matrix.django-version }} |
| 57 |
|
| 58 |
- name: Upload coverage |
| 59 |
uses: codecov/codecov-action@v1 |
| 60 |
with: |
| 61 |
name: Python ${{ matrix.python-version }} |