Skip to content

Update controllers, services, and Flask API for production features #1

Update controllers, services, and Flask API for production features

Update controllers, services, and Flask API for production features #1

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Run tests
working-directory: backend
run: ./mvnw test -q
- name: Build JAR
working-directory: backend
run: ./mvnw package -DskipTests -q
- name: Build Docker image
working-directory: backend
run: docker build -t backend-api:test -f Dockerfile .
flask:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: flask-api/requirements.txt
- name: Install dependencies
working-directory: flask-api
run: |
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run tests
working-directory: flask-api
run: pytest --maxfail=1 -q || echo "No tests yet - skipping"
- name: Build Docker image
working-directory: flask-api
run: docker build -t flask-ml:test -f Dockerfile .
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Lint
working-directory: frontend
run: npm run lint || echo "No lint script - skipping"
- name: Build
working-directory: frontend
run: npm run build
- name: Build Docker image
working-directory: frontend
run: docker build -t frontend:test -f Dockerfile .
integration:
runs-on: ubuntu-latest
needs: [backend, flask, frontend]
steps:
- uses: actions/checkout@v4
- name: Start services with docker-compose
working-directory: infra
run: |
docker compose up -d --build
sleep 30 # Wait for services to be ready
- name: Check health endpoints
run: |
curl -f http://localhost:5001/health || exit 1
curl -f http://localhost:8081/actuator/health || exit 1
- name: Test API endpoints
run: |
curl -f "http://localhost:8081/api/v1/players?page=0&size=5" || exit 1
echo "Integration tests passed"
- name: Cleanup
if: always()
working-directory: infra
run: docker compose down