ci: run the shell's browser tests on the packed tarball, publish on shared code changes

The e2e job's first shard builds the MCP package, packs it, installs the
tarball in an empty directory and runs packages/mcp-server/tests/e2e
against the installed dist/index.js (MCP_SERVER_ENTRY), so a shell that
builds but fails in the browser, or a tarball missing a runtime
dependency, fails the PR. Its traces go with the Playwright report. The
publish workflow also triggers on the web app code the shell is bundled
from (components, contexts, hooks, lib, stores, globals.css) and the
root lockfile.
This commit is contained in:
dayuan.jiang
2026-10-11 20:56:07 +09:00
parent 349ea26d8b
commit 3b3219c73d
3 changed files with 35 additions and 5 deletions
+10 -1
View File
@@ -1,7 +1,8 @@
name: Publish MCP Server
# Publishes @next-ai-drawio/mcp-server to npm via OIDC trusted publishing
# (no token, no OTP). Triggers when packages/mcp-server changes on main;
# (no token, no OTP). Triggers when packages/mcp-server or the web app code
# bundled into the canvas shell (scripts/build-shell.mjs) changes on main;
# skips silently if the package.json version is already on npm — so a
# release is just "bump the version in a PR and merge".
on:
@@ -10,6 +11,14 @@ on:
- main
paths:
- "packages/mcp-server/**"
# The canvas shell is bundled from these with the root's lockfile
- "components/**"
- "contexts/**"
- "hooks/**"
- "lib/**"
- "stores/**"
- "app/globals.css"
- "package-lock.json"
workflow_dispatch:
permissions:
+21 -1
View File
@@ -93,10 +93,30 @@ jobs:
env:
CI: true
# The canvas shell in a browser, from the package as npm installs it:
# the packed tarball goes into an empty directory, its dist/index.js is
# started over stdio and headless Chromium opens the URL start_session
# returns (packages/mcp-server/tests/e2e). Chromium is installed above;
# the build shares the root build's draw.war download.
- name: Run the MCP shell E2E tests on the packed tarball
if: matrix.shard == 1
run: |
npm --prefix packages/mcp-server ci
npm --prefix packages/mcp-server run build
npm pack ./packages/mcp-server --pack-destination "$RUNNER_TEMP/mcp-pack"
mkdir -p "$RUNNER_TEMP/mcp-install"
npm --prefix "$RUNNER_TEMP/mcp-install" install "$RUNNER_TEMP"/mcp-pack/*.tgz
MCP_SERVER_ENTRY="$RUNNER_TEMP/mcp-install/node_modules/@next-ai-drawio/mcp-server/dist/index.js" \
npm --prefix packages/mcp-server run test:e2e
env:
CI: true
- name: Upload test results
uses: actions/upload-artifact@v6
if: always()
with:
name: playwright-report-${{ matrix.shard }}
path: playwright-report/
path: |
playwright-report/
packages/mcp-server/test-results/
retention-days: 7