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
118 changes: 118 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: CI Pipeline

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

jobs:
backend:
name: Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: ${{ secrets.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
POSTGRES_DB: ${{ secrets.DB_NAME }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Dependencies
run: bun install --frozen-lockfile

- name: Build
run: bun run build

- name: Test with Coverage
run: bun run test:ci
env:
DB_HOST: localhost
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
NODE_ENV: test

- name: Upload Coverage Reports
uses: codecov/codecov-action@v4
if: always()
with:
files: ./backend/coverage/lcov.info,./backend/coverage/cobertura-coverage.xml
flags: backend
name: backend-coverage
fail_ci_if_error: false
verbose: true

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

- name: Coverage Summary
if: always()
run: |
echo "### Backend Test Coverage Report 📊" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f coverage/coverage-summary.json ]; then
node -e "
const coverage = require('./coverage/coverage-summary.json');
const total = coverage.total;
console.log('| Metric | Coverage | Status |');
console.log('|--------|----------|--------|');
console.log(\`| Lines | \${total.lines.pct}% | \${total.lines.pct >= 70 ? '✅' : '⚠️'} |\`);
console.log(\`| Statements | \${total.statements.pct}% | \${total.statements.pct >= 70 ? '✅' : '⚠️'} |\`);
console.log(\`| Functions | \${total.functions.pct}% | \${total.functions.pct >= 65 ? '✅' : '⚠️'} |\`);
console.log(\`| Branches | \${total.branches.pct}% | \${total.branches.pct >= 60 ? '✅' : '⚠️'} |\`);
" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Coverage summary not found" >> $GITHUB_STEP_SUMMARY
fi

frontend:
name: Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend

steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Dependencies
run: bun install --frozen-lockfile

- name: Build
run: bun run build
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}

- name: Lint
run: bun run lint

- name: Test
run: bun test || true
env:
CI: true
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Environment variables (SECURITY CRITICAL - DO NOT COMMIT)
.env
.env.local
.env.*.local
.env.production
.env.development
**/.env
**/.env.local

# Dependencies
node_modules/
**/node_modules/

# Build outputs
dist/
build/
**/dist/
**/build/

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*

# Certificates and keys (SECURITY CRITICAL)
*.pem
*.key
*.cert
*.crt
*.p12
*.pfx
ssl/
certificates/

# Database
*.sqlite
*.db
*.dump
*.sql.gz

# Docker volumes data
postgres_data/

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

# OS files
.DS_Store
Thumbs.db

# Temporary files
tmp/
temp/
*.tmp

# Coverage
coverage/
.nyc_output/

# Backup files
*.bak
*.backup
Loading
Loading