Add custom MCP server URL support in Node.js SDK #643
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: CI - Build, Test, and Publish SDKs | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| changed-sdks: | |
| name: Determine Changed SDKs | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| outputs: | |
| nodejs-sdk: ${{ steps.check_nodejs_sdk.outputs.changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: git_refs | |
| name: Set Git refs for diff | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "base=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT" | |
| echo "head=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "base=${{ github.event.before }}" >> "$GITHUB_OUTPUT" | |
| echo "head=${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - id: check_nodejs_sdk | |
| name: Check Node.js SDK changes | |
| run: | | |
| if git diff --name-only "${{ steps.git_refs.outputs.base }}" "${{ steps.git_refs.outputs.head }}" -- '/**' | grep -q .; then | |
| echo "Node.js SDK changes detected" | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No Node.js SDK changes detected" | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| nodejs-sdk: | |
| name: Node.js SDK | |
| needs: [changed-sdks] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: ./ | |
| strategy: | |
| matrix: | |
| node-version: ['18', '20'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| run_install: false | |
| - name: Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'pnpm' | |
| cache-dependency-path: '**/pnpm-lock.yaml' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10.20.0 | |
| - name: Install dependencies | |
| run: pnpm i | |
| - name: Lint code | |
| run: npm run lint | |
| - name: Set version with Nerdbank.GitVersioning | |
| run: node setVersion.js | |
| - name: Build package | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| - name: Run integration tests | |
| env: | |
| AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
| AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }} | |
| AZURE_OPENAI_DEPLOYMENT: ${{ vars.AZURE_OPENAI_DEPLOYMENT }} | |
| AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }} | |
| ENABLE_OBSERVABILITY: ${{ vars.ENABLE_OBSERVABILITY }} | |
| run: | | |
| npm run test:integration | |
| - name: Pack packages | |
| run: npm run pack | |
| # Copy packages to drop folder | |
| - name: Copy packages to drop folder | |
| run: | | |
| mkdir -p ~/drop/nodejs-${{ matrix.node-version }} && cp -v packages/*.tgz $_ | |
| - name: Upload NPM packages as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nodejs-${{ matrix.node-version }} | |
| path: ~/drop/nodejs-${{ matrix.node-version }}/*.tgz | |
| # - name: Publish to NPM (commented for now) | |
| # if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| # run: npm publish | |
| # env: | |
| # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |