CI: run typechecks only once, not for each Django/Python version #378
Workflow file for this run
This file contains hidden or 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: test | |
| on: [push, pull_request] | |
| jobs: | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: pip install -e . -r requirements.txt | |
| - name: Run mypy | |
| run: python -m mypy dj_database_url | |
| - name: Run pyright | |
| run: python -m pyright dj_database_url | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| django-version: ["4.2", "5.1"] | |
| exclude: | |
| # Python 3.11 is not compatible with 3.2 | |
| - python-version: "3.11" | |
| django-version: "3.2" | |
| - python-version: "3.12" | |
| django-version: "3.2" | |
| - python-version: "3.13" | |
| django-version: "3.2" | |
| # django 5.x is not compatible with python 3.9 or lower | |
| - python-version: "3.9" | |
| django-version: "5.1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt "Django~=${{ matrix.django-version }}.0" . | |
| - name: Run Tests | |
| run: | | |
| echo "$(python --version) / Django $(django-admin --version)" | |
| coverage run --source=dj_database_url --branch -m unittest discover -v | |
| coverage report | |
| coverage xml | |
| - uses: codecov/codecov-action@v4 |