chore(deps): bump the backend-dependencies group across 1 directory with 42 updates #731
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 Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - 'backend/**' | |
| - '.github/workflows/backend-tests.yml' | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - 'backend/**' | |
| - '.github/workflows/backend-tests.yml' | |
| # Total number of shards the backend test suite is split across. Keep this in | |
| # sync with the `matrix.shard` list in the `backend-tests` job below. | |
| env: | |
| SHARD_TOTAL: 4 | |
| jobs: | |
| # OpenAPI contract verification is independent of the test suite, so it runs | |
| # once in its own job instead of being repeated in every test shard. | |
| openapi-contract: | |
| name: OpenAPI contract check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: npm ci | |
| - name: Verify OpenAPI spec and docs | |
| working-directory: ./backend | |
| run: | | |
| npm run spec:check | |
| npm run api:validate | |
| # Test files are split into SHARD_TOTAL parallel shards. Vitest distributes | |
| # test files across shards, so total wall-clock time scales down roughly | |
| # linearly with the shard count. Each shard collects coverage into a blob | |
| # report; thresholds are enforced later in the `backend-coverage` job once all | |
| # blobs are merged. | |
| backend-tests: | |
| name: Tests (shard ${{ matrix.shard }} of 4) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # Run every shard even if one fails so a single shard failure never masks | |
| # failures in the others. | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: npm ci | |
| - name: Run tests (shard ${{ matrix.shard }}) | |
| working-directory: ./backend | |
| run: npm run test:shard -- --shard=${{ matrix.shard }}/${{ env.SHARD_TOTAL }} | |
| - name: Upload shard blob report | |
| # Upload even when the shard fails so the merge job can still combine the | |
| # passing shards' coverage; fail loudly if a shard produced nothing. | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-blob-report-${{ matrix.shard }} | |
| path: backend/.vitest-reports/* | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| # Merge the per-shard blob reports into a single coverage report and enforce | |
| # the coverage thresholds defined in backend/vitest.config.ts against the full | |
| # suite. This job only runs when every shard passed. | |
| backend-coverage: | |
| name: Merge coverage and enforce thresholds | |
| needs: backend-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./backend | |
| run: npm ci | |
| - name: Download shard blob reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: backend/.vitest-reports | |
| pattern: backend-blob-report-* | |
| merge-multiple: true | |
| - name: Merge reports and check coverage thresholds | |
| working-directory: ./backend | |
| run: npm run test:merge-coverage | |
| - name: Upload merged backend coverage artifact | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-coverage | |
| path: backend/coverage/ | |
| if-no-files-found: warn | |
| migration-dry-run: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| db: [sqlite, postgres] | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: testuser | |
| POSTGRES_PASSWORD: testpassword | |
| POSTGRES_DB: migration_ci | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Detect migration changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| migrations: | |
| - 'backend/src/db/migrations/**' | |
| - name: Setup Node.js | |
| if: steps.changes.outputs.migrations == 'true' || github.event_name != 'pull_request' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| if: steps.changes.outputs.migrations == 'true' || github.event_name != 'pull_request' | |
| working-directory: ./backend | |
| run: npm ci | |
| - name: Dry-run migrations (SQLite) | |
| if: (steps.changes.outputs.migrations == 'true' || github.event_name != 'pull_request') && matrix.db == 'sqlite' | |
| working-directory: ./backend | |
| env: | |
| DB_PATH: /tmp/stellar-migration-dryrun.sqlite | |
| run: npm run db:migrate -- --dry-run | |
| - name: Dry-run migrations (PostgreSQL) | |
| if: (steps.changes.outputs.migrations == 'true' || github.event_name != 'pull_request') && matrix.db == 'postgres' | |
| working-directory: ./backend | |
| env: | |
| DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/migration_ci | |
| PGUSER: testuser | |
| PGPASSWORD: testpassword | |
| PGHOST: localhost | |
| PGPORT: '5432' | |
| PGDATABASE: migration_ci | |
| run: npm run db:migrate -- --dry-run | |
| slack-notification: | |
| name: Notify Slack on failure | |
| needs: [openapi-contract, backend-tests, backend-coverage, migration-dry-run] | |
| if: always() && contains(needs.*.result, 'failure') && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Slack Notification | |
| run: | | |
| curl -X POST -H 'Content-type: application/json' \ | |
| --data "{\"text\":\"🚨 CI Failure on main!\n*Repo*: ${{ github.repository }}\n*Branch*: ${{ github.ref_name }}\n*Failing Step*: ${{ github.workflow }}\n*Link*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \ | |
| ${{ secrets.SLACK_WEBHOOK_URL }} |