Comprehensive Testing Suite #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Comprehensive Testing Suite | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| schedule: | |
| - cron: '0 2 * * *' # Run nightly at 2 AM | |
| jobs: | |
| test: | |
| name: Run Test Pyramid | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:14-alpine | |
| env: | |
| POSTGRES_USER: test | |
| POSTGRES_PASSWORD: test | |
| POSTGRES_DB: nepa_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:alpine | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install Dependencies | |
| run: | | |
| npm ci | |
| cd api-testing && npm ci | |
| - name: Setup Test Environment | |
| run: | | |
| npm run db:setup | |
| # Start services in background for integration tests | |
| npm run start:services:test & | |
| sleep 30 # Wait for services to be ready | |
| - name: 🧪 Run Unit Tests | |
| run: cd api-testing && npm run test:unit | |
| - name: 🔗 Run Integration Tests | |
| run: cd api-testing && npm run test:integration | |
| env: | |
| USER_SERVICE_URL: http://localhost:3001 | |
| PAYMENT_SERVICE_URL: http://localhost:3002 | |
| - name: 🔒 Run Security Tests | |
| run: cd api-testing && npm run test:security | |
| - name: 📜 Run Contract Tests | |
| run: cd api-testing && npm run test:contract | |
| - name: 📊 Generate Test Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: api-testing/test-reports/ |