Skip to content

ci: split atlas and mongodb tests #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 53 additions & 4 deletions .github/workflows/code_health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run style check
run: npm run generate
- run: npm run generate

run-tests:
strategy:
Expand All @@ -44,6 +43,26 @@ jobs:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
if: matrix.os != 'windows-latest'
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Upload test results
if: always() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: test-results
path: coverage/lcov.info

run-atlas-tests:
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
Expand All @@ -55,10 +74,40 @@ jobs:
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
run: npm test
run: npm test -- --testPathIgnorePatterns "tests/integration/tools/mongodb" --testPathIgnorePatterns "tests/integration/[^/]+\.ts"
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: atlas-test-results
path: coverage/lcov.info
coverage:
runs-on: ubuntu-latest
needs: [run-tests, run-atlas-tests]
if: always()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs coverage even if one of the tests fails (say mongodb tests pass and altas fails, it will still compute coverage)

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: coverage/mongodb
- name: Download atlas test results
uses: actions/download-artifact@v4
with:
name: atlas-test-results
path: coverage/atlas
- name: Merge coverage reports
run: |
npx -y lcov-result-merger "coverage/*/lcov.info" "coverage/lcov.info"
- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
if: matrix.os == 'ubuntu-latest'
with:
file: coverage/lcov.info
git-branch: ${{ github.head_ref || github.ref_name }}
Expand Down
Loading