-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
ci: control development and CI version of Node.js via .nvmrc #11708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughGitHub Actions workflows now read Node.js version from a new Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (13)
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. Comment |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
DEVELOPER.md (1)
5-9: Fix broken table-of-contents link.The TOC still points to
#installing-npm-modules, but the heading was renamed to## Node, so the link is now dead. Please update the TOC entry to keep the navigation working.Apply this diff:
-* [Installing NPM Modules](#installing-npm-modules) +* [Node](#node) +* [Installing package dependencies](#installing-package-dependencies)Also applies to: 53-64
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/commit-validation.yml(3 hunks).github/workflows/preview.yml(1 hunks).github/workflows/publish-package.yml(1 hunks).github/workflows/tests-linux.yml(1 hunks).nvmrc(1 hunks)DEVELOPER.md(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/commit-validation.yml
75-75: input "base-node-version" is typed as number by reusable workflow "./.github/workflows/tests-linux.yml". string value cannot be assigned
(expression)
75-75: property "outbputs" is not defined in object type {outputs: {base-node-version: string; node-versions: string}; result: string}
(expression)
81-81: input "node-version" is typed as number by reusable workflow "./.github/workflows/tests-windows.yml". string value cannot be assigned
(expression)
⏰ 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). (1)
- GitHub Check: Analyze (javascript-typescript)
gioboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, nice improvement 🙌
alumni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not base the versions run in CI on any .nvmrc file.
Why not? |
|
@pkuczynski see the other comment:
I had to write some text to block the merge of the PR :P Whatever is in the Any project setup changes should not be done here, but in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/commit-validation.yml(3 hunks)DEVELOPER.md(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- DEVELOPER.md
# Conflicts: # .github/workflows/commit-validation.yml # .github/workflows/preview.yml
🤦♂️
Seems that other maintainers are of a different opinion, since they already approved the PR...
This setup immediately helps people trying to come up with a bugfix. The changes in Question is rather: is this a good or bad change? I think its good because it lowers the entry barier for the project and ensures control of the version in a single place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.github/workflows/commit-validation.yml (1)
54-61: Still assuming numeric.nvmrcbreaks the matrix job.
.nvmrccan legally contain values likev20.11.1orlts/*. In that caseBASE_NODE_VERSION=$(head …)yields a non-integer and$(( BASE_NODE_VERSION - 2 ))aborts, so this job dies before emitting outputs. Please resolve the spec to an actual version and only then do the arithmetic (e.g. runactions/setup-nodewithnode-version-file: .nvmrc, grab${{ steps.setup-node.outputs.node-version }}, parse its major with a numeric guard, and compute the previous major from that).- - id: node - run: | - BASE_NODE_VERSION=$(head -n 1 .nvmrc) - PREV_NODE_VERSION=$((BASE_NODE_VERSION - 2)) - - echo "node-versions=[$PREV_NODE_VERSION, $BASE_NODE_VERSION]" >> $GITHUB_OUTPUT - echo "base-node-version=$BASE_NODE_VERSION" >> $GITHUB_OUTPUT + - uses: actions/setup-node@v5 + id: resolve-node + with: + node-version-file: .nvmrc + - id: node + run: | + BASE_NODE_VERSION='${{ steps.resolve-node.outputs.node-version }}' + BASE_NODE_MAJOR=${BASE_NODE_VERSION%%.*} + if ! [[ "$BASE_NODE_MAJOR" =~ ^[0-9]+$ ]]; then + echo "Unable to derive major version from \"$BASE_NODE_VERSION\"" >&2 + exit 1 + fi + PREV_NODE_MAJOR=$((BASE_NODE_MAJOR - 2)) + echo "node-versions=[$PREV_NODE_MAJOR, $BASE_NODE_MAJOR]" >> "$GITHUB_OUTPUT" + echo "base-node-version=$BASE_NODE_MAJOR" >> "$GITHUB_OUTPUT"
🧹 Nitpick comments (1)
.github/workflows/commit-validation.yml (1)
54-55: Update checkout to v5 for consistency.New jobs should stick to
actions/checkout@v5, same as the other jobs in this workflow. Please bump this step to the latest major.- - uses: actions/checkout@v4 + - uses: actions/checkout@v5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/commit-validation.yml(3 hunks).github/workflows/preview.yml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/preview.yml
⏰ 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). (20)
- GitHub Check: tests-linux (20) / postgres (17)
- GitHub Check: tests-linux (20) / postgres (14)
- GitHub Check: tests-linux (20) / mysql_mariadb
- GitHub Check: tests-linux (20) / cockroachdb
- GitHub Check: tests-linux (18) / oracle
- GitHub Check: tests-linux (20) / mongodb
- GitHub Check: tests-linux (18) / mysql_mariadb_latest
- GitHub Check: tests-linux (18) / mysql_mariadb
- GitHub Check: tests-linux (18) / sqlite
- GitHub Check: tests-linux (18) / sap
- GitHub Check: tests-linux (18) / mssql
- GitHub Check: tests-linux (18) / postgres (14)
- GitHub Check: tests-linux (18) / postgres (17)
- GitHub Check: tests-linux (18) / sqljs
- GitHub Check: tests-linux (18) / better-sqlite3
- GitHub Check: tests-windows / sqljs
- GitHub Check: tests-linux (18) / mongodb
- GitHub Check: tests-windows / better-sqlite3
- GitHub Check: tests-windows / sqlite
- GitHub Check: Analyze (javascript-typescript)
|
I would say, let's not add unnecessary complexity by tying the workflows to the Regarding the |
My intention is to ease setup and work for the new contributors (like me myself). When I pulled the project first time, nothing worked, not even I would like to be in a situation where my local run is as close as possible to CI. This way we save everyone time (and cost of CI). Controlling both via single config file (nvmrc) seems to be a very good way to achieve that. I am not sure where do you see the complexity?
|
gioboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 it looks fine to me
|
Sorry, but no |
The complexity comes from parsing the file and adding shifts to the node version to make it work with several versions of Node. I would save .nvmrc for new contributors, but not change the CI/CD configuration. |
Exactly my point when I requested changes. Unfortunately the PR author does not accept feedback. |
I just don't see the complexity, sorry 🤷♂️ Instead of manually managing node version in CI and local run, we use single point of reference and we don't have to duplicate ourselves. Even GHA actions ( I only had to wrote really simple and small script to build the matrix... If that bothers you, I can remove that part. But I also wanted to hear some other maintainers opinion, since so far only @alumni had some considerations... |
|
My opinion is that I prefer a number in the workflows, because I find it easier to understand. But the rest of the changes I like. |
|
@alumni @OSA413 @michaelbromley is it better now? Or do you want |
|
This one is much simpler/better, let's see what others think. |
Description of change
Simplifies node version management and upgrades burden. Ensures developers (contributors) use the same node version (some currently used dev dependencies require older versions of node).
Pull-Request Checklist
masterbranchFixes #00000Summary by CodeRabbit
Chores
Documentation