Merge pull request #683 from WisdomPill/release540 #447
Workflow file for this run
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-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
django-version: | |
- '3.2' | |
- '4.0' | |
- '4.1' | |
- '4.2' | |
redis-version: | |
- 'latest' | |
# Only test pre-release dependencies for the latest Python. | |
# And keep testing Django 3.2 with python 3.6 and 3.7 | |
include: | |
# Django 3.2 and python 3.6 with latest redis | |
- django-version: '3.2' | |
redis-version: 'latest' | |
python-version: '3.6' | |
# Django 3.2 and python 3.7 with latest redis | |
- django-version: '3.2' | |
redis-version: 'latest' | |
python-version: '3.7' | |
# Django 4.1 and python 3.11 with latest redis | |
- django-version: '4.1' | |
redis-version: 'latest' | |
python-version: '3.11' | |
# Django 4.2 and python 3.11 with latest redis | |
- django-version: '4.2' | |
redis-version: 'latest' | |
python-version: '3.11' | |
# latest Django with pre-release redis | |
- django-version: '4.2' | |
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@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
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@v2 | |
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<4" 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@v1 | |
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' | |
- 'flake8' | |
- 'isort' | |
- 'mypy' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
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@v2 | |
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@v1 | |
with: | |
flags: mypy | |
check-changelog: | |
name: Check for news fragments in 'changelog.d/' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
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@v2 | |
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 |