Debian Codegraph @

.github/workflows/cicd.yml

raw
1 ---
2 name: Run Tests
3
4 # yamllint disable-line rule:truthy
5 on:
6 push:
7 branches:
8 - master
9 pull_request:
10 branches:
11 - master
12 release:
13 types:
14 - released
15
16 jobs:
17 lint:
18 runs-on: ubuntu-latest
19 steps:
20 - uses: actions/checkout@v4
21 - uses: actions/setup-python@v5
22 - uses: pre-commit/[email protected]
23 with:
24 extra_args: -a
25 tests:
26 runs-on: ubuntu-latest
27 strategy:
28 fail-fast: false
29 matrix:
30 django-version:
31 - 4.2.*
32 - 5.0.*
33 - 5.1.*
34 - 5.2.*
35 python-version:
36 - '3.10'
37 - '3.11'
38 - '3.12'
39 - '3.13'
40 - '3.14'
41 exclude:
42 # Django 4.2 only supports python 3.8-3.12
43 - django-version: 4.2.*
44 python-version: '3.13'
45 - django-version: 4.2.*
46 python-version: '3.14'
47 # Django 5.0 only supports python 3.10-3.12
48 - django-version: 5.0.*
49 python-version: '3.13'
50 - django-version: 5.0.*
51 python-version: '3.14'
52 # Django 5.1 only supports python 3.10-3.13
53 - django-version: 5.1.*
54 python-version: '3.14'
55 # Django 5.2 only supports python 3.10-3.13 (assuming)
56 - django-version: 5.2.*
57 python-version: '3.14'
58 steps:
59 - name: Checkout
60 uses: actions/checkout@v4
61 - name: Install Poetry
62 run: pipx install poetry
63 - name: Set up Python ${{ matrix.python-version }}
64 id: setup-python
65 uses: actions/setup-python@v5
66 with:
67 cache: poetry
68 python-version: ${{ matrix.python-version }}
69 - name: Install Deps
70 run: poetry install
71 - name: Install Django ${{ matrix.django-version }}
72 run: poetry run pip install "django==${{ matrix.django-version }}"
73 - name: Test with pytest
74 run: poetry run pytest --showlocals -vvv --cov-report=xml
75 - name: Upload coverage to Codecov
76 uses: codecov/codecov-action@v5
77 env:
78 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
79 publish:
80 runs-on: ubuntu-latest
81 needs:
82 - lint
83 - tests
84 if: >
85 needs.lint.result == 'success' &&
86 needs.tests.result == 'success' &&
87 github.event.action == 'released'
88 steps:
89 - uses: actions/checkout@v4
90 - name: Build and publish to pypi
91 uses: JRubics/[email protected]
92 with:
93 pypi_token: ${{ secrets.PYPI_TOKEN }}