Skip to content

Commit eb4a67b

Browse files
Hiksangclaude
andcommitted
ci: integration tests + MCP JSONRPC smoke + version-match guard
Adds three checks beyond the existing build + unit tests: 1. Integration tests (`pnpm test:integration`) — hits live HL/PAC/LT/Aster public read-only APIs across 17 spec files. Marked continue-on-error so a single venue outage doesn't block CI; failure shows as a yellow check that the maintainer can investigate. 2. Version-match guard — installs the packed tarball and asserts `perp --version` equals package.json `version`. Catches sync-skill / stale-dist regressions where prepublishOnly silently shipped an old build. 3. MCP server JSONRPC initialize ping — sends a real `initialize` request and asserts both a valid `result` envelope and the matching `serverInfo.version`. Catches mcp-server.ts startup regressions (missing capabilities, broken imports, version drift). Locally simulated: version-match returned YES (0.12.13/0.12.13), MCP initialize returned proper protocol response with all 3 capabilities. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0901a6e commit eb4a67b

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,51 @@ jobs:
3535
- name: Install dependencies
3636
run: pnpm install --frozen-lockfile
3737

38-
- name: Type check
38+
- name: Type check (tsc strict)
3939
run: pnpm run build
4040

4141
- name: Unit tests
4242
run: pnpm test
4343

44+
- name: Integration tests (mainnet public read-only — non-fatal)
45+
# Hits live HL/PAC/LT/Aster public APIs (market list, prices, funding).
46+
# Marked continue-on-error: a single venue outage shouldn't block CI.
47+
# Failure surfaces as a yellow check; investigate manually if persistent.
48+
continue-on-error: true
49+
run: pnpm test:integration
50+
4451
- name: Package smoke test
4552
run: |
53+
set -euxo pipefail
4654
pnpm pack
4755
TARBALL=$(ls perp-cli-*.tgz)
48-
# Verify both bins exist in the package
56+
# Verify all bins exist in the package
4957
tar -tzf "$TARBALL" | grep 'dist/index.js'
5058
tar -tzf "$TARBALL" | grep 'dist/mcp-server.js'
59+
tar -tzf "$TARBALL" | grep 'dist/guardrail/perp-guardrail.js'
60+
# Verify SKILL bundle ships (agent surface)
61+
tar -tzf "$TARBALL" | grep 'skills/perp-cli/SKILL.md'
5162
# Install and verify bins actually run
5263
mkdir -p /tmp/smoke-test
5364
cd /tmp/smoke-test
5465
npm init -y > /dev/null 2>&1
5566
npm install "$GITHUB_WORKSPACE/$TARBALL" > /dev/null 2>&1
56-
npx perp --help
57-
npx perp-mcp --help || true
67+
# --version must match package.json (catches sync-skill-version /
68+
# build mismatch silently shipping a stale dist)
69+
INSTALLED_VERSION=$(npx perp --version)
70+
EXPECTED_VERSION=$(node -p "require('$GITHUB_WORKSPACE/package.json').version")
71+
if [ "$INSTALLED_VERSION" != "$EXPECTED_VERSION" ]; then
72+
echo "::error::Version mismatch: installed=$INSTALLED_VERSION expected=$EXPECTED_VERSION"
73+
exit 1
74+
fi
75+
npx perp --help > /dev/null
76+
# MCP server JSONRPC initialize ping (catches startup regressions
77+
# like missing tools/resources/prompts capabilities or import errors).
78+
INIT_REQ='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}'
79+
INIT_RESP=$(echo "$INIT_REQ" | timeout 10 npx perp-mcp 2>/dev/null | head -1)
80+
echo "MCP initialize response: $INIT_RESP"
81+
echo "$INIT_RESP" | grep -q '"result"' || { echo "::error::MCP initialize failed"; exit 1; }
82+
echo "$INIT_RESP" | grep -q "\"version\":\"$EXPECTED_VERSION\"" || { echo "::error::MCP version mismatch"; exit 1; }
5883
5984
release:
6085
name: GitHub Release

0 commit comments

Comments
 (0)