Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

Commit 6800737

Browse files
Test on all django versions (#26)
* Up * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml
1 parent 47a4fc2 commit 6800737

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

.github/workflows/CI.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,62 @@
11
name: CI
2-
32
on:
43
push:
54
workflow_dispatch:
65
pull_request:
76
types: [assigned, opened, synchronize, reopened]
8-
97
permissions:
108
contents: write
119
pull-requests: write
12-
1310
jobs:
1411
test:
1512
runs-on: ubuntu-latest
1613
strategy:
1714
matrix:
18-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
19-
# django-version: ['<4.2', '<4.3', '<5.1']
20-
15+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
16+
django-version: ['3.2', '4.0', '4.1', '4.2', '5.0', '5.1']
17+
fail-fast: false
2118
steps:
2219
- uses: actions/checkout@v3
23-
- name: Set up Python
20+
- name: Set up Python ${{ matrix.python-version }}
2421
uses: actions/setup-python@v4
2522
with:
2623
python-version: ${{ matrix.python-version }}
27-
2824
- name: Install Poetry
2925
uses: snok/install-poetry@v1
3026
with:
3127
virtualenvs-create: true
3228
virtualenvs-in-project: true
33-
34-
- name: Install python dependencies
29+
- name: Determine Django compatibility
30+
id: check-django
31+
run: |
32+
if [[ "${{ matrix.python-version }}" == "3.8" && "${{ matrix.django-version }}" > "4.1" ]]; then
33+
echo "compatible=false" >> $GITHUB_OUTPUT
34+
elif [[ "${{ matrix.python-version }}" == "3.9" && "${{ matrix.django-version }}" > "4.2" ]]; then
35+
echo "compatible=false" >> $GITHUB_OUTPUT
36+
elif [[ "${{ matrix.python-version }}" < "3.10" && "${{ matrix.django-version }}" == "5.0" ]]; then
37+
echo "compatible=false" >> $GITHUB_OUTPUT
38+
else
39+
echo "compatible=true" >> $GITHUB_OUTPUT
40+
fi
41+
- name: Install dependencies
42+
if: steps.check-django.outputs.compatible == 'true'
3543
run: |
3644
poetry install --sync --no-interaction --no-root
37-
38-
- name: Test
45+
poetry run pip install "django==${{ matrix.django-version }}.*"
46+
- name: Run tests
47+
if: steps.check-django.outputs.compatible == 'true'
3948
run: poetry run pytest .
40-
4149
merge:
4250
runs-on: ubuntu-latest
4351
needs: [test]
44-
if: github.actor == 'dependabot[bot]' # Detect that the PR author is dependabot
52+
if: github.actor == 'dependabot[bot]'
4553
steps:
4654
- uses: actions/checkout@v4
4755
- name: Enable auto-merge for Dependabot PRs
48-
run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
56+
run: gh pr merge --auto --merge "$PR_URL"
4957
env:
5058
PR_URL: ${{github.event.pull_request.html_url}}
5159
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
52-
5360
release:
5461
runs-on: ubuntu-latest
5562
if: "startsWith(github.ref, 'refs/tags/')"
@@ -65,7 +72,6 @@ jobs:
6572
run: |
6673
poetry install --sync --no-interaction --no-root --with test
6774
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
68-
6975
- name: Publish
7076
run: |
7177
poetry publish --build

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ classifiers = [
2525
[tool.poetry.dependencies]
2626
python = ">=3.9"
2727
asgiref = ">=3.6"
28-
django = ">=3.2"
2928
django-ninja = "*"
3029

3130

0 commit comments

Comments
 (0)