|
| 1 | +--- |
| 2 | +name: Code Health Long Running Tests |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: # Allow manual triggering of the workflow in feature branches |
| 8 | + |
| 9 | +permissions: {} |
| 10 | + |
| 11 | +jobs: |
| 12 | + run-tests: |
| 13 | + name: Run MongoDB long running tests |
| 14 | + if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 18 | + fail-fast: false |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + steps: |
| 21 | + - uses: GitHubSecurityLab/actions-permissions/monitor@v1 |
| 22 | + if: matrix.os == 'ubuntu-latest' |
| 23 | + - uses: actions/checkout@v5 |
| 24 | + - uses: docker/setup-docker-action@v4 |
| 25 | + if: matrix.os == 'ubuntu-latest' |
| 26 | + name: Setup Docker Environment |
| 27 | + with: |
| 28 | + set-host: true |
| 29 | + - uses: actions/setup-node@v6 |
| 30 | + with: |
| 31 | + node-version-file: package.json |
| 32 | + cache: "npm" |
| 33 | + - name: Install dependencies |
| 34 | + run: npm ci |
| 35 | + - name: Run tests |
| 36 | + run: npm test |
| 37 | + - name: Upload test results |
| 38 | + if: always() && matrix.os == 'ubuntu-latest' |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: test-results |
| 42 | + path: coverage/lcov.info |
| 43 | + |
| 44 | + run-long-running-tests: |
| 45 | + name: Run long running tests |
| 46 | + if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: GitHubSecurityLab/actions-permissions/monitor@v1 |
| 50 | + - uses: actions/checkout@v5 |
| 51 | + - uses: actions/setup-node@v6 |
| 52 | + with: |
| 53 | + node-version-file: package.json |
| 54 | + cache: "npm" |
| 55 | + - name: Install dependencies |
| 56 | + run: npm ci |
| 57 | + - name: Run tests |
| 58 | + env: |
| 59 | + MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }} |
| 60 | + MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }} |
| 61 | + MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }} |
| 62 | + run: npm test -- tests/integration/tools/atlas --project=long-running-tests |
| 63 | + - name: Upload test results |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + if: always() |
| 66 | + with: |
| 67 | + name: atlas-test-results |
| 68 | + path: coverage/lcov.info |
| 69 | + |
| 70 | + coverage: |
| 71 | + name: Report Coverage |
| 72 | + if: always() && (github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: [run-tests, run-long-running-tests] |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v5 |
| 77 | + - uses: actions/setup-node@v6 |
| 78 | + with: |
| 79 | + node-version-file: package.json |
| 80 | + cache: "npm" |
| 81 | + - name: Install dependencies |
| 82 | + run: npm ci |
| 83 | + - name: Download test results |
| 84 | + uses: actions/download-artifact@v5 |
| 85 | + with: |
| 86 | + name: test-results |
| 87 | + path: coverage/mongodb |
| 88 | + - name: Download atlas test results |
| 89 | + uses: actions/download-artifact@v5 |
| 90 | + with: |
| 91 | + name: atlas-test-results |
| 92 | + path: coverage/atlas |
| 93 | + - name: Merge coverage reports |
| 94 | + run: | |
| 95 | + npx -y [email protected] "coverage/*/lcov.info" "coverage/lcov.info" |
| 96 | + - name: Coveralls GitHub Action |
| 97 | + uses: coverallsapp/[email protected] |
| 98 | + with: |
| 99 | + file: coverage/lcov.info |
0 commit comments