mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:41:09 +02:00
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>
This commit is contained in:
parent
714298f7c8
commit
1ecdee462b
6 changed files with 756 additions and 56 deletions
168
.github/workflows/ci-main.full.yml
vendored
Normal file
168
.github/workflows/ci-main.full.yml
vendored
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
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'
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
|
||||
jobs:
|
||||
# Full validation on main branch
|
||||
validate:
|
||||
name: Validate Main Branch
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- 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
|
||||
|
||||
- name: Run format check
|
||||
run: pnpm run format:check
|
||||
|
||||
- name: Run lint
|
||||
run: pnpm run lint
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run type check
|
||||
run: pnpm run type-check
|
||||
|
||||
- name: Build all projects
|
||||
run: pnpm run build
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test || echo "Some tests failed"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate build summary
|
||||
run: |
|
||||
echo "## Main Branch Build Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Author**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Timestamp**: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Build Status" >> $GITHUB_STEP_SUMMARY
|
||||
echo "All projects built successfully" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# Build and push Docker images for backend services
|
||||
build-docker-images:
|
||||
name: Build Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
needs: validate
|
||||
strategy:
|
||||
matrix:
|
||||
service:
|
||||
- { name: 'maerchenzauber-backend', path: 'apps/maerchenzauber/apps/backend', port: '3002' }
|
||||
- { name: 'chat-backend', path: 'apps/chat/apps/backend', port: '3002' }
|
||||
- { name: 'manadeck-backend', path: 'apps/manadeck/apps/backend', port: '3003' }
|
||||
- { name: 'nutriphi-backend', path: 'apps/nutriphi/apps/backend', port: '3004' }
|
||||
- { name: 'news-api', path: 'apps/news/apps/api', port: '3005' }
|
||||
- { name: 'mana-core-auth', path: 'services/mana-core-auth', port: '3001' }
|
||||
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 have been built and pushed successfully." >> $GITHUB_STEP_SUMMARY
|
||||
echo "Staging deployment workflow has been triggered." >> $GITHUB_STEP_SUMMARY
|
||||
52
.github/workflows/ci-main.yml
vendored
52
.github/workflows/ci-main.yml
vendored
|
|
@ -1,3 +1,8 @@
|
|||
# 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:
|
||||
|
|
@ -13,19 +18,15 @@ concurrency:
|
|||
env:
|
||||
NODE_VERSION: '20'
|
||||
PNPM_VERSION: '9.15.0'
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
|
||||
jobs:
|
||||
# Full validation on main branch
|
||||
# Quick validation - skip heavy checks for faster iteration
|
||||
validate:
|
||||
name: Validate Main Branch
|
||||
name: Quick Validate
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
|
@ -44,35 +45,7 @@ jobs:
|
|||
- name: Build shared packages
|
||||
run: pnpm run build:packages
|
||||
|
||||
- name: Run format check
|
||||
run: pnpm run format:check
|
||||
|
||||
- name: Run lint
|
||||
run: pnpm run lint
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run type check
|
||||
run: pnpm run type-check
|
||||
|
||||
- name: Build all projects
|
||||
run: pnpm run build
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test || echo "Some tests failed"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate build summary
|
||||
run: |
|
||||
echo "## Main Branch Build Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Author**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Timestamp**: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Build Status" >> $GITHUB_STEP_SUMMARY
|
||||
echo "All projects built successfully" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# Build and push Docker images for backend services
|
||||
# Build only mana-core-auth and chat Docker images
|
||||
build-docker-images:
|
||||
name: Build Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -80,12 +53,9 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
service:
|
||||
- { name: 'maerchenzauber-backend', path: 'apps/maerchenzauber/apps/backend', port: '3002' }
|
||||
- { name: 'chat-backend', path: 'apps/chat/apps/backend', port: '3002' }
|
||||
- { name: 'manadeck-backend', path: 'apps/manadeck/apps/backend', port: '3003' }
|
||||
- { name: 'nutriphi-backend', path: 'apps/nutriphi/apps/backend', port: '3004' }
|
||||
- { name: 'news-api', path: 'apps/news/apps/api', port: '3005' }
|
||||
- { 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
|
||||
|
|
@ -164,5 +134,5 @@ jobs:
|
|||
run: |
|
||||
echo "## Staging Deployment Triggered" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Docker images have been built and pushed successfully." >> $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
|
||||
|
|
|
|||
180
.github/workflows/test-coverage.full.yml
vendored
Normal file
180
.github/workflows/test-coverage.full.yml
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
name: Test Coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
# Run weekly on Sundays at 00:00 UTC
|
||||
- cron: '0 0 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
PNPM_VERSION: '9.15.0'
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
|
||||
jobs:
|
||||
test-coverage:
|
||||
name: Test Coverage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- 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
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: pnpm run test --coverage || echo "Some tests failed"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Collect coverage reports
|
||||
run: |
|
||||
# Find all coverage directories
|
||||
find . -type d -name coverage \( -path "*/apps/*/apps/*" -o -path "*/services/*" \) > coverage_dirs.txt
|
||||
|
||||
# Create combined coverage directory
|
||||
mkdir -p coverage-combined
|
||||
|
||||
# Copy all coverage files
|
||||
while IFS= read -r dir; do
|
||||
if [ -f "$dir/coverage-final.json" ]; then
|
||||
PROJECT=$(echo $dir | sed 's|./apps/||' | sed 's|./services/||' | sed 's|/coverage||' | tr '/' '-')
|
||||
cp "$dir/coverage-final.json" "coverage-combined/coverage-$PROJECT.json"
|
||||
fi
|
||||
done < coverage_dirs.txt
|
||||
|
||||
- name: Generate coverage summary
|
||||
run: |
|
||||
echo "## Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# Find and parse coverage summaries
|
||||
find . -type f -name "coverage-summary.json" | while read -r file; do
|
||||
PROJECT=$(dirname $file | sed 's|./apps/||' | sed 's|./services/||' | sed 's|/coverage||')
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
LINES=$(jq -r '.total.lines.pct' "$file" 2>/dev/null || echo "0")
|
||||
STATEMENTS=$(jq -r '.total.statements.pct' "$file" 2>/dev/null || echo "0")
|
||||
FUNCTIONS=$(jq -r '.total.functions.pct' "$file" 2>/dev/null || echo "0")
|
||||
BRANCHES=$(jq -r '.total.branches.pct' "$file" 2>/dev/null || echo "0")
|
||||
|
||||
echo "### $PROJECT" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Metric | Coverage |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|--------|----------|" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Lines | ${LINES}% |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Statements | ${STATEMENTS}% |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Functions | ${FUNCTIONS}% |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Branches | ${BRANCHES}% |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Archive coverage reports
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-reports
|
||||
path: |
|
||||
apps/**/coverage
|
||||
services/**/coverage
|
||||
coverage-combined
|
||||
retention-days: 30
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Check coverage thresholds
|
||||
run: |
|
||||
echo "Checking coverage thresholds..."
|
||||
|
||||
# Set minimum coverage threshold
|
||||
MINIMUM_COVERAGE=50 # Start with 50%, increase gradually
|
||||
|
||||
# Check each project's coverage
|
||||
find . -type f -name "coverage-summary.json" | while read -r file; do
|
||||
PROJECT=$(dirname $file | sed 's|./apps/||' | sed 's|./services/||' | sed 's|/coverage||')
|
||||
LINES=$(jq -r '.total.lines.pct' "$file" 2>/dev/null || echo "0")
|
||||
|
||||
echo "Checking $PROJECT: ${LINES}% coverage"
|
||||
|
||||
# Convert to integer for comparison
|
||||
LINES_INT=$(printf "%.0f" $LINES)
|
||||
|
||||
if [ "$LINES_INT" -lt "$MINIMUM_COVERAGE" ]; then
|
||||
echo "⚠️ Warning: $PROJECT coverage (${LINES}%) is below minimum threshold (${MINIMUM_COVERAGE}%)"
|
||||
else
|
||||
echo "✅ $PROJECT meets coverage threshold"
|
||||
fi
|
||||
done
|
||||
|
||||
# Generate coverage badge
|
||||
coverage-badge:
|
||||
name: Update Coverage Badge
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-coverage
|
||||
if: github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download coverage reports
|
||||
uses: actions/download-artifact@v4
|
||||
continue-on-error: true
|
||||
id: download-coverage
|
||||
with:
|
||||
name: coverage-reports
|
||||
path: coverage-reports
|
||||
|
||||
- name: Create coverage badge
|
||||
if: steps.download-coverage.outcome == 'success'
|
||||
run: |
|
||||
# Calculate overall coverage
|
||||
TOTAL_LINES=0
|
||||
COVERED_LINES=0
|
||||
|
||||
find coverage-reports -type f -name "coverage-summary.json" | while read -r file; do
|
||||
LINES=$(jq -r '.total.lines.total' "$file" 2>/dev/null || echo "0")
|
||||
COVERED=$(jq -r '.total.lines.covered' "$file" 2>/dev/null || echo "0")
|
||||
|
||||
TOTAL_LINES=$((TOTAL_LINES + LINES))
|
||||
COVERED_LINES=$((COVERED_LINES + COVERED))
|
||||
done
|
||||
|
||||
if [ "$TOTAL_LINES" -gt 0 ]; then
|
||||
COVERAGE=$(echo "scale=2; $COVERED_LINES * 100 / $TOTAL_LINES" | bc)
|
||||
echo "Overall coverage: ${COVERAGE}%"
|
||||
echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "No coverage data found"
|
||||
echo "COVERAGE=0" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Update README badge
|
||||
if: steps.download-coverage.outcome == 'success'
|
||||
run: |
|
||||
echo "Coverage badge data ready: ${{ env.COVERAGE }}%"
|
||||
# This would update a badge in the README or create a gist
|
||||
# Implementation depends on chosen badge service (shields.io, codecov, etc.)
|
||||
|
||||
- name: Skip badge update
|
||||
if: steps.download-coverage.outcome != 'success'
|
||||
run: echo "No coverage reports available - skipping badge update"
|
||||
14
.github/workflows/test-coverage.yml
vendored
14
.github/workflows/test-coverage.yml
vendored
|
|
@ -1,16 +1,10 @@
|
|||
# DISABLED: Only runs manually for faster iteration
|
||||
# Full config archived at: .github/workflows/test-coverage.full.yml
|
||||
# To restore: cp .github/workflows/test-coverage.full.yml .github/workflows/test-coverage.yml
|
||||
name: Test Coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
# Run weekly on Sundays at 00:00 UTC
|
||||
- cron: '0 0 * * 0'
|
||||
workflow_dispatch:
|
||||
workflow_dispatch: # Manual trigger only
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
|
|
|
|||
389
.github/workflows/test.full.yml
vendored
Normal file
389
.github/workflows/test.full.yml
vendored
Normal file
|
|
@ -0,0 +1,389 @@
|
|||
name: Test Suite
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
push:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel in-progress runs for same PR/branch
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
PNPM_VERSION: '9.15.0'
|
||||
|
||||
jobs:
|
||||
# ====================
|
||||
# 1. TEST BACKENDS
|
||||
# ====================
|
||||
test-backends:
|
||||
name: Test Backend - ${{ matrix.project }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
project:
|
||||
- maerchenzauber
|
||||
- manadeck
|
||||
- chat
|
||||
- nutriphi
|
||||
- picture
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Type check
|
||||
run: pnpm --filter @${{ matrix.project }}/backend type-check
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: pnpm --filter @${{ matrix.project }}/backend test:cov
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
- name: Check coverage thresholds
|
||||
run: |
|
||||
echo "Checking coverage meets 80% threshold..."
|
||||
# Jest/Vitest will fail if thresholds aren't met
|
||||
|
||||
# ====================
|
||||
# 2. TEST MOBILE APPS
|
||||
# ====================
|
||||
test-mobile:
|
||||
name: Test Mobile - ${{ matrix.project }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
project:
|
||||
- maerchenzauber
|
||||
- memoro
|
||||
- picture
|
||||
- chat
|
||||
- manacore
|
||||
- manadeck
|
||||
- nutriphi
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Type check
|
||||
run: pnpm --filter @${{ matrix.project }}/mobile type-check
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: pnpm --filter @${{ matrix.project }}/mobile test -- --coverage --watchAll=false --ci
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
# ====================
|
||||
# 3. TEST WEB APPS
|
||||
# ====================
|
||||
test-web:
|
||||
name: Test Web - ${{ matrix.project }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
project:
|
||||
- maerchenzauber
|
||||
- manacore
|
||||
- memoro
|
||||
- picture
|
||||
- uload
|
||||
- chat
|
||||
- manadeck
|
||||
- nutriphi
|
||||
- news
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Type check
|
||||
run: pnpm --filter @${{ matrix.project }}/web check
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
run: pnpm --filter @${{ matrix.project }}/web test:unit -- --coverage --run
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
# ====================
|
||||
# 4. E2E TESTS (WEB)
|
||||
# ====================
|
||||
test-e2e-web:
|
||||
name: E2E Web - ${{ matrix.project }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
project:
|
||||
- uload
|
||||
# Add other projects with E2E tests
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: pnpm --filter @${{ matrix.project }}/web exec playwright install --with-deps chromium
|
||||
|
||||
- name: Build application
|
||||
run: pnpm --filter @${{ matrix.project }}/web build
|
||||
|
||||
- name: Run E2E tests
|
||||
run: pnpm --filter @${{ matrix.project }}/web test:e2e
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report-${{ matrix.project }}
|
||||
path: ./apps/${{ matrix.project }}/apps/web/playwright-report/
|
||||
retention-days: 7
|
||||
|
||||
# ====================
|
||||
# 5. TEST SHARED PACKAGES
|
||||
# ====================
|
||||
test-shared-packages:
|
||||
name: Test Shared Packages
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Type check shared packages
|
||||
run: pnpm --filter './packages/*' type-check
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: pnpm --filter './packages/*' test -- --coverage --run
|
||||
continue-on-error: true
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
# ====================
|
||||
# 6. LINT & FORMAT CHECK
|
||||
# ====================
|
||||
lint-and-format:
|
||||
name: Lint & Format
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
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
|
||||
|
||||
- name: Check formatting
|
||||
run: pnpm run format:check
|
||||
|
||||
- name: Run linters
|
||||
run: pnpm run lint
|
||||
continue-on-error: true
|
||||
|
||||
# ====================
|
||||
# 7. COVERAGE REPORT
|
||||
# ====================
|
||||
coverage-report:
|
||||
name: Generate Coverage Report
|
||||
needs:
|
||||
- test-backends
|
||||
- test-mobile
|
||||
- test-web
|
||||
- test-shared-packages
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download all coverage reports
|
||||
uses: actions/download-artifact@v4
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate coverage summary
|
||||
run: |
|
||||
echo "## 📊 Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Jobs Status" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Backend Tests: ${{ needs.test-backends.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Mobile Tests: ${{ needs.test-mobile.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Web Tests: ${{ needs.test-web.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Shared Packages Tests: ${{ needs.test-shared-packages.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# ====================
|
||||
# 8. TEST STATUS CHECK
|
||||
# ====================
|
||||
test-status:
|
||||
name: All Tests Status
|
||||
needs:
|
||||
- test-backends
|
||||
- test-mobile
|
||||
- test-web
|
||||
- test-shared-packages
|
||||
- lint-and-format
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: Check test results
|
||||
run: |
|
||||
if [ "${{ needs.test-backends.result }}" != "success" ] || \
|
||||
[ "${{ needs.test-mobile.result }}" != "success" ] || \
|
||||
[ "${{ needs.test-web.result }}" != "success" ] || \
|
||||
[ "${{ needs.test-shared-packages.result }}" != "success" ]; then
|
||||
echo "❌ Some tests failed"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ All tests passed"
|
||||
|
||||
- name: Post PR comment
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const status = '${{ needs.test-status.result }}' === 'success' ? '✅' : '❌';
|
||||
const body = `## ${status} Test Suite Results
|
||||
|
||||
**Status**: ${status === '✅' ? 'All tests passed!' : 'Some tests failed'}
|
||||
|
||||
### Test Coverage
|
||||
- Backend: ${{ needs.test-backends.result }}
|
||||
- Mobile: ${{ needs.test-mobile.result }}
|
||||
- Web: ${{ needs.test-web.result }}
|
||||
- Shared Packages: ${{ needs.test-shared-packages.result }}
|
||||
- Lint & Format: ${{ needs.lint-and-format.result }}
|
||||
|
||||
View detailed results in the [Actions tab](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
`;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body
|
||||
});
|
||||
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
|
|
@ -1,11 +1,10 @@
|
|||
# DISABLED: Only runs manually for faster iteration
|
||||
# Full config archived at: .github/workflows/test.full.yml
|
||||
# To restore: cp .github/workflows/test.full.yml .github/workflows/test.yml
|
||||
name: Test Suite
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
push:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
workflow_dispatch: # Manual trigger only
|
||||
|
||||
# Cancel in-progress runs for same PR/branch
|
||||
concurrency:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue