-
-
Notifications
You must be signed in to change notification settings - Fork 101
71 lines (68 loc) · 2.09 KB
/
testing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: test
on:
pull_request:
push:
branches:
- master
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: "3"
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- run: python -m pip install flake8
- run: |
flake8 .
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"]
django-version: [ "4.2", "5.0", "5.1"]
drf-version: ["3.14", "3.15"]
exclude:
# Python 3.9 is incompatible with Django v5+
- django-version: 5.0
python-version: 3.9
# Python 3.9 is incompatible with Django v5+
- django-version: 5.1
python-version: 3.9
# Django 4.2 is incompatible with Python 3.13+
- django-version: 4.2
python-version: 3.13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: ${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}-0
- run: poetry env use ${{ matrix.python-version }} && poetry install --no-root
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- run: |
source .venv/bin/activate
pip install "Django~=${{ matrix.django-version }}.0"
pip install "djangorestframework~=${{ matrix.drf-version }}.0"
- name: Run tests
run: |
source .venv/bin/activate
poetry run coverage run manage.py test -v 2
poetry run coverage report -m