Skip to content

Commit cde55ab

Browse files
committed
create separate lint and tests jobs, make matrix
1 parent b261518 commit cde55ab

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

.github/workflows/testing.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ on:
1010
# https://github.com/orgs/community/discussions/26276
1111

1212
jobs:
13-
check:
13+
lint:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
1717
python-version:
1818
- "3.9"
19-
- "3.10"
2019
- "3.11"
2120

2221
steps:
@@ -33,5 +32,49 @@ jobs:
3332
run: poetry install --all-extras
3433
- name: Lint code
3534
run: pre-commit run --all-files
35+
36+
37+
run-tests:
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
python-version:
42+
- "3.9"
43+
- "3.10"
44+
- "3.11"
45+
db-url:
46+
- "sqlite+aiosqlite:///./db.sqlite3"
47+
- "postgresql+asyncpg://postgres:postgres@postgres:5432/postgres"
48+
49+
# Service containers to run with `container-job`
50+
services:
51+
# Label used to access the service container
52+
postgres:
53+
# Docker Hub image
54+
image: postgres
55+
# Provide the password for postgres
56+
env:
57+
POSTGRES_PASSWORD: postgres
58+
# Set health checks to wait until postgres has started
59+
options: >-
60+
--health-cmd pg_isready
61+
--health-interval 10s
62+
--health-timeout 5s
63+
--health-retries 5
64+
65+
steps:
66+
- uses: actions/checkout@v3
67+
- name: Set up Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
- name: Install poetry
72+
run: |
73+
python -m pip install --upgrade pip poetry pre-commit
74+
poetry config virtualenvs.create false --local
75+
- name: Install dependencies
76+
run: poetry install --all-extras
3677
- name: Test with pytest
3778
run: pytest -s -vv tests/
79+
env:
80+
TESTING_DB_URL: ${{ matrix.db-url }}

0 commit comments

Comments
 (0)