ci(openapi): add comprehensive OpenAPI contract testing and coverage checks #276
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: Backend CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - "fluxapay_backend/**" | |
| pull_request: | |
| branches: ["main"] | |
| paths: | |
| - "fluxapay_backend/**" | |
| jobs: | |
| build-and-check: | |
| name: Backend Build Check | |
| 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 | |
| defaults: | |
| run: | |
| working-directory: ./fluxapay_backend | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate Prisma Client | |
| run: npx prisma generate | |
| - name: Sync database schema | |
| run: npx prisma db push | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| - name: Format Check (Lint) | |
| run: npm run lint | |
| - name: Validate OpenAPI Specification | |
| run: npm run validate:openapi | |
| - name: Check Route Documentation Coverage | |
| run: npm run check:route-coverage -- --ci | |
| - name: Run Unit Tests | |
| run: npm test | |
| env: | |
| 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" | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| JWT_SECRET: ci-test-jwt-secret-key | |
| - name: Run Contract Tests | |
| run: npm run test:contract | |
| env: | |
| 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" | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/fluxapay_test?schema=public | |
| JWT_SECRET: ci-test-jwt-secret-key | |
| - name: Build Check | |
| run: npm run build | |
| # Verification that the backend TypeScript application builds successfully. |