workspace-v1/control-plane/ci/github-actions/workflows/ci-template.yml
Adrian Flores Cortes 967ab360bb Initial commit: Workspace v1 with 3-layer architecture
Structure:
- control-plane/: Registries, SIMCO directives, CI/CD templates
- projects/: Gamilit, ERP-Suite, Trading-Platform, Betting-Analytics
- shared/: Libs catalog, knowledge-base

Key features:
- Centralized port, domain, database, and service registries
- 23 SIMCO directives + 6 fundamental principles
- NEXUS agent profiles with delegation rules
- Validation scripts for workspace integrity
- Dockerfiles for all services
- Path aliases for quick reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:35:19 -06:00

139 lines
4.2 KiB
YAML

# ==============================================================================
# GITHUB ACTIONS CI TEMPLATE - Control Plane
# ==============================================================================
# Proposito: Template base para workflows de CI/CD
# Uso: Copiar a .github/workflows/ del proyecto y personalizar
# ==============================================================================
name: CI - {{SERVICE_NAME}}
on:
push:
branches: [main, develop]
paths:
- '{{SERVICE_PATH}}/**'
- '.github/workflows/{{SERVICE_NAME}}-ci.yml'
pull_request:
branches: [main, develop]
paths:
- '{{SERVICE_PATH}}/**'
env:
SERVICE_NAME: '{{SERVICE_NAME}}'
PROJECT_NAME: '{{PROJECT_NAME}}'
NODE_VERSION: '20'
jobs:
# ============================================================================
# JOB 1: VALIDATE
# ============================================================================
validate:
name: Validate Registries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate Ports
run: |
chmod +x control-plane/devtools/scripts/validation/validate-ports.sh
./control-plane/devtools/scripts/validation/validate-ports.sh
- name: Validate Service Descriptors
run: |
chmod +x control-plane/devtools/scripts/validation/validate-service-descriptors.sh
./control-plane/devtools/scripts/validation/validate-service-descriptors.sh
# ============================================================================
# JOB 2: BUILD & TEST
# ============================================================================
build:
name: Build & Test
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: '{{SERVICE_PATH}}/package-lock.json'
- name: Install dependencies
working-directory: '{{SERVICE_PATH}}'
run: npm ci
- name: Lint
working-directory: '{{SERVICE_PATH}}'
run: npm run lint
- name: Build
working-directory: '{{SERVICE_PATH}}'
run: npm run build
- name: Test
working-directory: '{{SERVICE_PATH}}'
run: npm run test:ci || true
- name: Upload coverage
if: always()
uses: codecov/codecov-action@v3
with:
directory: '{{SERVICE_PATH}}/coverage'
flags: ${{ env.SERVICE_NAME }}
# ============================================================================
# JOB 3: DOCKER BUILD (solo en main)
# ============================================================================
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: '{{SERVICE_PATH}}'
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
ghcr.io/${{ github.repository }}/${{ env.SERVICE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# ============================================================================
# JOB 4: DEPLOY (solo en tags)
# ============================================================================
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: docker
if: startsWith(github.ref, 'refs/tags/v')
environment: production
steps:
- name: Deploy to production
run: |
echo "Deploying ${{ env.SERVICE_NAME }} to production"
# Add deployment commands here