Skip to content

updates CI

updates CI #196

Workflow file for this run

name: Test
on:
push:
branches:
- '**' # matches every branch
defaults:
run:
shell: bash
permissions:
id-token: write
attestations: write
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
run_tests: ${{steps.changes.outputs.run_tests }}
lint: ${{steps.changes.outputs.lint }}
steps:
- name: Checkout code
uses: actions/[email protected]
- id: changes
name: Check for file changes
uses: dorny/[email protected]
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
ci:
needs: [ changes ]
if: needs.changes.outputs.run_tests
runs-on: ubuntu-latest
name: Test py${{ matrix.python-version }}/dj${{matrix.django-version}}
defaults:
run:
shell: bash
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: adminfilters
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
max-parallel: 1
matrix:
python: [ "3.13", "3.10", "3.9" ]
django: [ "52", "42", "32"]
exclude:
- django: 32
python: 3.13
- django: 52
python: 3.9
fail-fast: true
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
DATABASE_URL: postgres://postgres:postgres@localhost:5432/adminfilters
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python: ${{ matrix.python-version }}
architecture: 'x64'
- name: Restore cached venv
id: cache-venv-restore
uses: actions/cache/restore@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv
- 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: Cache venv
if: steps.cache-venv-restore.outputs.cache-hit != 'true'
id: cache-venv-save
uses: actions/cache/save@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}-${{matrix.django-version}}
path: junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml
if: ${{ always() }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == 3.12
continue-on-error: true
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: unittests
files: ./coverage.xml
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-${{env.GITHUB_REF_NAME}}