Skip to content

ci: test better-sqlite3 on a matrix of os/node/version - #11688

Closed
pkuczynski wants to merge 7 commits into
typeorm:masterfrom
pkuczynski:ci/better-sqlite3
Closed

pkuczynski wants to merge 7 commits into
typeorm:masterfrom
pkuczynski:ci/better-sqlite3

Conversation

@pkuczynski

@pkuczynski pkuczynski commented Sep 25, 2025 •

Copy link
Copy Markdown
Member

Description of change

During discussion in #11683 it become quite clear that developers only test better-sqlite3 on the version which is listed in devDependencies. This however might or might not work depending on the used node version. To ensure everything works across different os, node and library versions, I would suggest testing better-sqlite3 in a matrix setup.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change

Summary by CodeRabbit

  • Chores

    • Introduced a reusable build workflow that compiles the project and uploads artifacts for CI.
    • Refined ignore rules to target only root-level build, coverage, node_modules, and NYC output directories.
  • Tests

    • Added a matrix test workflow for better-sqlite3 across multiple operating systems, Node.js versions, and library versions.
    • Simplified existing Linux and Windows test workflows by removing redundant better-sqlite3 jobs, consolidating coverage and test execution.

@coderabbitai

coderabbitai Bot commented Sep 25, 2025 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@pkuczynski has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 48 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between cd5d566 and 92326b2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • .github/actions/build/action.yml (1 hunks)
  • package.json (1 hunks)

Walkthrough

Adds a composite GitHub Action for building artifacts, introduces a dedicated matrix workflow to test better-sqlite3 across OS/Node/version combinations, removes better-sqlite3 jobs from existing Linux/Windows workflows, and tightens .gitignore patterns to root-scoped entries for build, coverage, node_modules, and .nyc_output.

Changes

Cohort / File(s) Summary
Composite build action
\.github/actions/build/action.yml
New composite action: setup Node 24 with npm cache, run npm ci, run npm run compile, upload build/ as artifact (retention 1 day).
Dedicated better-sqlite3 workflow
\.github/workflows/test-better-sqlite3.yml
New workflow: PR-triggered matrix over OS (macOS/Ubuntu/Windows), Node (16,18,20,22,24), better-sqlite3 (8–12) with explicit excludes; uses build artifact, installs matrix version, copies ormconfig.json, runs tests with nyc; optional Coveralls step commented.
Removed better-sqlite3 from legacy OS workflows
\.github/workflows/tests-linux.yml, \.github/workflows/tests-windows.yml
Deletes the better-sqlite3 jobs from Linux and Windows workflows; other jobs remain unchanged.
Git ignore scope tightening
\.gitignore
Replaces broad ignores (build/, coverage/, *.lcov, .nyc_output/, node_modules/) with root-scoped entries: /build/, /coverage/, /node_modules/, /.nyc_output/.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions
  participant Build as Composite Build Action
  participant Artifact as Artifact Store
  participant Test as better-sqlite3 Matrix Tests

  Dev->>GH: Open Pull Request
  activate GH
  GH->>Build: Run build (setup-node → npm ci → compile)
  Build->>Artifact: Upload build/ (retention: 1 day)
  GH-->>GH: Legacy linux/windows workflows run (without better-sqlite3)
  GH->>Test: Start matrix (OS × Node × b-sqlite3 with excludes)
  Test->>Artifact: Download build/
  Test->>Test: npm ci → install better-sqlite3@version → copy ormconfig.json
  Test->>Test: npx nyc npm run test:ci
  deactivate GH
  note over Test,GH: Coveralls step available but commented out
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • chore(ci): simplify workflows #11530 — Also restructures GitHub Actions workflows, adjusting database-related test orchestration, likely overlapping with better-sqlite3 job handling.

Suggested reviewers

  • OSA413
  • naorpeled
  • sgarner
  • gioboa

Poem

I built a warren with artifacts neat,
Hopped tests to matrices—what a feat!
Linux and Windows, I trimmed the trail,
A carrot of coverage, pending mail.
In tidy roots my ignores reside—
Thump-thump! CI’s a smoother ride. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the primary change by indicating that CI is enhanced to test better-sqlite3 across a matrix of operating systems, Node.js versions, and library versions, and it clearly conveys the scope without extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83e3a8a and cd5d566.

📒 Files selected for processing (5)
  • .github/actions/build/action.yml (1 hunks)
  • .github/workflows/test-better-sqlite3.yml (1 hunks)
  • .github/workflows/tests-linux.yml (0 hunks)
  • .github/workflows/tests-windows.yml (0 hunks)
  • .gitignore (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/tests-linux.yml
  • .github/workflows/tests-windows.yml
🧰 Additional context used
🪛 GitHub Actions: test-better-sqlite3
.github/actions/build/action.yml

[error] 24-24: GitHub Action YAML parse error: While scanning a simple key, could not find expected ':'.

🪛 actionlint (1.7.7)
.github/workflows/test-better-sqlite3.yml

15-15: could not parse action metadata in "/home/jailuser/git/.github/actions/build": yaml: line 23: could not find expected ':'

(action)


27-27: value ["8", "9", "10"] in "exclude" does not match in matrix "version" combinations. possible values are "8", "9", "10", "11", "12"

(matrix)


29-29: value ["8", "9", "10", "11"] in "exclude" does not match in matrix "version" combinations. possible values are "8", "9", "10", "11", "12"

(matrix)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: tests-windows / sqlite
  • GitHub Check: tests-windows / sqljs
  • GitHub Check: Analyze (javascript-typescript)

Comment thread .github/actions/build/action.yml Resolved
Comment on lines +25 to +29
exclude:
- node: 22
version: [8, 9, 10]
- node: 24
version: [8, 9, 10, 11]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix matrix excludes: arrays are invalid here

exclude entries must spell out full combinations—GitHub Actions won’t accept array values. The current config leaves the bad combos in play. Please expand them into discrete entries.

         version: [8, 9, 10, 11, 12]
         exclude:
-          - node: 22
-            version: [8, 9, 10]
-          - node: 24
-            version: [8, 9, 10, 11]
+          - node: 22
+            version: 8
+          - node: 22
+            version: 9
+          - node: 22
+            version: 10
+          - node: 24
+            version: 8
+          - node: 24
+            version: 9
+          - node: 24
+            version: 10
+          - node: 24
+            version: 11
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
exclude:
- node: 22
version: [8, 9, 10]
- node: 24
version: [8, 9, 10, 11]
version: [8, 9, 10, 11, 12]
exclude:
- node: 22
version: 8
- node: 22
version: 9
- node: 22
version: 10
- node: 24
version: 8
- node: 24
version: 9
- node: 24
version: 10
- node: 24
version: 11
🧰 Tools
🪛 actionlint (1.7.7)

27-27: value ["8", "9", "10"] in "exclude" does not match in matrix "version" combinations. possible values are "8", "9", "10", "11", "12"

(matrix)


29-29: value ["8", "9", "10", "11"] in "exclude" does not match in matrix "version" combinations. possible values are "8", "9", "10", "11", "12"

(matrix)

🤖 Prompt for AI Agents
.github/workflows/test-better-sqlite3.yml around lines 25 to 29: the matrix
exclude block uses arrays for version (e.g. version: [8, 9, 10]) which GitHub
Actions does not accept; replace each array-based exclude with separate exclude
entries that enumerate each node/version combination individually (e.g. one
exclude object per version number for node 22, and likewise one per version
number for node 24) so all invalid combinations are explicitly spelled out.


- run: npm install -D better-sqlite3@${{ matrix.version }}

- run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make the config copy step cross-platform

cp fails under the default Windows shell (pwsh). Either switch the step to bash or use a PowerShell copy, otherwise every Windows job will break.

-      - run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json
+      - run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json
+        shell: bash
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json
- run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json
shell: bash
🤖 Prompt for AI Agents
In .github/workflows/test-better-sqlite3.yml around line 50, the step uses the
Unix-specific `cp` command which fails under the default Windows shell (pwsh);
update the step to be cross-platform by either setting the step to run in bash
(add `shell: bash` and keep `cp ...`) or replace the command with a
PowerShell-safe copy (e.g., `Copy-Item` via pwsh) so Windows runners won’t
break.

Comment thread .gitignore
Comment on lines +6 to +9
/build/
/coverage/
/node_modules/
/.nyc_output/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore global ignores for build outputs and node_modules

Scoping these ignores to the repo root will stop Git from ignoring node_modules, build, coverage, etc. in nested example/fixture folders. This repo has multiple subprojects/tests that can spawn those directories, so we’d risk accidentally committing huge dependency trees. Please revert to the global patterns.

-/build/
-/coverage/
-/node_modules/
-/.nyc_output/
+build/
+coverage/
+node_modules/
+.nyc_output/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/build/
/coverage/
/node_modules/
/.nyc_output/
build/
coverage/
node_modules/
.nyc_output/
🤖 Prompt for AI Agents
In .gitignore around lines 6 to 9, the entries are rooted (start with /) which
only ignores those paths at the repo root; change them to global patterns by
removing the leading slashes so nested example/fixture folders' build/,
coverage/, node_modules/, and .nyc_output/ directories are ignored (e.g., use
node_modules/ , build/ , coverage/ , .nyc_output/).

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2025

Copy link
Copy Markdown

typeorm-sql-js-example

npm i https://pkg.pr.new/typeorm/typeorm@11688

commit: 92326b2

@coveralls

coveralls commented Sep 25, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 76.081%. first build
when pulling 92326b2 on pkuczynski:ci/better-sqlite3
into 83e3a8a on typeorm:master.

@pkuczynski

Copy link
Copy Markdown
Member Author

Following conversation in #11683 (comment), such proposal is not welcome.

@pkuczynski pkuczynski closed this Sep 25, 2025
@pkuczynski
pkuczynski deleted the ci/better-sqlite3 branch September 25, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants