Skip to content

test

test #495

Workflow file for this run

name: test
on:
push:
pull_request:
workflow_dispatch:
inputs:
debug:
description: 'Set to on, to open ssh debug session.'
required: true
default: 'off'
schedule:
- cron: '0 13 * * *' # Runs at 6 am pacific every day
jobs:
postgres:
runs-on: ubuntu-latest
# Service containers to run with `container-job`
env:
RDBMS: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-rc.1']
postgres-version: ['9.6', '12', 'latest']
psycopg-version: ['psycopg2', 'psycopg3']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.1' # December 2025
exclude:
- django-version: '4.2'
postgres-version: '9.6'
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.12'
django-version: '3.2'
- postgres-version: '12'
psycopg-version: 'psycopg3'
- django-version: '3.2'
psycopg-version: 'psycopg3'
- django-version: '3.2'
postgres-version: 'latest'
- postgres-version: '12'
django-version: '5.1'
- postgres-version: '9.6'
django-version: '5.1'
- python-version: '3.8'
django-version: '5.1'
- python-version: '3.9'
django-version: '5.1'
- python-version: '3.13.0-rc.1'
django-version: '3.2'
- python-version: '3.13.0-rc.1'
django-version: '4.2'
# https://github.com/psycopg/psycopg2/pull/1695
- python-version: '3.13.0-rc.1'
psycopg-version: 'psycopg2'
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:${{ matrix.postgres-version }}
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Install Basic Dependencies
# it'd be great if you could just tell poetry to lock to specific versions
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install --no-interaction --with ${{ matrix.psycopg-version }}
poetry run ./manage.py makemigrations
- name: No Optional Dependency Unit Tests
run: |
poetry run pytest --cov-append
- name: Install enum-properties
run: |
poetry install -E properties
- name: Unit Tests w/ enum-properties
run: |
poetry run ./manage.py makemigrations
poetry run pytest --cov-append
- name: Remove enum-properties
run: |
poetry run pip uninstall -y enum-properties
- name: Install djangorestframework
run: |
poetry install -E djangorestframework
- name: Run Unit Tests w/ djangorestframework
run: |
poetry run pytest --cov-append
- name: Install django-filters
run: |
poetry install -E filters
- name: Run Unit Tests w/ django-filter
run: |
poetry run pytest --cov-append
- name: Install all deps
run: |
poetry run ./manage.py makemigrations
poetry install -E all
- name: Run Full Unit Tests
run: |
poetry run pytest --cov-append
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}-${{ matrix.psycopg-version }}-pg${{ matrix.postgres-version }}.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}-${{ matrix.psycopg-version }}-pg${{ matrix.postgres-version }}
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}-${{ matrix.psycopg-version }}-pg${{ matrix.postgres-version }}.coverage
sqlite:
runs-on: ubuntu-latest
env:
RDBMS: sqlite
strategy:
matrix:
python-version: [ '3.8', '3.12']
#mysqlclient-version: ['^1.0.3']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.1' # December 2025
exclude:
- python-version: '3.8'
django-version: '5.1'
- python-version: '3.12'
django-version: '3.2'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install --no-interaction -E all
poetry run ./manage.py makemigrations
- name: Run Full Unit Tests
run: |
poetry run pytest
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}-sqlite.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}-sqlite
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}-sqlite.coverage
mysql:
runs-on: ubuntu-latest
env:
RDBMS: mysql
strategy:
matrix:
python-version: [ '3.8', '3.12']
mysql-version: ['5.7', 'latest']
mysqlclient-version: ['1.4.3', '']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.1' # December 2025
exclude:
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.8'
django-version: '5.1'
- django-version: '3.2'
mysql-version: 'latest'
- django-version: '4.2'
mysql-version: '5.7'
- django-version: '5.1'
mysql-version: '5.7'
- mysql-version: '5.7'
mysqlclient-version: ''
- mysql-version: 'latest'
mysqlclient-version: '1.4.3'
services:
mysql:
# Docker Hub image
image: mysql:${{ matrix.mysql-version }}
# Provide the password for mysql
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install -E all --with mysql
poetry run ./manage.py makemigrations
- name: Install mysqlclient if needed
if: ${{ matrix.mysqlclient-version != '' }}
run: poetry run pip install -U mysqlclient=="${{ matrix.mysqlclient-version }}"
- name: Run Full Unit Tests
env:
MYSQL_VERSION: ${{ matrix.mysql-version }}
run: |
poetry run pytest
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mysql${{ matrix.mysql-version }}.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mysql${{ matrix.mysql-version }}
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mysql${{ matrix.mysql-version }}.coverage
mariadb:
runs-on: ubuntu-latest
env:
RDBMS: mariadb
strategy:
matrix:
python-version: [ '3.8', '3.12']
mysqlclient-version: ['1.4.3', '']
mariadb-version: ['10.2', 'latest']
mariadb-healthcheck: ["mysqladmin ping", "healthcheck.sh --connect --innodb_initialized"]
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.1' # December 2025
exclude:
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.8'
django-version: '5.1'
- django-version: '3.2'
mariadb-version: 'latest'
- django-version: '4.2'
mariadb-version: '10.2'
- django-version: '5.1'
mariadb-version: '10.2'
- mariadb-version: '10.2'
mysqlclient-version: ''
- mariadb-version: 'latest'
mysqlclient-version: '1.4.3'
- mariadb-version: 'latest'
mariadb-healthcheck: "mysqladmin ping"
- mariadb-version: '10.2'
mariadb-healthcheck: "healthcheck.sh --connect --innodb_initialized"
services:
mysql:
# Docker Hub image
image: mariadb:${{ matrix.mariadb-version }}
# Provide the password for mysql
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
# Set health checks to wait until mysql has started
options: >-
--health-cmd="${{ matrix.mariadb-healthcheck }}"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install -E all --with mysql
poetry run ./manage.py makemigrations
- name: Install mysqlclient if needed
if: ${{ matrix.mysqlclient-version != '' }}
run: poetry run pip install -U mysqlclient=="${{ matrix.mysqlclient-version }}"
- name: Run Full Unit Tests
run: |
poetry run pytest
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mariadb${{ matrix.mariadb-version }}.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mariadb${{ matrix.mariadb-version }}
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}-myclient${{ matrix.mysqlclient-version }}-mariadb${{ matrix.mariadb-version }}.coverage
oracle:
runs-on: ubuntu-latest
env:
RDBMS: oracle
strategy:
matrix:
python-version: ['3.8', '3.10', '3.12']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.1' # April 2025
oracle-version:
- '18'
- 'latest'
exclude:
- python-version: '3.8'
django-version: '5.1'
- python-version: '3.10'
django-version: '5.1'
- python-version: '3.10'
django-version: '3.2'
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.12'
django-version: '4.2'
- python-version: '3.8'
django-version: '4.2'
- django-version: '3.2'
oracle-version: 'latest'
- django-version: '4.2'
oracle-version: '18'
- django-version: '5.1'
oracle-version: '18'
services:
oracle:
image: gvenzl/oracle-xe:${{ matrix.oracle-version }}
env:
ORACLE_PASSWORD: password
# Forward Oracle port
ports:
- 1521:1521
# Provide healthcheck script options for startup
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set Variables
# oracle bug is encountered in Linux CI - does not manifest using same
# oracle DB containers on OSX
run: |
echo "IGNORE_ORA_01843=True" >> $GITHUB_ENV
echo "IGNORE_ORA_00932=True" >> $GITHUB_ENV
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Install Oracle Client
run: |
curl --output oracle-client.rpm https://download.oracle.com/otn_software/linux/instantclient/2111000/oracle-instantclient-basiclite-21.11.0.0.0-1.el8.x86_64.rpm
sudo apt install alien libaio1
sudo alien -i oracle-client.rpm
sudo sh -c 'echo /usr/lib/oracle/21/client64/lib/ > /etc/ld.so.conf.d/oracle.conf'
sudo ldconfig
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install -E all --with oracle
poetry run ./manage.py makemigrations
- name: Run Full Unit Tests
run: |
poetry run pytest -s
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}-oracle${{ matrix.oracle-version }}.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}-oracle${{ matrix.oracle-version }}
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}-oracle${{ matrix.oracle-version }}.coverage
coverage-combine:
needs: [postgres, sqlite, mysql, mariadb, oracle]
runs-on: ubuntu-latest
steps:
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Release Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install
- name: Get coverage files
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- run: ls -la *.coverage
- run: poetry run coverage combine --keep *.coverage
- run: poetry run coverage report
- run: poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
verbose: true