mirror of
https://github.com/btouchard/ackify-ce.git
synced 2026-02-11 08:20:49 -06:00
Reorganize GitHub Actions workflows into reusable components and implement complete code coverage tracking across backend, frontend, and E2E tests. **CI/CD Improvements:** - Split monolithic ci.yml into 6 specialized reusable workflows - New workflows: test-backend, test-frontend, test-e2e, build-docker, security, coverage-report - Orchestrated execution with proper dependencies and parallel jobs - Codecov integration with multi-flag coverage (backend/frontend/e2e) **Frontend Testing:** - Add Vitest for unit testing with coverage-v8 provider - Create test setup with window mocks for Ackify globals - Add 34 unit tests for titleExtractor, referenceDetector, and http utils - Configure Istanbul instrumentation for E2E coverage collection - Integrate @cypress/code-coverage for E2E test coverage **Test Infrastructure:** - Create run-tests-suite.sh for local comprehensive test execution - Proper Docker Compose orchestration for integration and E2E tests - Automatic cleanup handlers with trap for test environments - Coverage summary aggregation across all test types **Bug Fixes:** - Fix backend config tests after OAuth/MagicLink validation changes - Update tests from panic expectations to error checking - Ensure OAUTH_COOKIE_SECRET is properly configured in tests **Configuration:** - Add .codecov.yml for coverage reporting with flags - Add .nycrc.json for E2E LCOV generation - Update .gitignore for test artifacts and coverage reports - Configure Vite for test environment and code instrumentation
82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: CI/CD Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
release:
|
|
types: [ published ]
|
|
|
|
env:
|
|
REGISTRY: docker.io
|
|
IMAGE_NAME: btouchard/ackify-ce
|
|
|
|
jobs:
|
|
# Phase 1: Tests parallèles
|
|
backend-tests:
|
|
name: Backend Tests
|
|
uses: ./.github/workflows/test-backend.yml
|
|
secrets: inherit
|
|
|
|
frontend-tests:
|
|
name: Frontend Tests
|
|
uses: ./.github/workflows/test-frontend.yml
|
|
secrets: inherit
|
|
|
|
e2e-tests:
|
|
name: E2E Tests
|
|
uses: ./.github/workflows/test-e2e.yml
|
|
secrets: inherit
|
|
needs: [backend-tests, frontend-tests]
|
|
|
|
# Phase 2: Coverage global
|
|
coverage-report:
|
|
name: Coverage Report
|
|
uses: ./.github/workflows/coverage-report.yml
|
|
needs: [backend-tests, frontend-tests, e2e-tests]
|
|
secrets: inherit
|
|
if: always()
|
|
|
|
# Phase 3: Build & Deploy (seulement si tests OK + pas PR)
|
|
build-and-push:
|
|
name: Build and Push Docker
|
|
if: github.event_name != 'pull_request'
|
|
uses: ./.github/workflows/build-docker.yml
|
|
needs: [backend-tests, frontend-tests, e2e-tests]
|
|
secrets: inherit
|
|
with:
|
|
push: true
|
|
|
|
# Phase 4: Security scan
|
|
security-scan:
|
|
name: Security Scan
|
|
if: github.event_name != 'pull_request'
|
|
uses: ./.github/workflows/security.yml
|
|
needs: build-and-push
|
|
secrets: inherit
|
|
|
|
# Notification finale
|
|
notify:
|
|
name: Notify
|
|
runs-on: ubuntu-latest
|
|
needs: [backend-tests, frontend-tests, e2e-tests, build-and-push, security-scan]
|
|
if: always() && github.event_name != 'pull_request'
|
|
|
|
steps:
|
|
- name: Compute IMAGE_TAG
|
|
run: echo "IMAGE_TAG=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
|
|
|
- name: Notify success
|
|
if: needs.backend-tests.result == 'success' && needs.frontend-tests.result == 'success' && needs.e2e-tests.result == 'success' && needs.build-and-push.result == 'success'
|
|
run: |
|
|
echo "✅ CI/CD Pipeline completed successfully!"
|
|
echo "🚀 Image pushed: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"
|
|
|
|
- name: Notify failure
|
|
if: needs.backend-tests.result == 'failure' || needs.frontend-tests.result == 'failure' || needs.e2e-tests.result == 'failure' || needs.build-and-push.result == 'failure'
|
|
run: |
|
|
echo "❌ CI/CD Pipeline failed!"
|
|
echo "Please check the logs above for details."
|
|
exit 1
|