SDK examples smoke test #33
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: SDK examples smoke test | |
| # PILOT-194: keeps the README quickstart honest. If the example breaks, | |
| # CI fails immediately rather than at the next user's cold-install. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| # Nightly catches drift from upstream daemon releases / registry state. | |
| - cron: '0 6 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| smoke: | |
| name: README quickstart smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Type-check quickstart from README against built package | |
| run: | | |
| # PILOT-197: extract the first ```ts / ```javascript fenced | |
| # block from README.md and confirm it type-checks against the | |
| # built package — this catches the most common breakage | |
| # (README drifts from public API after a rename / signature | |
| # change). We TYPE-check, not execute: the quickstart calls | |
| # `new Driver()` which dials a daemon socket, and CI has no | |
| # daemon. Type-checking against the built dist/index.d.ts is | |
| # a strong enough "did we break user copy-paste" signal. | |
| mkdir -p smoke-tmp | |
| awk '/^```(ts|typescript|javascript|js)$/{flag=1;next}/^```$/{flag=0}flag' README.md > smoke-tmp/quickstart.ts | |
| if [ ! -s smoke-tmp/quickstart.ts ]; then | |
| echo "::error::no quickstart code block found in README.md" | |
| exit 1 | |
| fi | |
| # Run tsc inside the repo so `import 'pilotprotocol'` | |
| # resolves via paths→dist (set up below). The repo already | |
| # has typescript installed from `npm ci`. | |
| cat > smoke-tmp/tsconfig.json <<'EOF' | |
| { | |
| "compilerOptions": { | |
| "noEmit": true, | |
| "esModuleInterop": true, | |
| "module": "nodenext", | |
| "moduleResolution": "nodenext", | |
| "target": "es2022", | |
| "skipLibCheck": true, | |
| "strict": true, | |
| "paths": { | |
| "pilotprotocol": ["../dist/index.d.ts"] | |
| }, | |
| "baseUrl": "." | |
| }, | |
| "include": ["quickstart.ts"] | |
| } | |
| EOF | |
| npx tsc -p smoke-tmp/tsconfig.json |