Skip to content

[pre-commit.ci] pre-commit autoupdate #59

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #59

Workflow file for this run

name: Test & Deploy
on:
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
name: "Test Python ${{ matrix.python-version }} & Django ${{ matrix.django-version }}"
strategy:
matrix:
django-version: ["2.2.0", "3.0.0", "3.1.0", "3.2.0", "4.0.0"]
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
exclude:
# 3.0
- django-version: "3.0.0"
python-version: "3.5"
- django-version: "3.0.0"
python-version: "3.10"
# 3.1
- django-version: "3.1.0"
python-version: "3.5"
- django-version: "3.1.0"
python-version: "3.10"
# 3.2
- django-version: "3.2.0"
python-version: "3.5"
# 4.0
- django-version: "4.0.0"
python-version: "3.5"
- django-version: "4.0.0"
python-version: "3.6"
- django-version: "4.0.0"
python-version: "3.7"
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install Django~=${{ matrix.django-version }}
python -m pip install '.[test]'
- name: Run tests
run: |
coverage run "$(command -v django-admin)" test --pythonpath . -v 2 --settings=tests.settings
coverage report
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
deploy:
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-publish-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-publish-pip-
- name: Install dependencies
run: |
pip install -U pip
python -m pip install setuptools wheel twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false