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
16 changes: 16 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
max-line-length = 127
extend-ignore = E203, W503, E501
exclude =
.git,
__pycache__,
venv,
.venv,
build,
dist,
*.egg-info,
.pytest_cache,
htmlcov,
coverage
max-complexity = 10

70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy

on:
push:
branches: [main]
workflow_dispatch:

jobs:
# Frontend deployment handled by Vercel automatically
# This workflow is for backend deployment preparation

deploy-backend:
name: Deploy Backend
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

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

- name: Run tests before deploy
run: |
pip install -r api/requirements-dev.txt
pytest

- name: Build success
run: echo "Backend tests passed, ready for deployment"

# Actual deployment will be configured with Railway/Render CLI
# For now, this ensures tests pass before manual deployment

build-frontend:
name: Build Frontend
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install dependencies
working-directory: ./web
run: pnpm install

- name: Build Next.js
working-directory: ./web
run: pnpm build
env:
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}

- name: Build success
run: echo "Frontend build successful"

66 changes: 66 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Lint

on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]

jobs:
# Backend Linting
backend-lint:
name: Backend Linting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r api/requirements-dev.txt

- name: Run flake8
run: |
flake8 api/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 api/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Run black (check)
run: |
black --check api/

- name: Run isort (check)
run: |
isort --check-only api/

# Frontend Linting
frontend-lint:
name: Frontend Linting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install dependencies
working-directory: ./web
run: pnpm install

- name: Run ESLint
working-directory: ./web
run: pnpm lint

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

on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]

jobs:
# Backend Tests
backend-tests:
name: Backend Tests (Python)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r api/requirements.txt
pip install -r api/requirements-dev.txt

- name: Run pytest
run: |
pytest --cov=api --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: backend
name: backend-coverage

# Frontend Tests
frontend-tests:
name: Frontend Tests (Node.js)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
working-directory: ./web
run: pnpm install

- name: Run Vitest
working-directory: ./web
run: pnpm test --run

- name: Run ESLint
working-directory: ./web
run: pnpm lint

# E2E Tests
e2e-tests:
name: E2E Tests (Playwright)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install dependencies
working-directory: ./web
run: pnpm install

- name: Install Playwright Browsers
working-directory: ./web
run: pnpm exec playwright install --with-deps chromium

- name: Build Next.js app
working-directory: ./web
run: pnpm build

- name: Run Playwright tests
working-directory: ./web
run: pnpm test:e2e

- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: web/playwright-report/
retention-days: 30

39 changes: 38 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
# Python virtual environments
.venv/
venv/
.env
.env

# Python cache files
__pycache__/
*.pyc
*.pyo
*.pyd
.Python

# Database files
*.db
billions.db

# IDE files
.vscode/
.idea/
*.swp
*.swo

# Test files
test_*.py
*_test.py

# Coverage files
coverage.xml
htmlcov/

# OS files
.DS_Store
Thumbs.db

# Build files
dist/
build/
*.egg-info/

# Logs
*.log
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
repos:
# Python formatting and linting
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black
language_version: python3.12
files: ^api/

- repo: https://github.com/pycqa/isort
rev: 6.1.0
hooks:
- id: isort
args: ["--profile", "black"]
files: ^api/

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
args: ["--max-line-length=127", "--extend-ignore=E203,W503"]
files: ^api/

# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-json
- id: check-merge-conflict
- id: detect-private-key

# Frontend linting
- repo: local
hooks:
- id: frontend-lint
name: Frontend ESLint
entry: bash -c 'cd web && pnpm lint'
language: system
files: ^web/.*\.(ts|tsx|js|jsx)$
pass_filenames: false

Loading
Loading