Skip to content

Test

Test #224

Workflow file for this run

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
lint:
needs: [ changes ]
if: needs.changes.outputs.run_tests == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip pre-commit black isort flake8
- name: Lint with flake8
run: |
pre-commit run --all
pkg_meta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Lint with flake8
run: |
tox -e pkg_meta
test:
needs: [ changes ]
if: needs.changes.outputs.run_tests == 'true'
services:
redis:
image: redis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
django: [ "5.1", "4.2", "3.2" ]
python: [ "3.13", "3.12", "3.11", "3.10" ]
env:
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_ALWAYS_EAGER: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
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
- name: Run test suite ${{ matrix.django }}-${{ matrix.python }}
run: tox run --skip-pkg-install
env:
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
DJANGO: ${{ matrix.django }}
- name: UUpload test results to Codecov
uses: codecov/test-results-action@v1
with:
env_vars: OS
flags: ${{ matrix.django }} ${{ matrix.python }}
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage1.xml,./coverage2.xml,!./cache
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true