Update to Python 3.10+ #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
pull_request: | |
types: [assigned, opened, synchronize, reopened] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.10', '3.11', '3.12', '3.13'] | |
django-version: ['3.2', '4.0', '4.1', '4.2', '5.0', '5.1'] | |
exclude: | |
# Python 3.13 | |
- python-version: '3.13' | |
django-version: '3.2' | |
- python-version: '3.13' | |
django-version: '4.0' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install dependencies | |
run: | | |
poetry install --sync --no-interaction --no-root | |
poetry run pip install "django==${{ matrix.django-version }}.*" | |
- name: Run tests | |
run: poetry run pytest . | |
merge: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.actor == 'dependabot[bot]' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enable auto-merge for Dependabot PRs | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{github.event.pull_request.html_url}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
release: | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: ['test'] | |
environment: | |
name: pypi | |
url: https://pypi.org/project/ninja-put-patch-file-upload-middleware/ | |
permissions: | |
contents: write | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Build the dependency | |
run: poetry build | |
- name: Upload package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ |