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

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

permissions:
contents: read

jobs:
backend-test:
runs-on: ubuntu-latest
permissions:
contents: read

services:
postgres:
image: postgres:14
env:
POSTGRES_DB: timemachines_test
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: backend/package-lock.json

- name: Install backend dependencies
working-directory: ./backend
run: npm ci

- name: Run backend tests
working-directory: ./backend
env:
DATABASE_URL: postgresql://testuser:testpass@localhost:5432/timemachines_test
JWT_SECRET: test-secret
NODE_ENV: test
run: npm test

frontend-test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
working-directory: ./frontend
run: npm ci

- name: Run frontend tests
working-directory: ./frontend
run: npm test

ai-service-test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: ai-service/requirements.txt

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

- name: Run AI service tests
working-directory: ./ai-service
run: pytest

build-docker:
runs-on: ubuntu-latest
needs: [backend-test, frontend-test, ai-service-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: read

steps:
- uses: actions/checkout@v3

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

- name: Build backend image
uses: docker/build-push-action@v4
with:
context: ./backend
push: false
tags: time-machines-backend:latest

- name: Build frontend image
uses: docker/build-push-action@v4
with:
context: ./frontend
push: false
tags: time-machines-frontend:latest

- name: Build AI service image
uses: docker/build-push-action@v4
with:
context: ./ai-service
push: false
tags: time-machines-ai:latest
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# Google App Engine generated folder
appengine-generated/

# Dependencies
node_modules/
__pycache__/
*.pyc
.Python
env/
venv/
*.egg-info/
dist/
build/

# Environment variables
.env
.env.local
.env.*.local

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

# OS
.DS_Store
Thumbs.db

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

# Testing
coverage/
.pytest_cache/

# Build outputs
frontend/dist/
frontend/build/
backend/dist/

# Database
*.db
*.sqlite
postgres-data/

# Docker
.docker/
Loading
Loading