feat(compliance): merchant data export endpoint (#313) #86
Workflow file for this run
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: Integration Tests | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| # Cancel previous runs on the same PR/branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| backend-integration: | |
| name: Backend Integration Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: fluxapay_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: fluxapay_backend/package-lock.json | |
| - name: Install backend dependencies | |
| working-directory: ./fluxapay_backend | |
| run: npm ci | |
| - name: Generate Prisma Client | |
| working-directory: ./fluxapay_backend | |
| run: npx prisma generate | |
| - name: Sync database schema | |
| working-directory: ./fluxapay_backend | |
| run: npx prisma db push | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| - name: Run backend unit tests | |
| working-directory: ./fluxapay_backend | |
| run: npm test | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| KMS_PROVIDER: local | |
| KMS_ENCRYPTION_PASSPHRASE: ci-test-passphrase-for-hd-wallet-secure | |
| HD_WALLET_MASTER_SEED: ci-test-master-seed-32chars-long-padded!! | |
| DISABLE_CRON: "true" | |
| JWT_SECRET: ci-test-jwt-secret-key | |
| WEBHOOK_SECRET: ci-test-webhook-secret | |
| CLOUDINARY_CLOUD_NAME: test | |
| CLOUDINARY_API_KEY: test | |
| CLOUDINARY_API_SECRET: test | |
| RESEND_API_KEY: re_test | |
| SMS_PROVIDER: mock | |
| STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org | |
| STELLAR_NETWORK_PASSPHRASE: Test SDF Network ; September 2015 | |
| FUNDER_SECRET_KEY: SBFTEST23456789012345678901234567890123456789012345678901234 | |
| MASTER_VAULT_SECRET_KEY: SBFTEST23456789012345678901234567890123456789012345678901234 | |
| USDC_ISSUER_PUBLIC_KEY: GBBTEST23456789012345678901234567890123456789012345678901234 | |
| - name: Build backend | |
| working-directory: ./fluxapay_backend | |
| run: npm run build | |
| - name: Start backend server | |
| working-directory: ./fluxapay_backend | |
| run: | | |
| npm start & | |
| echo "Waiting for backend to be ready..." | |
| npx --yes wait-on@9.0.4 http://localhost:3000/health --timeout 120000 --interval 2000 | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| KMS_PROVIDER: local | |
| KMS_ENCRYPTION_PASSPHRASE: ci-test-passphrase-for-hd-wallet-secure | |
| HD_WALLET_MASTER_SEED: ci-test-master-seed-32chars-long-padded!! | |
| DISABLE_CRON: "true" | |
| JWT_SECRET: ci-test-jwt-secret-key | |
| WEBHOOK_SECRET: ci-test-webhook-secret | |
| CLOUDINARY_CLOUD_NAME: test | |
| CLOUDINARY_API_KEY: test | |
| CLOUDINARY_API_SECRET: test | |
| RESEND_API_KEY: re_test | |
| SMS_PROVIDER: mock | |
| STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org | |
| STELLAR_NETWORK_PASSPHRASE: Test SDF Network ; September 2015 | |
| FUNDER_SECRET_KEY: SBFTEST23456789012345678901234567890123456789012345678901234 | |
| MASTER_VAULT_SECRET_KEY: SBFTEST23456789012345678901234567890123456789012345678901234 | |
| USDC_ISSUER_PUBLIC_KEY: GBBTEST23456789012345678901234567890123456789012345678901234 | |
| NODE_ENV: test | |
| - name: Run API smoke tests | |
| working-directory: ./fluxapay_backend | |
| run: npm run test:smoke | |
| env: | |
| API_BASE_URL: http://localhost:3000 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-test-results | |
| path: | | |
| fluxapay_backend/test-results/ | |
| fluxapay_backend/coverage/ | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| frontend-integration: | |
| name: Frontend Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: fluxapay_frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./fluxapay_frontend | |
| run: npm ci --legacy-peer-deps | |
| - name: Install Playwright browsers | |
| working-directory: ./fluxapay_frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: Run linting | |
| working-directory: ./fluxapay_frontend | |
| run: npx eslint . --max-warnings=0 | |
| - name: Build frontend | |
| working-directory: ./fluxapay_frontend | |
| run: npm run build | |
| - name: Run unit tests | |
| working-directory: ./fluxapay_frontend | |
| run: npm test | |
| - name: Start frontend and run E2E smoke tests | |
| working-directory: ./fluxapay_frontend | |
| run: | | |
| npm start & | |
| echo "Waiting for frontend to be ready..." | |
| npx --yes wait-on@9.0.4 http://localhost:3075 --timeout 120000 --interval 2000 | |
| echo "Running E2E smoke tests..." | |
| npm run test:e2e:smoke | |
| env: | |
| PLAYWRIGHT_BASE_URL: http://localhost:3075 | |
| NEXT_PUBLIC_API_URL: http://localhost:3000 | |
| CI: true | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-test-results | |
| path: | | |
| fluxapay_frontend/test-results/ | |
| fluxapay_frontend/coverage/ | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Upload Playwright report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: fluxapay_frontend/playwright-report/ | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| route-drift-check: | |
| name: Route Drift Detection | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| working-directory: ./fluxapay_backend | |
| run: npm ci || npm install | |
| - name: Install frontend dependencies | |
| working-directory: ./fluxapay_frontend | |
| run: npm ci --legacy-peer-deps || npm install --legacy-peer-deps | |
| - name: Run route drift detection | |
| run: | | |
| echo "🔍 Checking for route drift between frontend and backend..." | |
| echo "" | |
| # Extract API routes from backend | |
| echo "Extracting backend routes..." | |
| if [ -d "fluxapay_backend/src/routes" ]; then | |
| grep -rh "router\.\(get\|post\|put\|patch\|delete\)" fluxapay_backend/src/routes/ --include="*.ts" 2>/dev/null | \ | |
| grep -oE "(get|post|put|patch|delete)\(['\"][^'\"]+['\"]" | \ | |
| sed "s/.*(//;s/['\")].*//" | \ | |
| sort -u > /tmp/backend_routes.txt || echo "" > /tmp/backend_routes.txt | |
| else | |
| echo "Backend routes directory not found" > /tmp/backend_routes.txt | |
| fi | |
| # Extract API calls from frontend | |
| echo "Extracting frontend API calls..." | |
| if [ -d "fluxapay_frontend/src" ]; then | |
| grep -rhE "(fetch|axios|api\.)" fluxapay_frontend/src/ --include="*.ts" --include="*.tsx" 2>/dev/null | \ | |
| grep -oE "(GET|POST|PUT|PATCH|DELETE)['\"]?[^\"]*['\"][^'\"]*['\"]" | \ | |
| sed "s/.*['\"(]//;s/['\")].*//" | \ | |
| sort -u > /tmp/frontend_routes.txt || echo "" > /tmp/frontend_routes.txt | |
| else | |
| echo "Frontend src directory not found" > /tmp/frontend_routes.txt | |
| fi | |
| # Compare routes | |
| echo "" | |
| echo "Backend routes:" | |
| cat /tmp/backend_routes.txt 2>/dev/null || echo "(none)" | |
| echo "" | |
| echo "Frontend API calls:" | |
| cat /tmp/frontend_routes.txt 2>/dev/null || echo "(none)" | |
| echo "" | |
| # Save drift report | |
| { | |
| echo "# Route Drift Detection Report" | |
| echo "Generated: $(date -u)" | |
| echo "" | |
| echo "## Backend Routes" | |
| echo '```' | |
| cat /tmp/backend_routes.txt 2>/dev/null || echo "(none)" | |
| echo '```' | |
| echo "" | |
| echo "## Frontend API Calls" | |
| echo '```' | |
| cat /tmp/frontend_routes.txt 2>/dev/null || echo "(none)" | |
| echo '```' | |
| echo "" | |
| echo "## Status" | |
| echo "✅ Route drift check completed" | |
| } > route-drift-report.md | |
| echo "✅ Route drift report saved to route-drift-report.md" | |
| - name: Upload drift report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: route-drift-report | |
| path: route-drift-report.md | |
| retention-days: 7 | |
| integration-summary: | |
| name: Integration Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [backend-integration, frontend-integration, route-drift-check] | |
| if: always() | |
| steps: | |
| - name: Generate summary | |
| run: | | |
| echo "## Integration Test Summary" > $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY | |
| backend_status="${{ needs.backend-integration.result }}" | |
| frontend_status="${{ needs.frontend-integration.result }}" | |
| drift_status="${{ needs.route-drift-check.result }}" | |
| echo "| Backend Integration | $backend_status |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Frontend Integration | $frontend_status |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Route Drift Check | $drift_status |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ "$backend_status" == "success" && "$frontend_status" == "success" ]]; then | |
| echo "✅ Core integration tests passed!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Note: Route drift check is informational and may not block deployment." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ Some integration tests failed. Check the logs above for details." >> $GITHUB_STEP_SUMMARY | |
| fi |