Merge pull request #197 from Caritajoe18/main #161
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, develop, test/repository-integration-tests] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_DB: credence_test | |
| POSTGRES_USER: credence | |
| POSTGRES_PASSWORD: credence | |
| options: >- | |
| --health-cmd "pg_isready -U credence -d credence_test" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Wait for PostgreSQL | |
| run: | | |
| until pg_isready -h localhost -p 5432 -U credence; do | |
| echo "Waiting for PostgreSQL..." | |
| sleep 2 | |
| done | |
| - name: Run integration tests | |
| env: | |
| TEST_DATABASE_URL: postgresql://credence:credence@localhost:5432/credence_test | |
| run: npm test | |
| - name: Run tests with coverage | |
| env: | |
| TEST_DATABASE_URL: postgresql://credence:credence@localhost:5432/credence_test | |
| run: npm run coverage | |
| - name: Enforce 95% coverage on audit-sensitive flows | |
| env: | |
| TEST_DATABASE_URL: postgresql://credence:credence@localhost:5432/credence_test | |
| run: npm run coverage:audit | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage/lcov.info | |
| flags: integration | |
| name: integration-tests | |
| fail_ci_if_error: false |