-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat: automate creation of the first LTS release #514
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f14fcec
feat: automate creation of the first LTS release
richardlau 37b0acb
fixup! feat: automate creation of the first LTS release
richardlau 89c0136
fixup! feat: automate creation of the first LTS release
richardlau 60208b0
fixup! feat: automate creation of the first LTS release
richardlau File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
function getStartLTSBlurb({ date, ltsCodename, versionComponents }) { | ||
const dateFormat = { month: 'long', year: 'numeric' }; | ||
// TODO pull these from the schedule.json in the Release repo? | ||
// Active LTS lasts for one year. | ||
const mainDate = new Date(date); | ||
mainDate.setMonth(mainDate.getMonth() + 12); | ||
const mainStart = mainDate.toLocaleString('en-US', dateFormat); | ||
// Maintenance LTS lasts another 18 months. | ||
const eolDate = new Date(mainStart); | ||
eolDate.setMonth(eolDate.getMonth() + 18); | ||
const eol = eolDate.toLocaleString('en-US', dateFormat); | ||
const { major } = versionComponents; | ||
return [ | ||
/* eslint-disable max-len */ | ||
`This release marks the transition of Node.js ${major}.x into Long Term Support (LTS)`, | ||
`with the codename '${ltsCodename}'. The ${major}.x release line now moves into "Active LTS"`, | ||
`and will remain so until ${mainStart}. After that time, it will move into`, | ||
`"Maintenance" until end of life in ${eol}.` | ||
/* eslint-enable */ | ||
].join('\n'); | ||
} | ||
|
||
function updateTestProcessRelease(test, { versionComponents, ltsCodename }) { | ||
if (test.includes(ltsCodename)) { | ||
return test; | ||
} | ||
const inLines = test.split('\n'); | ||
const outLines = []; | ||
const { major, minor } = versionComponents; | ||
for (const line of inLines) { | ||
if (line === '} else {') { | ||
outLines.push(`} else if (versionParts[0] === '${major}' ` + | ||
`&& versionParts[1] >= ${minor}) {` | ||
); | ||
outLines.push( | ||
` assert.strictEqual(process.release.lts, '${ltsCodename}');` | ||
); | ||
} | ||
outLines.push(line); | ||
} | ||
return outLines.join('\n'); | ||
} | ||
|
||
module.exports = { getStartLTSBlurb, updateTestProcessRelease }; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const versionParts = process.versions.node.split('.'); | ||
|
||
assert.strictEqual(process.release.name, 'node'); | ||
|
||
// It's expected that future LTS release lines will have additional | ||
// branches in here | ||
if (versionParts[0] === '4' && versionParts[1] >= 2) { | ||
assert.strictEqual(process.release.lts, 'Argon'); | ||
} else if (versionParts[0] === '6' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Boron'); | ||
} else if (versionParts[0] === '8' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Carbon'); | ||
} else if (versionParts[0] === '10' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Dubnium'); | ||
} else if (versionParts[0] === '12' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Erbium'); | ||
} else if (versionParts[0] === '14' && versionParts[1] >= 15) { | ||
assert.strictEqual(process.release.lts, 'Fermium'); | ||
} else { | ||
assert.strictEqual(process.release.lts, undefined); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const versionParts = process.versions.node.split('.'); | ||
|
||
assert.strictEqual(process.release.name, 'node'); | ||
|
||
// It's expected that future LTS release lines will have additional | ||
// branches in here | ||
if (versionParts[0] === '4' && versionParts[1] >= 2) { | ||
assert.strictEqual(process.release.lts, 'Argon'); | ||
} else if (versionParts[0] === '6' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Boron'); | ||
} else if (versionParts[0] === '8' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Carbon'); | ||
} else if (versionParts[0] === '10' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Dubnium'); | ||
} else if (versionParts[0] === '12' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Erbium'); | ||
} else { | ||
assert.strictEqual(process.release.lts, undefined); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const { readFileSync } = require('fs'); | ||
const utils = require('../../lib/release/utils'); | ||
|
||
describe('prepare_release: utils.getStartLTSBlurb', () => { | ||
it('generates first LTS release text with correct dates', () => { | ||
const expected = [ | ||
/* eslint-disable max-len */ | ||
'This release marks the transition of Node.js 14.x into Long Term Support (LTS)', | ||
'with the codename \'Fermium\'. The 14.x release line now moves into "Active LTS"', | ||
'and will remain so until October 2021. After that time, it will move into', | ||
'"Maintenance" until end of life in April 2023.' | ||
/* eslint-enable max-len */ | ||
].join('\n'); | ||
const text = utils.getStartLTSBlurb({ | ||
date: '2020-10-27', | ||
ltsCodename: 'Fermium', | ||
versionComponents: { major: 14 } | ||
}); | ||
assert.strictEqual(text, expected); | ||
}); | ||
}); | ||
|
||
describe('prepare_release: utils.updateTestProcessRelease', () => { | ||
it('inserts test a for a new LTS codename', () => { | ||
const expected = readFileSync( | ||
`${__dirname}/../fixtures/release/expected-test-process-release.js`, | ||
{ encoding: 'utf8' } | ||
); | ||
const test = readFileSync( | ||
`${__dirname}/../fixtures/release/original-test-process-release.js`, | ||
{ encoding: 'utf8' } | ||
); | ||
const context = { | ||
ltsCodename: 'Fermium', | ||
versionComponents: { | ||
major: 14, | ||
minor: 15 | ||
} | ||
}; | ||
const updated = utils.updateTestProcessRelease(test, context); | ||
assert.strictEqual(updated, expected); | ||
}); | ||
}); |
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.
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.
Add a link to https://github.com/nodejs/Release/blob/master/CODENAMES.md ?
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.
Done.