Skip to content

Commit

Permalink
Split up test to sqlite and postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolab committed Sep 25, 2023
1 parent d1d97c1 commit af7c064
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
46 changes: 40 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,48 @@ env:
PYTHON_LATEST: "3.11"

jobs:
tests:
tests-sqlite:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
DATABASE_URL: ['sqlite:///db.sqlite3', 'postgres://postgres:postgres@localhost/postgres']

env:
DATABASE_URL: ${{matrix.DATABASE_URL}}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: ⬇️ Install dependencies
run: |
python -Im pip install --upgrade pip
python -Im pip install flit tox tox-gh-actions
python -Im flit install --symlink
- name: 🏗️ Build wheel
run: python -Im flit build --format wheel

- name: 🧪 Run tox targets for Python ${{ matrix.python-version }}
env:
DB: sqlite
run: tox --installpkg ./dist/*.whl

- name: ⬆️ Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: tests/.coverage*
if-no-files-found: ignore
retention-days: 1

tests-postgres:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

services:
postgres:
Expand Down Expand Up @@ -63,6 +94,9 @@ jobs:
run: python -Im flit build --format wheel

- name: 🧪 Run tox targets for Python ${{ matrix.python-version }}
env:
DB: sqlite
DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres'
run: tox --installpkg ./dist/*.whl

- name: ⬆️ Upload coverage data
Expand All @@ -75,7 +109,7 @@ jobs:

coverage:
runs-on: ubuntu-latest
needs: tests
needs: [tests-sqlite, tests-postgres]

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ python =
3.10: py310
3.11: py311

[gh-actions:env]
DB =
sqlite: sqlite
postgres: postgres

[testenv]
package = wheel
wheel_build_env = .pkg
Expand Down

0 comments on commit af7c064

Please sign in to comment.