[pre-commit.ci] pre-commit autoupdate #696
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, pull_request] | |
jobs: | |
test: | |
name: > | |
Test Python ${{ matrix.python-version }}, | |
Django ${{ matrix.django-version }}, | |
Redis.py ${{ matrix.redis-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.10' | |
- '3.11' | |
django-version: | |
- '4.2' | |
- '5.0' | |
redis-version: | |
- 'latest' | |
# Only test pre-release dependencies for the latest Python. | |
include: | |
# Django 4.2 and python 3.8 with latest redis | |
- django-version: '4.2' | |
redis-version: 'latest' | |
python-version: '3.8' | |
# Django 4.2 and python 3.9 with latest redis | |
- django-version: '4.2' | |
redis-version: 'latest' | |
python-version: '3.9' | |
# latest Django with pre-release redis | |
- django-version: '5.0' | |
redis-version: 'master' | |
python-version: '3.11' | |
# latest redis with pre-release Django | |
- django-version: 'main' | |
redis-version: 'latest' | |
python-version: '3.11' | |
# pre-release Django and redis | |
- django-version: 'main' | |
redis-version: 'master' | |
python-version: '3.11' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-test-python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-redis-${{ matrix.redis-version }}-${{ hashFiles('**/setup.*') }} | |
restore-keys: | | |
pip-test-python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-redis-${{ matrix.redis-version }} | |
pip-test-python-${{ matrix.python-version }} | |
pip-test- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade tox tox-gh-actions | |
- name: Tox tests | |
run: | | |
REDIS_PRIMARY=$(tests/start_redis.sh) | |
REDIS_SENTINEL=$(tests/start_redis.sh --sentinel) | |
CONTAINERS="$REDIS_PRIMARY $REDIS_SENTINEL" | |
trap "docker stop $CONTAINERS && docker rm $CONTAINERS" EXIT | |
tests/wait_for_redis.sh $REDIS_PRIMARY 6379 | |
tests/wait_for_redis.sh $REDIS_SENTINEL 26379 | |
tox | |
env: | |
DJANGO: ${{ matrix.django-version }} | |
REDIS: ${{ matrix.redis-version }} | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
env_vars: DJANGO,REDIS,PYTHON | |
flags: tests | |
env: | |
DJANGO: ${{ matrix.django-version }} | |
REDIS: ${{ matrix.redis-version }} | |
PYTHON: ${{ matrix.python-version }} | |
lint: | |
name: Lint (${{ matrix.tool }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tool: | |
- 'black' | |
- 'ruff' | |
- 'mypy' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-lint-${{ hashFiles('**/setup.*') }} | |
restore-keys: | | |
pip-lint- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade "tox<4" | |
- name: Run ${{ matrix.tool }} | |
run: tox -e ${{ matrix.tool }} | |
- name: Upload coverage | |
if: ${{ matrix.tool == 'mypy' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: mypy | |
check-changelog: | |
name: Check for news fragments in 'changelog.d/' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-check-changelog-${{ hashFiles('**/setup.*') }} | |
restore-keys: | | |
pip-check-changelog- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade towncrier | |
- name: Run towncrier check | |
run: | | |
if ! towncrier check; then | |
echo '' | |
echo "Please add a description of your changes to 'changelog.d/{issue or PR number}.{feature,bugfix,misc,doc,removal}'" | |
exit 1 | |
fi |