diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6219140 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI + +# Bespoke (not the reusable ci-node.yml) because better-sqlite3 is a NATIVE +# addon: `npm ci` compiles it from source, so we verify the binding actually +# loads, not just that install succeeded. The server is a stdio MCP process +# (it exits on stdin EOF — there is no long-running daemon to smoke-boot in CI), +# so the gates are install + native-binding load + typecheck + build. A real +# MCP-handshake smoke test is a follow-up. + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # Node 22 matches @types/node ^22 and the native ABI better-sqlite3 builds against. + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + + # npm ci compiles better-sqlite3 from source against this Node's ABI. + - name: Install dependencies (rebuilds native better-sqlite3) + run: npm ci + + # Fail fast if the native binding can't be loaded after the rebuild. + - name: Verify native better-sqlite3 binding loads + run: node -e "const D=require('better-sqlite3'); const db=new D(':memory:'); db.exec('create table t(x)'); db.close(); console.log('better-sqlite3 OK');" + + - name: Typecheck + run: npx tsc --noEmit + + - name: Build + run: npm run build