Skip to content

Commit

Permalink
Speed up CI (368)
Browse files Browse the repository at this point in the history
[test] Ci speedups
  • Loading branch information
zerolab authored Sep 25, 2023
2 parents bc3493b + af7c064 commit cff065c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 8 deletions.
53 changes: 45 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,60 @@ 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:
image: postgres:14
image: bitnami/postgresql:14
env:
POSTGRES_PASSWORD: postgres
POSTGRESQL_PASSWORD: postgres
POSTGRESQL_FSYNC: "off"
POSTGRESQL_DATA_DIR: /dev/shm/pgdata
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
options: --health-cmd "pg_isready -d postgres -U postgres -p 5432" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
Expand All @@ -60,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 @@ -72,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 cff065c

Please sign in to comment.