Skip to content
Merged
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
98 changes: 49 additions & 49 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
name: Docker Build

on:
push:
branches: [main, develop]
paths:
- "backend/Dockerfile"
- "backend/docker-compose.yml"
- "backend/requirements.txt"
- ".github/workflows/docker.yml"
pull_request:
branches: [main]

jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Build backend image
run: |
cd backend
docker build --tag codeguard-backend:${{ github.sha }} .

- name: Test Docker image
run: |
docker run --rm codeguard-backend:${{ github.sha }} python --version

- name: Test Docker Compose (validation only)
run: |
cd backend
docker-compose config

- name: Summary
if: success()
run: |
echo " Docker image built successfully!"
echo " Image: codeguard-backend:${{ github.sha }}"
name: Docker Build
on:
push:
branches: [main, develop]
paths:
- "backend/Dockerfile"
- "backend/docker-compose.yml"
- "backend/requirements.txt"
- ".github/workflows/docker.yml"
pull_request:
branches: [main]
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Build backend image
run: |
cd backend
docker build --tag codeguard-backend:${{ github.sha }} .
- name: Test Docker image
run: |
docker run --rm codeguard-backend:${{ github.sha }} python --version
- name: Test Docker Compose (validation only)
run: |
cd backend
docker-compose config
- name: Summary
if: success()
run: |
echo " Docker image built successfully!"
echo " Image: codeguard-backend:${{ github.sha }}"
112 changes: 56 additions & 56 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: Lint & Format Check

on:
push:
branches: [main, develop, "feature/**"]
paths:
- "backend/**/*.py"
- ".github/workflows/lint.yml"
pull_request:
branches: [main, develop]
paths:
- "backend/**/*.py"

jobs:
lint:
name: Code Quality Check
runs-on: ubuntu-latest

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 linting dependencies
run: |
python -m pip install --upgrade pip
pip install black>=23.0.0 flake8>=7.0.0 isort>=5.13.0

- name: Check code formatting with Black
run: |
cd backend
black src/ --line-length=100 --check

- name: Check import sorting with isort
run: |
cd backend
isort src/ --profile=black --line-length=100 --check-only

- name: Lint with Flake8
run: |
cd backend
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 src/ --count --max-complexity=10 --max-line-length=100 --statistics

- name: Summary
if: success()
run: |
echo "= All code quality checks passed!"
echo "- Black formatting: ✓"
echo "- Import sorting (isort): ✓"
echo "- Linting (flake8): ✓"
name: Lint & Format Check
on:
push:
branches: [main, develop, "feature/**"]
paths:
- "backend/**/*.py"
- ".github/workflows/lint.yml"
pull_request:
branches: [main, develop]
paths:
- "backend/**/*.py"
jobs:
lint:
name: Code Quality Check
runs-on: ubuntu-latest
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 linting dependencies
run: |
python -m pip install --upgrade pip
pip install black>=23.0.0 flake8>=7.0.0 isort>=5.13.0
- name: Check code formatting with Black
run: |
cd backend
black src/ --line-length=100 --check
- name: Check import sorting with isort
run: |
cd backend
isort src/ --profile=black --line-length=100 --check-only
- name: Lint with Flake8
run: |
cd backend
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 src/ --count --max-complexity=10 --max-line-length=100 --statistics
- name: Summary
if: success()
run: |
echo "= All code quality checks passed!"
echo "- Black formatting: ✓"
echo "- Import sorting (isort): ✓"
echo "- Linting (flake8): ✓"
140 changes: 70 additions & 70 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
name: Tests & Coverage

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

jobs:
test:
name: Run Tests & Coverage
runs-on: ubuntu-latest

env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}

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
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest>=8.0.0 pytest-asyncio>=0.23.0 pytest-cov>=4.1.0

- name: Run tests with coverage
run: |
cd backend
pytest tests/ --cov=src --cov-report=html --cov-report=term-missing --cov-report=xml --cov-fail-under=75 -v
continue-on-error: false

- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: backend/htmlcov/
retention-days: 30

- name: Upload coverage to Codecov (optional)
if: always()
uses: codecov/codecov-action@v4
with:
file: backend/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Summary
if: success()
run: |
echo "All tests passed with >75% coverage!"
echo "Coverage report uploaded as artifact"
name: Tests & Coverage
on:
push:
branches: [main, develop, "feature/**"]
paths:
- "backend/**/*.py"
- "backend/tests/**"
- ".github/workflows/test.yml"
pull_request:
branches: [main, develop]
paths:
- "backend/**/*.py"
- "backend/tests/**"
jobs:
test:
name: Run Tests & Coverage
runs-on: ubuntu-latest
env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
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
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest>=8.0.0 pytest-asyncio>=0.23.0 pytest-cov>=4.1.0
- name: Run tests with coverage
run: |
cd backend
pytest tests/ --cov=src --cov-report=html --cov-report=term-missing --cov-report=xml --cov-fail-under=75 -v
continue-on-error: false
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: backend/htmlcov/
retention-days: 30
- name: Upload coverage to Codecov (optional)
if: always()
uses: codecov/codecov-action@v4
with:
file: backend/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Summary
if: success()
run: |
echo "All tests passed with >75% coverage!"
echo "Coverage report uploaded as artifact"
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/test
/out
.DS_Store
node_modules
.env
/test
/out
.DS_Store
node_modules
.env
Loading