Skip to content

[FEAT] Set Up Continuous Integration #3

[FEAT] Set Up Continuous Integration

[FEAT] Set Up Continuous Integration #3

Workflow file for this run

name: API - Build & Test
on:
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: chatops_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgresql://user:password@localhost:5432/chatops_test
SECRET_KEY: test-secret-key-for-ci
CORS_ORIGINS: '["http://localhost:5173", "http://localhost:3000"]'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'api/requirements.txt'
- name: Install dependencies
working-directory: ./api
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run database migrations
working-directory: ./api
run: alembic upgrade head
- name: Run tests
working-directory: ./api
run: pytest -v