add pytest-xdist and tests in CI #20
This file contains 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: Lint and Tests | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install poetry | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry env use "3.11" | |
poetry export --only lint --output lint-requirements.txt | |
pip install -r lint-requirements.txt | |
- name: Run Ruff | |
run: ruff check --output-format=github . | |
test: | |
name: Run Tests | |
needs: lint | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: ["5432:5432"] | |
redis: | |
image: redis:7.0.12-alpine | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
cache: "poetry" | |
- run: poetry install | |
- run: poetry run pytest -x -n auto --dist loadfile | |
env: | |
DB_HOST: "localhost" | |
REDIS_HOST: "localhost" | |
REDIS_PORT: "6379" |