Skip to content

Merge pull request #141 from CommandLineCoding/issue-13 #15

Merge pull request #141 from CommandLineCoding/issue-13

Merge pull request #141 from CommandLineCoding/issue-13 #15

Workflow file for this run

name: Backend CI
on:
push:
branches: [ main, dev ]
paths:
- "backend/**"
- ".github/workflows/backend-ci.yml"
pull_request:
branches: [ main, dev ]
paths:
- "backend/**"
- ".github/workflows/backend-ci.yml"
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: config.settings.local
POSTGRES_DB: fashio_test_db
POSTGRES_USER: fashio_test_user
POSTGRES_PASSWORD: fashio_test_password
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
JWT_SECRET: test-jwt-secret-key-for-ci-pipeline
defaults:
run:
working-directory: backend
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: fashio_test_db
POSTGRES_USER: fashio_test_user
POSTGRES_PASSWORD: fashio_test_password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install uv and enable caching
uses: astral-sh/setup-uv@v5
with:
version: "latest"
enable-cache: true
cache-dependency-lock-file: "backend/uv.lock"
- name: Ensure Python 3.12 is installed
run: uv python install 3.12
- name: Install project dependencies
run: uv sync --frozen
- name: Lint code with Ruff
run: uv run ruff check .
- name: Check code formatting with Ruff
run: uv run ruff format --check .
- name: Run Pytest suite
run: uv run pytest