-
Notifications
You must be signed in to change notification settings - Fork 68
Fix: more versioning around nightly and maint/main
#359
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
Changes from 4 commits
2fbbd64
eab9765
03120e3
3ecdae9
c6e0209
f5509d6
0b1e9cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26045,10 +26045,14 @@ async function maybeInstallRebar3(rebar3Spec) { | |
| return installed | ||
| } | ||
|
|
||
| function maybeRemoveOTPPrefix(otpSpec) { | ||
| return otpSpec.replace(/^OTP-/, '') | ||
| } | ||
|
|
||
| async function getOTPVersion(otpSpec0, osVersion) { | ||
| const [otpVersions, originListing, hexMirrors] = | ||
| await getOTPVersions(osVersion) | ||
| let spec = otpSpec0.replace(/^OTP-/, '') | ||
| let spec = maybeRemoveOTPPrefix(otpSpec0) | ||
| const versions = otpVersions | ||
| const otpVersion = getVersionFromSpec(spec, versions) | ||
|
|
||
|
|
@@ -26224,12 +26228,9 @@ async function getOTPVersions(osVersion) { | |
| .trim() | ||
| .split('\n') | ||
| .forEach((line) => { | ||
| const otpMatch = line | ||
| .match(/^([^ ]+)?( .+)/)[1] | ||
| .match(/^([^-]+-)?(.+)$/) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one goes away. |
||
| const otpVersion = otpMatch[2] | ||
| const otpVersionOrig = otpMatch[0] | ||
| debugLog('OTP line and parsing', [line, otpVersion, otpMatch]) | ||
| const otpVersionOrig = line.match(/^([^ ]+)?( .+)/)[1] | ||
| const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig) | ||
| debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig]) | ||
| otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference | ||
| }) | ||
| } else if (process.platform === 'win32') { | ||
|
|
@@ -26243,10 +26244,10 @@ async function getOTPVersions(osVersion) { | |
| .flat() | ||
| .filter((x) => x.name.match(file_regex)) | ||
| .forEach((x) => { | ||
| const otpMatch = x.name.match(file_regex) | ||
| const otpVersion = otpMatch[1] | ||
| debugLog('OTP line and parsing', [otpMatch, otpVersion]) | ||
| otpVersions[otpVersion] = otpVersion | ||
| const otpVersionOrig = x.name.match(file_regex)[1] | ||
| const otpVersion = otpVersionOrig | ||
| debugLog('OTP line and parsing', [x.name, otpVersion, otpVersionOrig]) | ||
| otpVersions[otpVersion] = otpVersionOrig | ||
| }) | ||
| }) | ||
| } else if (process.platform === 'darwin') { | ||
|
|
@@ -26255,10 +26256,9 @@ async function getOTPVersions(osVersion) { | |
| columns: true, | ||
| }) | ||
| .forEach((line) => { | ||
| const otpMatch = line.ref_name.match(/^([^-]+-)?(.+)$/) | ||
| const otpVersion = otpMatch[2] | ||
| const otpVersionOrig = otpMatch[0] | ||
| debugLog('OTP line and parsing', [line, otpVersion, otpMatch]) | ||
| const otpVersionOrig = line.ref_name | ||
| const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig) | ||
| debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig]) | ||
| otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference | ||
| }) | ||
| } | ||
|
|
@@ -26384,7 +26384,8 @@ function getVersionFromSpec(spec0, versions0) { | |
| isKnownBranch(version) || | ||
| isKnownVerBranch(version) | ||
| ) { | ||
| // If `version-type: strict` or version is RC, we just try to remove a potential initial v | ||
| // If `version-type: strict`, version is an RC, or version is "a branch" | ||
| // we just try to remove a potential initial v | ||
| coerced = maybeRemoveVPrefix(version) | ||
| } else { | ||
| // Otherwise, we place the version into a version bucket | ||
|
|
@@ -26401,18 +26402,19 @@ function getVersionFromSpec(spec0, versions0) { | |
| const rangeMax = semver.maxSatisfying(versions, rangeForMax) | ||
| let version = null | ||
|
|
||
| if ( | ||
| if (spec0 === 'latest') { | ||
| version = versions0[versions0.latest] | ||
| } else if ( | ||
| isStrictVersion() || | ||
| isRC(spec0) || | ||
| isKnownBranch(spec0) || | ||
| isKnownVerBranch(spec0) | ||
| isKnownVerBranch(spec0) || | ||
| spec0 === 'nightly' | ||
| ) { | ||
| if (versions0[spec]) { | ||
| // We obtain it directly | ||
| version = versions0[spec] | ||
| } | ||
| } else if (spec0 === 'latest') { | ||
| version = versions0[versions0.latest] | ||
| } else if (rangeMax !== null) { | ||
| // Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest | ||
| const thatVersion = spec | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,7 +180,7 @@ describe('.getOTPVersion(_) - Erlang', () => { | |
|
|
||
| it('is Ok for known linux version', async () => { | ||
| before = simulateInput('version-type', 'strict') | ||
| spec = '26' | ||
| spec = 'maint-26' | ||
|
||
| osVersion = 'ubuntu-24.04' | ||
| expected = 'maint-26' | ||
| got = await setupBeam.getOTPVersion(spec, osVersion) | ||
|
|
@@ -317,7 +317,7 @@ describe('.getOTPVersion(_) - Erlang', () => { | |
| arm64Options[Math.floor(Math.random() * arm64Options.length)] | ||
|
|
||
| before = simulateInput('version-type', 'strict') | ||
| spec = '26' | ||
| spec = 'maint-26' | ||
| osVersion = 'ubuntu-24.04' | ||
| expected = 'maint-26' | ||
| got = await setupBeam.getOTPVersion(spec, osVersion) | ||
|
|
@@ -389,7 +389,7 @@ describe('.getOTPVersion(_) - Erlang', () => { | |
| amd64Options[Math.floor(Math.random() * amd64Options.length)] | ||
|
|
||
| before = simulateInput('version-type', 'strict') | ||
| spec = '26' | ||
| spec = 'maint-26' | ||
| osVersion = 'ubuntu-24.04' | ||
| expected = 'maint-26' | ||
| got = await setupBeam.getOTPVersion(spec, osVersion) | ||
|
|
@@ -558,6 +558,13 @@ describe('.getOTPVersion(_) - Elixir', () => { | |
| got = await setupBeam.getElixirVersion(spec, otpVersion) | ||
| assert.deepStrictEqual(got, expected) | ||
|
|
||
| spec = 'main-otp-28' | ||
| otpVersion = 'maint-28' | ||
| expected = 'main-otp-28' | ||
| await setupBeam.installOTP(otpVersion) | ||
| got = await setupBeam.getElixirVersion(spec, otpVersion) | ||
| assert.deepStrictEqual(got, expected) | ||
|
||
|
|
||
| spec = '1.16.2-otp-26' | ||
| otpVersion = 'OTP-27' | ||
| expected = 'v1.16.2-otp-26' | ||
|
|
@@ -583,7 +590,7 @@ describe('.getOTPVersion(_) - Elixir', () => { | |
|
|
||
| before = simulateInput('version-type', 'strict') | ||
| spec = 'v1.15.0-rc.2' | ||
| otpVersion = 'OTP-26' | ||
| otpVersion = 'OTP-26.0' | ||
| expected = 'v1.15.0-rc.2-otp-26' | ||
| await setupBeam.installOTP(otpVersion) | ||
| got = await setupBeam.getElixirVersion(spec, otpVersion) | ||
|
|
@@ -617,6 +624,12 @@ describe('.getOTPVersion(_) - Gleam', () => { | |
| got = await setupBeam.getGleamVersion(spec, otpVersion) | ||
| assert.deepStrictEqual(got, expected) | ||
|
|
||
| spec = 'nightly' | ||
| otpVersion = '28' | ||
| expected = 'nightly' | ||
| got = await setupBeam.getGleamVersion(spec, otpVersion) | ||
| assert.deepStrictEqual(got, expected) | ||
|
Comment on lines
+660
to
+664
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the test for #356. |
||
|
|
||
| spec = '0.13.2' | ||
| otpVersion = 'OTP-24' | ||
| expected = 'v0.13.2' | ||
|
|
||
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.
This shoulda been failing but wasn't. Guess it wasn't as strict as we intended...
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.
Oh, it was getting calculated as
maint-<otp-version>.