Test matrix on Python and Django versions #31
Workflow file for this run
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: | |
branches: | |
- main | |
paths-ignore: | |
- ".devcontainer/**" | |
- ".vscode/**" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- ".devcontainer/**" | |
- ".vscode/**" | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
run: pip install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .python-version | |
cache: poetry | |
cache-dependency-path: pyproject.toml | |
- name: Install pip deps | |
run: poetry install | |
- name: Check code formatting | |
run: poetry run black --check . | |
- name: Lint code | |
run: poetry run ruff check . | |
- name: Run type checks | |
run: poetry run mypy --show-error-codes --pretty . | |
test: | |
name: Test (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
django-version: ["3.2.*", "4.2.*"] | |
include: | |
- python-version: "3.11" | |
django-version: "4.2.*" | |
- python-version: "3.12" | |
django-version: "4.2.*" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
run: pip install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: poetry | |
cache-dependency-path: pyproject.toml | |
- name: Install pip deps | |
run: poetry install | |
- name: Install Django | |
run: poetry run pip install Django=="${{ matrix.django-version }}" | |
- name: Run tests | |
run: poetry run pytest | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
env: | |
PYTHON: ${{ matrix.python-version }} | |
DJANGO: ${{ matrix.django-version }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
files: coverage.xml | |
env_vars: PYTHON,DJANGO |