Skip to content

Testing

Testing #9

Workflow file for this run

name: CI Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: solo6755
POSTGRES_DB: postgres
ports:
- 5433:5432 # Expose PostgreSQL on the port you're using
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://postgres:solo6755@postgres:5432/postgres
SECRET_KEY: ${{ secrets.SECRET_KEY }}
FERNET_KEY: ${{ secrets.FERNET_KEY }}
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: 'true'
steps:
# Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v4
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Install docker-compose
- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
# Install dependencies
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Run tests inside Docker
- name: Run unit tests
run: |
docker-compose up --build # Start services
sleep 10 # Wait for services to initialize
docker-compose exec app pytest --disable-warnings --maxfail=5
- name: Lint with Flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics