diff --git a/.github/workflows/cd-staging.full.yml b/.github/workflows/cd-staging.yml.bak similarity index 100% rename from .github/workflows/cd-staging.full.yml rename to .github/workflows/cd-staging.yml.bak diff --git a/.github/workflows/ci-main.full.yml b/.github/workflows/ci-main.yml.bak similarity index 100% rename from .github/workflows/ci-main.full.yml rename to .github/workflows/ci-main.yml.bak diff --git a/.github/workflows/test-coverage.full.yml b/.github/workflows/test-coverage.yml.bak similarity index 100% rename from .github/workflows/test-coverage.full.yml rename to .github/workflows/test-coverage.yml.bak diff --git a/.github/workflows/test-coverage.yml.disabled b/.github/workflows/test-coverage.yml.disabled deleted file mode 100644 index 99f68d932..000000000 --- a/.github/workflows/test-coverage.yml.disabled +++ /dev/null @@ -1,174 +0,0 @@ -# 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: - workflow_dispatch: # Manual trigger only - -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" diff --git a/.github/workflows/test.full.yml b/.github/workflows/test.yml.bak similarity index 100% rename from .github/workflows/test.full.yml rename to .github/workflows/test.yml.bak diff --git a/.github/workflows/test.yml.disabled b/.github/workflows/test.yml.disabled deleted file mode 100644 index d7d95675e..000000000 --- a/.github/workflows/test.yml.disabled +++ /dev/null @@ -1,388 +0,0 @@ -# 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: - workflow_dispatch: # Manual trigger only - -# 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 - });