managarten/.github/workflows/ci-main.yml
Wuesteon 1ecdee462b chore(ci): simplify pipelines for rapid testing
- ci-main.yml: Only builds mana-core-auth, chat-backend, chat-web
- test.yml: Disabled (manual trigger only)
- test-coverage.yml: Disabled (manual trigger only)

Archived full configs with .full.yml suffix for restoration.

To restore full pipelines:
  cp .github/workflows/ci-main.full.yml .github/workflows/ci-main.yml
  cp .github/workflows/test.full.yml .github/workflows/test.yml
  cp .github/workflows/test-coverage.full.yml .github/workflows/test-coverage.yml

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 02:12:59 +01:00

138 lines
4.2 KiB
YAML

# SIMPLIFIED: Only builds mana-core-auth + chat containers
# Full config archived at: .github/workflows/ci-main.full.yml
#
# To restore: cp .github/workflows/ci-main.full.yml .github/workflows/ci-main.yml
name: CI - Main Branch
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '20'
PNPM_VERSION: '9.15.0'
jobs:
# Quick validation - skip heavy checks for faster iteration
validate:
name: Quick Validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared packages
run: pnpm run build:packages
# Build only mana-core-auth and chat Docker images
build-docker-images:
name: Build Docker Images
runs-on: ubuntu-latest
needs: validate
strategy:
matrix:
service:
- { name: 'mana-core-auth', path: 'services/mana-core-auth', port: '3001' }
- { name: 'chat-backend', path: 'apps/chat/apps/backend', port: '3002' }
- { name: 'chat-web', path: 'apps/chat/apps/web', port: '3000' }
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check if Dockerfile exists
id: check-dockerfile
run: |
if [ -f "${{ matrix.service.path }}/Dockerfile" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Warning: No Dockerfile found for ${{ matrix.service.name }}"
fi
- name: Login to GitHub Container Registry
if: steps.check-dockerfile.outputs.exists == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
if: steps.check-dockerfile.outputs.exists == 'true'
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.service.name }}
tags: |
type=sha,prefix={{branch}}-
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push
if: steps.check-dockerfile.outputs.exists == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.service.path }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
NODE_ENV=production
PORT=${{ matrix.service.port }}
- name: Image digest
if: steps.check-dockerfile.outputs.exists == 'true'
run: echo "Image digest - ${{ steps.meta.outputs.digest }}"
# Trigger staging deployment
trigger-staging-deploy:
name: Trigger Staging Deployment
runs-on: ubuntu-latest
needs: build-docker-images
if: github.ref == 'refs/heads/main'
steps:
- name: Trigger staging deployment workflow
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'cd-staging.yml',
ref: 'main'
});
- name: Deployment notification
run: |
echo "## Staging Deployment Triggered" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Docker images built: mana-core-auth, chat-backend, chat-web" >> $GITHUB_STEP_SUMMARY
echo "Staging deployment workflow has been triggered." >> $GITHUB_STEP_SUMMARY