MCP Package Tests #25224
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: MCP Package Tests | |
| on: | |
| workflow_run: | |
| workflows: ['Quality assurance'] | |
| types: | |
| - completed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-changes: | |
| if: ${{ github.repository == 'mastra-ai/mastra' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| statuses: write | |
| outputs: | |
| changed: ${{ steps.changes.outputs.changed }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Set pending status | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'pending' | |
| context: 'MCP Package Tests' | |
| description: 'Checking for changes' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| - name: Setup pnpm and Node.js | |
| uses: ./.github/actions/setup-pnpm-node | |
| with: | |
| install-dependencies: 'false' | |
| - name: Check for MCP package changes using Turborepo | |
| id: changes | |
| uses: ./.github/actions/turbo-changed | |
| with: | |
| packages: '@mastra/mcp' | |
| tasks: 'build,test' | |
| base-ref: 'origin/main' | |
| skip-tests: | |
| needs: check-changes | |
| if: needs.check-changes.outputs.changed == 'false' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set success status for unchanged mcp | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'success' | |
| context: 'MCP Package Tests' | |
| description: 'MCP package unchanged - skipping tests' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| test: | |
| needs: check-changes | |
| if: ${{ github.repository == 'mastra-ai/mastra' && needs.check-changes.outputs.changed == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| TURBO_CACHE: remote:r | |
| GITHUB_REF_NAME: ${{ github.event.workflow_run.head_branch }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Setup pnpm and Node.js | |
| uses: ./.github/actions/setup-pnpm-node | |
| - name: Build @mastra/mcp | |
| run: pnpm turbo --filter="./packages/mcp" --filter "mastra" build | |
| env: | |
| NODE_OPTIONS: '--max_old_space_size=6144' | |
| - name: Run MCP server tests | |
| run: pnpm test:server | |
| working-directory: packages/mcp | |
| - name: Run MCP client tests | |
| run: pnpm test:client | |
| working-directory: packages/mcp | |
| - name: Install integration test dependencies | |
| run: pnpm install --ignore-workspace | |
| working-directory: packages/mcp/integration-tests | |
| - name: Run MCP integration tests | |
| run: pnpm run test:mcp | |
| working-directory: packages/mcp/integration-tests | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| test-success: | |
| needs: [check-changes, test] | |
| if: ${{ always() && needs.check-changes.outputs.changed == 'true' && needs.test.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set success status for completed tests | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'success' | |
| context: 'MCP Package Tests' | |
| description: 'All MCP tests passed' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| test-failure: | |
| needs: [check-changes, test] | |
| if: ${{ always() && needs.check-changes.outputs.changed == 'true' && needs.test.result == 'failure' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set failure status for failed tests | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'failure' | |
| context: 'MCP Package Tests' | |
| description: 'MCP tests failed' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |