Skip to content

Test against mysql and postgres in addition to sqlite #21

Test against mysql and postgres in addition to sqlite

Test against mysql and postgres in addition to sqlite #21

Workflow file for this run

name: "Continuous Integration"
on:
push:
branches: [master]
pull_request:
schedule:
- cron: "0 2 * * *"
jobs:
tests:
name: python ${{ matrix.python-version }}, ${{ matrix.database }}, ${{ matrix.uv-resolution }} deps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
database:
- sqlite
- postgres
- mysql
uv-resolution:
- "lowest-direct"
- "highest"
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Only start Postgres for Postgres tests
if: matrix.database == 'postgres'

Check failure on line 47 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / Continuous Integration

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 47, Col: 9): Unexpected value 'if' .github/workflows/ci.yml (Line: 63, Col: 9): Unexpected value 'if'
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: test_db
ports:
- 3306:3306
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Only start MySQL for MySQL tests
if: matrix.database == 'mysql'
steps:
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache-dependency-glob: "**/pyproject.toml"
cache-suffix: ${{ matrix.uv-resolution }}
- name: Install the project
run: uv sync --all-extras --dev --resolution ${{ matrix.uv-resolution }}
- name: Run tests with SQLite
if: matrix.database == 'sqlite'
run: |
uv run pytest --sqlalchemy-connect-url="sqlite:///foo.sqlite"
- name: Run tests with PostgreSQL
if: matrix.database == 'postgres'
run: |
uv run pytest --sqlalchemy-connect-url="postgresql://postgres:postgres@localhost:5432/test_db"
- name: Run tests with MySQL
if: matrix.database == 'mysql'
run: |
uv run pytest --sqlalchemy-connect-url="mysql+pymysql://root:mysql@localhost:3306/test_db"