feat: add comprehensive CI/CD pipeline with auto-promotion and testing

🚀 Enhanced GitHub Actions workflows:
- Add Playwright testing to all deployment pipelines
- Implement auto-promotion from develop → staging → master
- Add visual regression testing with screenshot artifacts
- Create PR validation workflow with local testing
- Add performance testing and health checks
- Implement timestamped artifact uploads
- Add comprehensive test result reporting
- Include Kubernetes manifest validation

🧪 Testing improvements:
- Multi-browser testing (Chrome, Firefox, Safari)
- Mobile device testing (Pixel 5, iPhone 12)
- Environment-specific test validation
- Security header validation
- Health endpoint testing
- Performance benchmarking

🔄 Auto-promotion flow:
- develop → staging (automatic PR creation after tests pass)
- staging → master (automatic PR creation after tests pass)
- Manual review required for production deployment
- Full test validation at each stage
This commit is contained in:
greg
2025-06-30 20:53:20 -07:00
parent aeccfa3717
commit 8322df0313
5 changed files with 403 additions and 3 deletions

View File

@@ -100,6 +100,77 @@ jobs:
# Additional health checks can be added here
- name: Get service URL
id: get-url
run: |
export KUBECONFIG=kubeconfig
kubectl get ksvc game-2048-prod -n game-2048-prod -o jsonpath='{.status.url}'
SERVICE_URL=$(kubectl get ksvc game-2048-prod -n game-2048-prod -o jsonpath='{.status.url}')
echo "service_url=$SERVICE_URL" >> $GITHUB_OUTPUT
echo "🚀 Production service deployed at: $SERVICE_URL"
- name: Set up Node.js for testing
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: tests/package.json
- name: Install Playwright dependencies
run: |
cd tests
npm install
npx playwright install --with-deps
- name: Run production smoke tests
run: |
cd tests
BASE_URL=${{ steps.get-url.outputs.service_url }} npx playwright test environment.spec.ts
env:
CI: true
- name: Run full test suite
run: |
cd tests
BASE_URL=${{ steps.get-url.outputs.service_url }} npx playwright test
env:
CI: true
- name: Upload production test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-results-production-${{ github.sha }}-${{ github.run_number }}
path: |
tests/playwright-report/
tests/test-results/
retention-days: 90
- name: Upload production screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-production-${{ github.sha }}-${{ github.run_number }}
path: tests/test-results/**/*.png
retention-days: 90
- name: Production health validation
run: |
# Extended health checks for production
echo "🔍 Running production health checks..."
# Test main URL
curl -f https://2048.wa.darknex.us/ || exit 1
# Test health endpoint
curl -f https://2048.wa.darknex.us/health || exit 1
# Check response times
RESPONSE_TIME=$(curl -o /dev/null -s -w '%{time_total}' https://2048.wa.darknex.us/)
echo "Response time: ${RESPONSE_TIME}s"
# Fail if response time > 3 seconds
if (( $(echo "$RESPONSE_TIME > 3.0" | bc -l) )); then
echo "❌ Response time too slow: ${RESPONSE_TIME}s"
exit 1
fi
echo "✅ All production health checks passed!"