added readme #16
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
env: | |
DB_HOSTNAME: localhost | |
DB_PORT: 5432 | |
DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_NAME: ${{ secrets.DB_NAME }} | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: ${{ secrets.DB_USERNAME }} | |
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.DB_NAME }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install pipenv | |
run: pip install pipenv | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
cache: 'pipenv' | |
cache-dependency-path: | | |
Pipfile.lock | |
- run: pipenv install --ignore-pipfile | |
- name: Set up PostgreSQL client | |
run: sudo apt-get install -y postgresql-client | |
- name: Run init.sql script | |
env: | |
POSTGRES_USER: ${{ secrets.DB_USERNAME }} | |
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.DB_NAME }} | |
run: | | |
PGPASSWORD=$POSTGRES_PASSWORD psql -h localhost -U $POSTGRES_USER -d $POSTGRES_DB -f init.sql | |
- name: Run Unit Tests | |
run: | | |
pipenv run pytest tests/unit --cov | |
- name: Run Integration Tests | |
run: | | |
pipenv run pytest tests/integration/ |