Skip to content

update mysql and mariadb CI #363

update mysql and mariadb CI

update mysql and mariadb CI #363

Workflow file for this run

name: test
on: [push, pull_request, workflow_dispatch]
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']
postgres-version: ['12', 'latest']
psycopg-version: ['psycopg2', 'psycopg3']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
exclude:
- 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'
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.9'
django-version: '5.0'
- django-version: '3.2'
postgres-version: 'latest'
# 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 Basic Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install --with ${{ matrix.psycopg-version }}
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: No Optional Dependency Unit Tests
run: |
poetry run pytest --cov-append
- name: Install enum-properties
run: |
poetry install -E properties
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Unit Tests w/ enum-properties
run: |
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
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Run Unit Tests w/ djangorestframework
run: |
poetry run pytest --cov-append
- name: Install django-filters
run: |
poetry install -E filters
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Run Unit Tests w/ django-filter
run: |
poetry run pytest --cov-append
- name: Install all deps
run: |
poetry install -E all
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Run Full Unit Tests
run: |
poetry run pytest --cov-append
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
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.0' # LTS April 2026
exclude:
- python-version: '3.8'
django-version: '5.0'
- 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 Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install -E all
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Run Full Unit Tests
run: |
poetry run pytest
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.0' # April 2025
exclude:
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.8'
django-version: '5.0'
- django-version: '3.2'
mysql-version: 'latest'
- django-version: '4.2'
mysql-version: '5.7'
- django-version: '5.0'
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 Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install -E all --with mysql
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- 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
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.0' # April 2025
exclude:
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.8'
django-version: '5.0'
- django-version: '3.2'
mariadb-version: 'latest'
- django-version: '4.2'
mariadb-version: '10.2'
- django-version: '5.0'
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 Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install -E all --with mysql
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- 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
oracle:
runs-on: ubuntu-latest
env:
RDBMS: oracle
strategy:
matrix:
python-version: ['3.8', '3.12']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
oracle-version:
- '18'
- 'latest'
exclude:
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.12'
django-version: '3.2'
- django-version: '3.2'
oracle-version: 'latest'
- django-version: '5.0'
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
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- 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
poetry install -E all --with oracle
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Run Full Unit Tests
run: |
poetry run pytest