ci: add GitHub Actions build pipeline#35
Closed
MO2k4 wants to merge 7 commits intocolbymchenry:mainfrom
Closed
Conversation
Adds CI workflow (build + test matrix across Node 18/20/22 and ubuntu/macos/windows) and release workflow for publishing to npm on version tags. Uses node_modules caching with native rebuild strategy to avoid re-downloading dependencies on each run.
…e test expectations
Root cause: tree-sitter grammar native bindings for Swift and Dart are
incompatible with tree-sitter 0.22.4 on macOS arm64 (Apple Silicon,
macOS 26.2, Node.js v22.22.0).
Swift (tree-sitter-swift 0.6.0):
- The npm package fails to install entirely — `require('tree-sitter-swift')`
throws MODULE_NOT_FOUND. There is no prebuilt binary for this platform
and the source build fails. `loadGrammar()` correctly returned null,
but 8 tests still ran unconditionally and failed.
Dart (@sengac/tree-sitter-dart 1.1.6):
- The npm package installs and `require()` succeeds, but the grammar
object has an incompatible ABI with tree-sitter 0.22.4.
`parser.setLanguage(dart)` crashes with "Cannot read properties of
undefined (reading 'length')" inside tree-sitter's internal
`initializeLanguageNodeClasses` function. This is a two-stage failure:
`loadGrammar()` returned non-null (require worked), but `getParser()`
threw an uncaught exception at `setLanguage()`. The grammar was likely
built against a different tree-sitter ABI version.
Source fix (src/extraction/grammars.ts):
- Wrap `parser.setLanguage()` in try/catch inside `getParser()` so
ABI-incompatible grammars degrade gracefully instead of crashing
- Change `isLanguageSupported()` and `getSupportedLanguages()` to call
`getParser()` (validates full ABI compatibility) instead of
`loadGrammar()` (only checks if require succeeds)
Test fixes:
- Skip Swift/Dart test blocks via `describe.skipIf(!isLanguageSupported())`
so they are skipped on platforms where grammars are unavailable
- Remove hardcoded swift/dart from "supported languages" assertion since
availability is platform-dependent
- Fix schema version test: expected 1 but schema is now version 2 after
the v2 migration was added
- Fix DB tests: pass file path (path.join(testDir, 'test.db')) not bare
directory to DatabaseConnection.initialize() — better-sqlite3 cannot
open a directory as a database file
- Fix DB tests: call db.getDb() not db.getDatabase() — the latter method
does not exist on DatabaseConnection
- Fix truncation tests: manually set MAX_OUTPUT_LENGTH on Object.create'd
handler since constructor is bypassed and class field initializers
never run
… paths - Add skipIf guards for Kotlin extraction and import tests (same as Swift/Dart) since the grammar may not load on all platforms - Remove Kotlin from always-expected language list - Normalize path separators in resolveRelativeImport for Windows compat
- Rename vitest.config.ts to vitest.config.mts so Vite loads via ESM instead of the deprecated CJS API - Add @vitest/coverage-v8 dev dependency for the v8 coverage provider - Run tests with --coverage on the ubuntu/Node-22 CI cell
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github/workflows/ci.yml) with build and test jobs across a Node 18/20/22 × ubuntu/macos/windows matrix.github/workflows/release.yml) for publishing to npm onv*tags with provenancenode_modulescaching keyed on OS + Node version + lockfile hash to skip installs on cache hitsnpm ci --ignore-scripts && npm rebuild better-sqlite3(skips 130MB model download)skipIfguards for Kotlin tests (ABI-incompatible grammar, same as Swift/Dart)resolveRelativeImportto normalize path separators on Windowsvitest.config.ts→vitest.config.mtsto fix Vite CJS deprecation warning@vitest/coverage-v8for coverage report generation in CITest plan
node_modules(install step skipped on cache hit)v*tag after merge to verify it runs (publish skips if noNPM_TOKEN)