ci: Add Python 3.12 to test matrix and streamline tox.ini #203
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: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "develop" ] | |
| tags-ignore: [ "**" ] | |
| pull_request: | |
| schedule: | |
| - cron: "0 8 * * *" | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| defaults: | |
| run: | |
| shell: bash | |
| outputs: | |
| run_tests: ${{ steps.changes.outputs.run_tests }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - id: changes | |
| name: Check for file changes | |
| uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 | |
| with: | |
| base: ${{ github.ref }} | |
| token: ${{ github.token }} | |
| filters: .github/file-filters.yml | |
| test: | |
| needs: [ changes ] | |
| if: needs.changes.outputs.run_tests == 'true' | |
| services: | |
| redis: | |
| image: redis | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| django: [ "42", "52"] | |
| python: [ "3.11", "3.12", "3.13" ] | |
| env: | |
| CELERY_BROKER_URL: redis://redis:6379/0 | |
| CELERY_ALWAYS_EAGER: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: | | |
| pyproject.toml | |
| uv.lock | |
| cache-suffix: ${{ matrix.python }}-${{ matrix.django }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| python-version: ${{ matrix.python }} | |
| - name: Install tox | |
| run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv --with tox-gh-actions | |
| - name: Install Python | |
| if: matrix.python != '3.13' | |
| run: uv python install --python-preference only-managed ${{ matrix.python }} | |
| - name: Setup test suite | |
| run: tox run -vv --notest --skip-missing-interpreters false -e d${{ matrix.django }}-py$(echo ${{ matrix.python }} | sed 's/\.//') | |
| - name: Run test suite d${{ matrix.django }}-py${{ matrix.python }} | |
| run: tox -e d${{ matrix.django }}-py$(echo ${{ matrix.python }} | sed 's/\.//') | |
| - name: Upload pytest test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-results-${{ matrix.python }}-${{matrix.django}} | |
| path: junit-${{ matrix.python }}-${{matrix.django}}.xml | |
| if: ${{ always() }} | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.python == 3.12 | |
| continue-on-error: true | |
| with: | |
| env_vars: OS,PYTHON | |
| fail_ci_if_error: true | |
| slug: saxix/django-smart-admin | |
| flags: unittests | |
| files: ./coverage.xml | |
| verbose: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| name: codecov-${{env.GITHUB_REF_NAME}} |