Skip to content

Commit fceaea9

Browse files
Fix: more versioning around nightly and maint/main (#359)
* Test Elixir main-otp-28 / Erlang maint-28 * Test Gleam nightly / OTP 28 * Tweak versioning 1. stop trying to "coerce" versions on input 2. handle `OTP-` in one more place 3. handle `nightly` * Remove tests that should be failing previously There is no strict 27 for macos-15, for example * Remove similar tests We'll test once per platform in similar conditions * `await` for `assert.rejects` (not noticeable if alone inside `it`) * Test maint- for strict and loose
1 parent 2bb5b65 commit fceaea9

File tree

5 files changed

+119
-91
lines changed

5 files changed

+119
-91
lines changed

.github/workflows/macos.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ jobs:
4343
elixir-version: '1.14.3'
4444
os: 'macos-latest'
4545
version-type: 'strict'
46-
- otp-version: '27'
47-
os: 'macos-15'
48-
version-type: 'strict'
49-
- otp-version: '26'
50-
os: 'macos-15'
51-
version-type: 'strict'
5246
- otp-version: '25'
5347
os: 'macos-15'
5448
- otp-version: '26'

.github/workflows/ubuntu.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ jobs:
5353
elixir-version: '1.14.3'
5454
os: 'ubuntu-latest'
5555
version-type: 'strict'
56-
- otp-version: '27'
57-
os: 'ubuntu-24.04'
58-
version-type: 'strict'
59-
- otp-version: '26'
60-
os: 'ubuntu-24.04'
61-
version-type: 'strict'
6256
- otp-version: '25'
6357
os: 'ubuntu-24.04'
6458
- otp-version: '26'

dist/index.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26045,10 +26045,14 @@ async function maybeInstallRebar3(rebar3Spec) {
2604526045
return installed
2604626046
}
2604726047

26048+
function maybeRemoveOTPPrefix(otpSpec) {
26049+
return otpSpec.replace(/^OTP-/, '')
26050+
}
26051+
2604826052
async function getOTPVersion(otpSpec0, osVersion) {
2604926053
const [otpVersions, originListing, hexMirrors] =
2605026054
await getOTPVersions(osVersion)
26051-
let spec = otpSpec0.replace(/^OTP-/, '')
26055+
let spec = maybeRemoveOTPPrefix(otpSpec0)
2605226056
const versions = otpVersions
2605326057
const otpVersion = getVersionFromSpec(spec, versions)
2605426058

@@ -26224,12 +26228,9 @@ async function getOTPVersions(osVersion) {
2622426228
.trim()
2622526229
.split('\n')
2622626230
.forEach((line) => {
26227-
const otpMatch = line
26228-
.match(/^([^ ]+)?( .+)/)[1]
26229-
.match(/^([^-]+-)?(.+)$/)
26230-
const otpVersion = otpMatch[2]
26231-
const otpVersionOrig = otpMatch[0]
26232-
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
26231+
const otpVersionOrig = line.match(/^([^ ]+)?( .+)/)[1]
26232+
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
26233+
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
2623326234
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
2623426235
})
2623526236
} else if (process.platform === 'win32') {
@@ -26243,10 +26244,10 @@ async function getOTPVersions(osVersion) {
2624326244
.flat()
2624426245
.filter((x) => x.name.match(file_regex))
2624526246
.forEach((x) => {
26246-
const otpMatch = x.name.match(file_regex)
26247-
const otpVersion = otpMatch[1]
26248-
debugLog('OTP line and parsing', [otpMatch, otpVersion])
26249-
otpVersions[otpVersion] = otpVersion
26247+
const otpVersionOrig = x.name.match(file_regex)[1]
26248+
const otpVersion = otpVersionOrig
26249+
debugLog('OTP line and parsing', [x.name, otpVersion, otpVersionOrig])
26250+
otpVersions[otpVersion] = otpVersionOrig
2625026251
})
2625126252
})
2625226253
} else if (process.platform === 'darwin') {
@@ -26255,10 +26256,9 @@ async function getOTPVersions(osVersion) {
2625526256
columns: true,
2625626257
})
2625726258
.forEach((line) => {
26258-
const otpMatch = line.ref_name.match(/^([^-]+-)?(.+)$/)
26259-
const otpVersion = otpMatch[2]
26260-
const otpVersionOrig = otpMatch[0]
26261-
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
26259+
const otpVersionOrig = line.ref_name
26260+
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
26261+
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
2626226262
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
2626326263
})
2626426264
}
@@ -26384,7 +26384,8 @@ function getVersionFromSpec(spec0, versions0) {
2638426384
isKnownBranch(version) ||
2638526385
isKnownVerBranch(version)
2638626386
) {
26387-
// If `version-type: strict` or version is RC, we just try to remove a potential initial v
26387+
// If `version-type: strict`, version is an RC, or version is "a branch"
26388+
// we just try to remove a potential initial v
2638826389
coerced = maybeRemoveVPrefix(version)
2638926390
} else {
2639026391
// Otherwise, we place the version into a version bucket
@@ -26401,18 +26402,19 @@ function getVersionFromSpec(spec0, versions0) {
2640126402
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
2640226403
let version = null
2640326404

26404-
if (
26405+
if (spec0 === 'latest') {
26406+
version = versions0[versions0.latest]
26407+
} else if (
2640526408
isStrictVersion() ||
2640626409
isRC(spec0) ||
2640726410
isKnownBranch(spec0) ||
26408-
isKnownVerBranch(spec0)
26411+
isKnownVerBranch(spec0) ||
26412+
spec0 === 'nightly'
2640926413
) {
2641026414
if (versions0[spec]) {
2641126415
// We obtain it directly
2641226416
version = versions0[spec]
2641326417
}
26414-
} else if (spec0 === 'latest') {
26415-
version = versions0[versions0.latest]
2641626418
} else if (rangeMax !== null) {
2641726419
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
2641826420
const thatVersion = spec

src/setup-beam.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,14 @@ async function maybeInstallRebar3(rebar3Spec) {
170170
return installed
171171
}
172172

173+
function maybeRemoveOTPPrefix(otpSpec) {
174+
return otpSpec.replace(/^OTP-/, '')
175+
}
176+
173177
async function getOTPVersion(otpSpec0, osVersion) {
174178
const [otpVersions, originListing, hexMirrors] =
175179
await getOTPVersions(osVersion)
176-
let spec = otpSpec0.replace(/^OTP-/, '')
180+
let spec = maybeRemoveOTPPrefix(otpSpec0)
177181
const versions = otpVersions
178182
const otpVersion = getVersionFromSpec(spec, versions)
179183

@@ -349,12 +353,9 @@ async function getOTPVersions(osVersion) {
349353
.trim()
350354
.split('\n')
351355
.forEach((line) => {
352-
const otpMatch = line
353-
.match(/^([^ ]+)?( .+)/)[1]
354-
.match(/^([^-]+-)?(.+)$/)
355-
const otpVersion = otpMatch[2]
356-
const otpVersionOrig = otpMatch[0]
357-
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
356+
const otpVersionOrig = line.match(/^([^ ]+)?( .+)/)[1]
357+
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
358+
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
358359
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
359360
})
360361
} else if (process.platform === 'win32') {
@@ -368,10 +369,10 @@ async function getOTPVersions(osVersion) {
368369
.flat()
369370
.filter((x) => x.name.match(file_regex))
370371
.forEach((x) => {
371-
const otpMatch = x.name.match(file_regex)
372-
const otpVersion = otpMatch[1]
373-
debugLog('OTP line and parsing', [otpMatch, otpVersion])
374-
otpVersions[otpVersion] = otpVersion
372+
const otpVersionOrig = x.name.match(file_regex)[1]
373+
const otpVersion = otpVersionOrig
374+
debugLog('OTP line and parsing', [x.name, otpVersion, otpVersionOrig])
375+
otpVersions[otpVersion] = otpVersionOrig
375376
})
376377
})
377378
} else if (process.platform === 'darwin') {
@@ -380,10 +381,9 @@ async function getOTPVersions(osVersion) {
380381
columns: true,
381382
})
382383
.forEach((line) => {
383-
const otpMatch = line.ref_name.match(/^([^-]+-)?(.+)$/)
384-
const otpVersion = otpMatch[2]
385-
const otpVersionOrig = otpMatch[0]
386-
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
384+
const otpVersionOrig = line.ref_name
385+
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
386+
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
387387
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
388388
})
389389
}
@@ -509,7 +509,8 @@ function getVersionFromSpec(spec0, versions0) {
509509
isKnownBranch(version) ||
510510
isKnownVerBranch(version)
511511
) {
512-
// If `version-type: strict` or version is RC, we just try to remove a potential initial v
512+
// If `version-type: strict`, version is an RC, or version is "a branch"
513+
// we just try to remove a potential initial v
513514
coerced = maybeRemoveVPrefix(version)
514515
} else {
515516
// Otherwise, we place the version into a version bucket
@@ -526,18 +527,19 @@ function getVersionFromSpec(spec0, versions0) {
526527
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
527528
let version = null
528529

529-
if (
530+
if (spec0 === 'latest') {
531+
version = versions0[versions0.latest]
532+
} else if (
530533
isStrictVersion() ||
531534
isRC(spec0) ||
532535
isKnownBranch(spec0) ||
533-
isKnownVerBranch(spec0)
536+
isKnownVerBranch(spec0) ||
537+
spec0 === 'nightly'
534538
) {
535539
if (versions0[spec]) {
536540
// We obtain it directly
537541
version = versions0[spec]
538542
}
539-
} else if (spec0 === 'latest') {
540-
version = versions0[versions0.latest]
541543
} else if (rangeMax !== null) {
542544
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
543545
const thatVersion = spec

0 commit comments

Comments
 (0)