Test against mysql and postgres in addition to sqlite #21
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
|
||
| 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" | ||