Skip to content

Quality Assurance Pipeline #160

Quality Assurance Pipeline

Quality Assurance Pipeline #160

name: Quality Assurance Pipeline
permissions:
contents: read
on:
push:
branches: [ main, master, develop ]
paths-ignore:
- '**.md'
- 'issue/**'
pull_request:
branches: [ main, master, develop ]
paths-ignore:
- '**.md'
- 'issue/**'
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
env:
NODE_VERSION: '22'
NEXT_PUBLIC_SITE_URL: https://www.sortvision.com
defaults:
run:
working-directory: ./SortVision
jobs:
quality-assurance:
name: Build, Test, and Quality Checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
cache-dependency-path: './SortVision/pnpm-lock.yaml'
- name: Cache Next.js build
uses: actions/cache@v5
with:
path: SortVision/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('SortVision/pnpm-lock.yaml', 'SortVision/package.json') }}
restore-keys: nextjs-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint code
run: pnpm run lint
continue-on-error: false
- name: Build application
run: pnpm run build
env:
NODE_ENV: production
- name: Start development server
run: |
pnpm run dev &
echo $! > .server-pid
npx wait-on http://localhost:3000 --timeout 120000
sleep 5 # Give server extra time to fully initialize
- name: Run complete test suite (600+ tests)
run: pnpm test
env:
CI: 'true'
GITHUB_ACTIONS: 'true'
extended-quality-assurance:
name: Extended Quality Assurance (Nightly/Manual)
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 45
defaults:
run:
working-directory: ./SortVision
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Next.js build
uses: actions/cache@v5
with:
path: SortVision/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('SortVision/pnpm-lock.yaml', 'SortVision/package.json') }}
restore-keys: nextjs-${{ runner.os }}-
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
cache-dependency-path: './SortVision/pnpm-lock.yaml'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build application
run: pnpm run build
env:
NODE_ENV: production
- name: Start development server
run: |
pnpm run dev &
echo $! > .server-pid
npx wait-on http://localhost:3000 --timeout 180000
sleep 10
- name: Run extended test suite (1000+ tests)
run: pnpm run test:extended
env:
CI: 'true'
GITHUB_ACTIONS: 'true'
- name: Stop server
if: always()
run: |
if [ -f .server-pid ]; then
kill $(cat .server-pid) 2>/dev/null || true
rm .server-pid
fi
- name: Generate and validate sitemap
run: |
pnpm run generate-sitemap
if [ ! -f public/sitemap.xml ]; then
echo "ERROR: Sitemap generation failed"
exit 1
fi
echo "Sitemap generated: $(wc -l < public/sitemap.xml) lines"
- name: Security audit
run: pnpm audit --production --audit-level=moderate
continue-on-error: true
- name: Analyze bundle size
run: |
echo "=== Bundle Size Analysis ==="
du -sh .next/static/chunks/* 2>/dev/null | sort -h | tail -10 || echo "No chunks found"
TOTAL_SIZE=$(du -sb .next 2>/dev/null | awk '{print $1}')
TOTAL_SIZE_MB=$((TOTAL_SIZE / 1024 / 1024))
echo "Total build size: ${TOTAL_SIZE_MB}MB"
if [ $TOTAL_SIZE_MB -gt 50 ]; then
echo "WARNING: Build size exceeds 50MB"
fi
- name: Stop server
if: always()
run: |
if [ -f .server-pid ]; then
kill $(cat .server-pid) 2>/dev/null || true
rm .server-pid
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: |
SortVision/test-results-*.json
SortVision/*.log
retention-days: 30
- name: Generate test summary
if: always()
run: |
echo "## Quality Assurance Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Code Linting | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| Build | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| Quality Assurance Suite | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| SEO Validation | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| Security Audit | Completed |" >> $GITHUB_STEP_SUMMARY
echo "| Bundle Analysis | Completed |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Total Tests Run:** 600+" >> $GITHUB_STEP_SUMMARY
lighthouse-audit:
name: Lighthouse Performance Audit
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: ./SortVision
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
cache-dependency-path: './SortVision/pnpm-lock.yaml'
- name: Cache Next.js build
uses: actions/cache@v5
with:
path: SortVision/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('SortVision/pnpm-lock.yaml', 'SortVision/package.json') }}
restore-keys: nextjs-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build application
run: pnpm run build
- name: Start production server
run: |
pnpm run start &
npx wait-on http://localhost:3000 --timeout 60000
- name: Run Lighthouse audit
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
http://localhost:3000
http://localhost:3000/algorithms/config/bubble
http://localhost:3000/es
http://localhost:3000/contributions/overview
uploadArtifacts: true
temporaryPublicStorage: true
production-validation:
name: Production Environment Validation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
needs: quality-assurance
timeout-minutes: 10
defaults:
run:
working-directory: ./SortVision
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Test production site
run: node tests/quality-assurance.mjs --production
- name: Validate production performance
run: |
echo "=== Production Site Health Check ==="
RESPONSE_TIME=$(curl -o /dev/null -s -w '%{time_total}' https://www.sortvision.com)
HTTP_CODE=$(curl -o /dev/null -s -w '%{http_code}' https://www.sortvision.com)
echo "HTTP Status: $HTTP_CODE"
echo "Response Time: ${RESPONSE_TIME}s"
if [ "$HTTP_CODE" != "200" ]; then
echo "ERROR: Production site returned $HTTP_CODE"
exit 1
fi
RESPONSE_MS=$(echo "$RESPONSE_TIME * 1000" | bc)
if [ "$(echo "$RESPONSE_MS > 3000" | bc)" -eq 1 ]; then
echo "WARNING: Response time exceeds 3 seconds"
fi
- name: Generate production report
if: always()
run: |
echo "## Production Validation Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Production site: https://www.sortvision.com" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Check | Result |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Site Accessibility | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| Production Tests | Passed |" >> $GITHUB_STEP_SUMMARY
echo "| Response Time | Under 3s |" >> $GITHUB_STEP_SUMMARY