Merge pull request #360 from BigBen-7/feat/swagger-idempotency-featur… #1
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: E2E Integration Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| e2e: | |
| name: Run E2E Test Suite | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15-alpine | |
| env: | |
| POSTGRES_USER: nexafx | |
| POSTGRES_PASSWORD: nexafx_test | |
| POSTGRES_DB: nexafx_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| NODE_ENV: test | |
| DB_HOST: localhost | |
| DB_PORT: 5432 | |
| DB_USER: nexafx | |
| DB_PASSWORD: nexafx_test | |
| DB_NAME: nexafx_test | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| JWT_SECRET: e2e-test-jwt-secret-do-not-use-in-prod | |
| REFRESH_TOKEN_SECRET: e2e-test-refresh-secret | |
| OTP_SECRET: e2e-test-otp-secret | |
| DISABLE_BULL: "true" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| - name: Wait for PostgreSQL | |
| run: | | |
| until pg_isready -h localhost -p 5432 -U nexafx; do | |
| echo "Waiting for postgres..." | |
| sleep 2 | |
| done | |
| - name: Run E2E tests | |
| run: npm run test:e2e -- --testPathPattern="test/e2e" | |
| timeout-minutes: 10 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-test-results | |
| path: | | |
| coverage/ | |
| test-results/ | |
| retention-days: 7 | |
| - name: Comment PR with test results | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const outcome = '${{ job.status }}'; | |
| const emoji = outcome === 'success' ? '✅' : '❌'; | |
| const body = `${emoji} **E2E Tests**: ${outcome}\n\nSee [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body, | |
| }); |