Skip to content

Bump actions/checkout from 3 to 4 (#87) #188

Bump actions/checkout from 3 to 4 (#87)

Bump actions/checkout from 3 to 4 (#87) #188

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 }} with ${{ matrix.psycopg }}"
services:
postgres96:
image: postgres:9.6
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5496:5432
postgres10:
image: postgres:10
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5410:5432
postgres11:
image: postgres:11
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5411:5432
postgres12:
image: postgres:12
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5412:5432
postgres13:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5413:5432
postgres14:
image: postgres:14
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5414:5432
postgres15:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5415:5432
postgres16:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5416:5432
strategy:
matrix:
django-version: ["3.2.0", "4.1.0", "4.2.0", "5.0a1"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
psycopg: ["psycopg2", "psycopg"]
exclude:
# 3.2
- django-version: "3.2.0"
python-version: "3.11"
- django-version: "3.2.0"
python-version: "3.12"
- django-version: "3.2.0"
psycopg: "psycopg"
# 4.1
- django-version: "4.1.0"
psycopg: "psycopg"
# 5.0
- django-version: "5.0a1"
python-version: "3.8"
- django-version: "5.0a1"
python-version: "3.9"
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
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 '.[test]' Django~=${{ matrix.django-version }} ${{ matrix.psycopg }}
- name: Run tests
run: |
if [ "${{ matrix.django-version }}" = "3.2.0" ] ; then
export PG_VERSIONS="96,10,11,12,13,14,15,16"
else
if [ "${{ matrix.django-version }}" = "4.1.0" ] ; then
export PG_VERSIONS="11,12,13,14,15,16"
fi
fi
coverage run "$(command -v django-admin)" test --pythonpath . -v 2 --settings=tests.settings
coverage report
env:
PG_VERSIONS: "12,13,14,15,16"
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
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@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: actions/cache@v3
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