Skip to content

Add mocha snapshot tests for hydrate adapter #291

Add mocha snapshot tests for hydrate adapter

Add mocha snapshot tests for hydrate adapter #291

Workflow file for this run

name: Vercel MCP-Deploy
on:
push:
branches:
- release/3
paths:
- '.github/workflows/mcp-vercel.yml'
- 'packages/samples/react/**'
- 'packages/tools/mcp/**'
- 'packages/components/**'
pull_request:
branches:
- develop
- release/*
paths:
- '.github/workflows/mcp-vercel.yml'
- 'packages/samples/react/**'
- 'packages/tools/mcp/**'
- 'packages/components/**'
workflow_dispatch:
concurrency:
group: 'mcp-vercel-${{ github.ref }}'
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
PNPM_CACHE_FOLDER: .pnpm
VERCEL_ORG_ID: ${{ secrets.VERCEL_MCP_TEAM_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_MCP_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_MCP_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Setup pnpm workspace
uses: ./.github/actions/pnpm-setup
- name: Build MCP package with all samples
working-directory: packages/tools/mcp
run: |
echo "🔨 Building MCP package with embedded samples..."
pnpm build
echo "📊 Checking built artifacts..."
echo "Sample files generated:"
ls -la dist/samples.* || echo "No sample files found!"
echo "API directory:"
ls -la api/ || echo "No API directory found!"
echo "Total samples in dist/samples.json:"
jq '.entries | length' dist/samples.json || echo "Could not count samples"
- name: Deploy to Vercel (production)
id: deploy_prod
if: github.ref == 'refs/heads/release/3' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
working-directory: packages/tools/mcp
run: |
set -eo pipefail
echo "🚀 Deploying pre-built package to Vercel..."
DEPLOY_URL=$(pnpm dlx vercel@latest deploy --prod --yes --token "$VERCEL_TOKEN" | tail -n1)
echo "url=${DEPLOY_URL}" >> "$GITHUB_OUTPUT"
echo "Production deployment available at ${DEPLOY_URL}"
- name: Deploy to Vercel (preview)
id: deploy_preview
if: github.event_name == 'pull_request'
working-directory: packages/tools/mcp
run: |
set -eo pipefail
echo "🚀 Deploying pre-built package to Vercel..."
DEPLOY_URL=$(pnpm dlx vercel@latest deploy --yes --token "$VERCEL_TOKEN" | tail -n1)
echo "url=${DEPLOY_URL}" >> "$GITHUB_OUTPUT"
echo "Preview deployment available at ${DEPLOY_URL}"
- name: Share preview URL in PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
env:
PREVIEW_URL: ${{ steps.deploy_preview.outputs.url }}
with:
script: |
const marker = '<!-- mcp-vercel-preview -->';
const url = process.env.PREVIEW_URL;
if (!url) {
core.setFailed('Missing Vercel preview URL');
return;
}
const body = `${marker}\n🚀 MCP preview deployed to Vercel: ${url}`;
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
});
const existing = comments.find((comment) => comment.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
});
}