Add comprehensive security and contribution documentation

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-06 22:00:17 +00:00
parent 53f20f25d1
commit 9ae57b2a8f
14 changed files with 2417 additions and 1 deletions
+99
View File
@@ -0,0 +1,99 @@
name: Security Scanning
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
# Run weekly on Mondays at 00:00 UTC
- cron: '0 0 * * 1'
jobs:
security-scan:
name: Security Vulnerability Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit safety detect-secrets
cd backend && pip install -r requirements.txt
- name: Run Bandit (Python Security Linter)
run: |
bandit -r backend/app -f json -o bandit-report.json || true
bandit -r backend/app
continue-on-error: true
- name: Run Safety (Dependency Vulnerability Check)
run: |
safety check --json || true
safety check
continue-on-error: true
- name: Run detect-secrets
run: |
detect-secrets scan --baseline .secrets.baseline || true
continue-on-error: true
- name: Upload Bandit Report
uses: actions/upload-artifact@v3
if: always()
with:
name: bandit-security-report
path: bandit-report.json
codeql-analysis:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
fail-on-severity: moderate
+130
View File
@@ -0,0 +1,130 @@
name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_PASSWORD: test_password
POSTGRES_USER: test_user
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd backend
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio
- name: Run tests with coverage
env:
DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db
SECRET_KEY: test_secret_key_for_ci
run: |
cd backend
pytest --cov=app --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./backend/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
lint:
name: Lint and Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install pylint black flake8 isort mypy
cd backend && pip install -r requirements.txt
- name: Run Black (format check)
run: |
black --check backend/app
- name: Run isort (import order check)
run: |
isort --check-only backend/app
- name: Run Flake8
run: |
flake8 backend/app --max-line-length=100 --extend-ignore=E203,W503
- name: Run Pylint
run: |
pylint backend/app --max-line-length=100 --disable=C0111,R0903
continue-on-error: true
docker-build:
name: Docker Build Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: |
docker compose build
- name: Test Docker image
run: |
docker compose up -d
sleep 10
docker compose ps
docker compose logs
docker compose down