Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,580 changes: 1,580 additions & 0 deletions .github/prompts/plan-ExploitDbRagMvp-backend.prompt.md

Large diffs are not rendered by default.

741 changes: 741 additions & 0 deletions .github/skills/fastapi-development/SKILL.md

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Backend Tests

on:
push:
branches: [ main, develop, backend ]
paths:
- 'backend/**'
- '.github/workflows/backend-tests.yml'
pull_request:
branches: [ main, develop, backend ]
paths:
- 'backend/**'

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: exploitrag_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:7-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
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Create .env.test file
working-directory: ./backend
run: |
cp .env.test.example .env.test || cp .env.test .env
continue-on-error: true

- name: Run linting
working-directory: ./backend
run: |
pip install black ruff
black --check app tests
ruff check app tests
continue-on-error: true

- name: Run tests with coverage
working-directory: ./backend
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/exploitrag_test
REDIS_URL: redis://localhost:6379/1
JWT_SECRET_KEY: test-secret-key-for-ci
ENVIRONMENT: test
run: |
pytest --cov=app --cov-report=xml --cov-report=term-missing -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./backend/coverage.xml
flags: backend
name: backend-coverage
continue-on-error: true

- name: Generate coverage badge
if: github.ref == 'refs/heads/main'
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: ./backend/coverage.xml
continue-on-error: true

- name: Test Summary
if: always()
run: |
echo "### Test Results :test_tube:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Tests completed for backend" >> $GITHUB_STEP_SUMMARY
Loading
Loading