diff --git a/.github/workflows/code_health.yaml b/.github/workflows/code_health.yaml index 8ee0c769..9500d5be 100644 --- a/.github/workflows/code_health.yaml +++ b/.github/workflows/code_health.yaml @@ -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: @@ -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 @@ -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() + 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/github-action@v2.3.6 - if: matrix.os == 'ubuntu-latest' with: file: coverage/lcov.info git-branch: ${{ github.head_ref || github.ref_name }}