Skip to content

Phase 13: Postman collection added #4

Phase 13: Postman collection added

Phase 13: Postman collection added #4

Workflow file for this run

name: Backend CI Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: studentdb_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8
- name: Lint with flake8
working-directory: ./backend
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
working-directory: ./backend
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/studentdb_test
SECRET_KEY: test_secret_key_for_ci
ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 30
REDIS_URL: redis://localhost:6379
run: |
pytest tests/ -v --tb=short
docker-build:
name: Docker Build Check
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker build -t sms-backend ./backend