init #9
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: Tests and lint | |
on: [ push, pull_request ] | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
postgres_config: | |
- user: postgres | |
password: postgres | |
db: testdb | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ matrix.postgres_config.user }} | |
POSTGRES_PASSWORD: ${{ matrix.postgres_config.password }} | |
POSTGRES_DB: ${{ matrix.postgres_config.db }} | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install poetry | |
run: pip install poetry | |
- name: Install dependencies | |
run: poetry install | |
- name: Set env | |
run: mv .env.example .env | |
- name: Start tests | |
run: | |
poetry run pytest tests/* | |
env: | |
DB_IP: localhost | |
DB_USER: ${{ matrix.postgres_config.user }} | |
DB_PASSWORD: ${{ matrix.postgres_config.password }} | |
DB_NAME: ${{ matrix.postgres_config.db }} |