Skip to content

Commit

Permalink
add automated tests gh actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
laaraujo committed Jul 13, 2024
1 parent cf396e5 commit 59e2ebe
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Automated testing

on:
push:
branches:
- main
workflow_dispatch:

env:
WORKERS: 3
SECRET_KEY: "Insecure secret key"
DEBUG: "TRUE"

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run migrations
run: python src/manage.py migrate

- name: Run tests
run: pytest -n $WORKERS --cov=src/ --import-mode=importlib

0 comments on commit 59e2ebe

Please sign in to comment.