|
1 | 1 | name: CI |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | workflow_dispatch: |
6 | 5 | pull_request: |
7 | 6 | types: [assigned, opened, synchronize, reopened] |
8 | | - |
9 | 7 | permissions: |
10 | 8 | contents: write |
11 | 9 | pull-requests: write |
12 | | - |
13 | 10 | jobs: |
14 | 11 | test: |
15 | 12 | runs-on: ubuntu-latest |
16 | 13 | strategy: |
17 | 14 | 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 |
21 | 18 | steps: |
22 | 19 | - uses: actions/checkout@v3 |
23 | | - - name: Set up Python |
| 20 | + - name: Set up Python ${{ matrix.python-version }} |
24 | 21 | uses: actions/setup-python@v4 |
25 | 22 | with: |
26 | 23 | python-version: ${{ matrix.python-version }} |
27 | | - |
28 | 24 | - name: Install Poetry |
29 | 25 | uses: snok/install-poetry@v1 |
30 | 26 | with: |
31 | 27 | virtualenvs-create: true |
32 | 28 | 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' |
35 | 43 | run: | |
36 | 44 | 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' |
39 | 48 | run: poetry run pytest . |
40 | | - |
41 | 49 | merge: |
42 | 50 | runs-on: ubuntu-latest |
43 | 51 | needs: [test] |
44 | | - if: github.actor == 'dependabot[bot]' # Detect that the PR author is dependabot |
| 52 | + if: github.actor == 'dependabot[bot]' |
45 | 53 | steps: |
46 | 54 | - uses: actions/checkout@v4 |
47 | 55 | - 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" |
49 | 57 | env: |
50 | 58 | PR_URL: ${{github.event.pull_request.html_url}} |
51 | 59 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
52 | | - |
53 | 60 | release: |
54 | 61 | runs-on: ubuntu-latest |
55 | 62 | if: "startsWith(github.ref, 'refs/tags/')" |
|
65 | 72 | run: | |
66 | 73 | poetry install --sync --no-interaction --no-root --with test |
67 | 74 | poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} |
68 | | -
|
69 | 75 | - name: Publish |
70 | 76 | run: | |
71 | 77 | poetry publish --build |
0 commit comments