mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Test for updated doc. on latest / ranges / -rc (#349)
* Set the expectations * Reason on the past * Also allow for removal of OTP- in comparison to RC * Test it on what makes sense * For known elements don't compare with ranges * Don't put maint-27 alongside 27 in the initial map * Generate the dist * Revisit the whole latest vs. rc- vs. strict definition
This commit is contained in:
committed by
GitHub
parent
75edbb8287
commit
6a38171948
@@ -53,19 +53,25 @@ end up being parsed as `23`, which is not equivalent.
|
||||
|
||||
#### Pre-release versions
|
||||
|
||||
For pre-release versions, such as `v1.11.0-rc.0`, use the full version
|
||||
specifier (`v1.11.0-rc.0`) and set option `version-type` to `strict`. Pre-release versions are
|
||||
opt-in, so `1.11.x` will not match a pre-release.
|
||||
To use a pre-release version such as `v1.11.0-rc.0`, specify the exact version
|
||||
(`v1.11.0-rc.0`) and set `version-type` to `strict`.
|
||||
Note that pre-release versions are opt-in by default.
|
||||
Patterns like `1.11.x` do not include pre-release versions unless `latest` is specified.
|
||||
|
||||
#### "Latest" versions
|
||||
|
||||
Set a tool's version to `latest` to retrieve the latest version of a given tool.
|
||||
The latest version is (locally) calculated by the action based on the (retrieved) versions
|
||||
it knows (**note**: it is not the same as [GitHub considers it](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)
|
||||
and some repositories might propose).
|
||||
To retrieve the most recent available version of a tool, set the version to `latest`.
|
||||
This may include pre-release versions such as release candidates.
|
||||
|
||||
If in doubt do a test run and compare the obtained release with the one you were expecting to
|
||||
be the latest.
|
||||
If you want to target only the latest stable release and exclude pre-releases, use a
|
||||
version range like `> 0` instead.
|
||||
|
||||
Note that the `latest` version is determined locally by the action based on the versions it
|
||||
has retrieved. This may differ from how [GitHub defines "latest"](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository),
|
||||
and some repositories may present different interpretations.
|
||||
|
||||
If you're unsure, perform a test run and compare the resolved version against the version you
|
||||
expect to be considered the latest.
|
||||
|
||||
### Compatibility between Operating System and Erlang/OTP
|
||||
|
||||
|
||||
Vendored
+15
-4
@@ -26323,6 +26323,7 @@ function validVersion(v) {
|
||||
v.match(
|
||||
new RegExp(`${knownBranches.join('|')}|${nonSpecificVersions.join('|')}`),
|
||||
) == null &&
|
||||
// these ones are for rebar3, which has alpha and beta releases
|
||||
!v.startsWith('a') &&
|
||||
!v.startsWith('b')
|
||||
)
|
||||
@@ -26349,7 +26350,12 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
const altVersions = {}
|
||||
Object.entries(versions0).forEach(([version, altVersion]) => {
|
||||
let coerced
|
||||
if (isStrictVersion() || isRC(version)) {
|
||||
if (
|
||||
isStrictVersion() ||
|
||||
isRC(version) ||
|
||||
isKnownBranch(version) ||
|
||||
isKnownVerBranch(version)
|
||||
) {
|
||||
// If `version-type: strict` or version is RC, we just try to remove a potential initial v
|
||||
coerced = maybeRemoveVPrefix(version)
|
||||
} else {
|
||||
@@ -26367,9 +26373,14 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
||||
let version = null
|
||||
|
||||
if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) {
|
||||
if (
|
||||
isStrictVersion() ||
|
||||
isRC(spec0) ||
|
||||
isKnownBranch(spec0) ||
|
||||
isKnownVerBranch(spec0)
|
||||
) {
|
||||
if (versions0[spec]) {
|
||||
// If `version-type: strict` or version is RC, we obtain it directly
|
||||
// We obtain it directly
|
||||
version = versions0[spec]
|
||||
}
|
||||
} else if (spec0 === 'latest') {
|
||||
@@ -26592,7 +26603,7 @@ function xyzAbcVersion(pref, suf) {
|
||||
// https://www.erlang.org/doc/system_principles/versions.html
|
||||
const dd = '\\.?(\\d+)?'
|
||||
return new RegExp(
|
||||
`${pref}v?(\\d+)${dd}${dd}${dd}${dd}${dd}(?:-rc\\.?\\d+)?(?:-otp-\\d+)?${suf}`,
|
||||
`${pref}(?:OTP-)?v?(\\d+)${dd}${dd}${dd}${dd}${dd}(?:-rc\\.?\\d+)?(?:-otp-\\d+)?${suf}`,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -448,6 +448,7 @@ function validVersion(v) {
|
||||
v.match(
|
||||
new RegExp(`${knownBranches.join('|')}|${nonSpecificVersions.join('|')}`),
|
||||
) == null &&
|
||||
// these ones are for rebar3, which has alpha and beta releases
|
||||
!v.startsWith('a') &&
|
||||
!v.startsWith('b')
|
||||
)
|
||||
@@ -474,7 +475,12 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
const altVersions = {}
|
||||
Object.entries(versions0).forEach(([version, altVersion]) => {
|
||||
let coerced
|
||||
if (isStrictVersion() || isRC(version)) {
|
||||
if (
|
||||
isStrictVersion() ||
|
||||
isRC(version) ||
|
||||
isKnownBranch(version) ||
|
||||
isKnownVerBranch(version)
|
||||
) {
|
||||
// If `version-type: strict` or version is RC, we just try to remove a potential initial v
|
||||
coerced = maybeRemoveVPrefix(version)
|
||||
} else {
|
||||
@@ -492,9 +498,14 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
||||
let version = null
|
||||
|
||||
if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) {
|
||||
if (
|
||||
isStrictVersion() ||
|
||||
isRC(spec0) ||
|
||||
isKnownBranch(spec0) ||
|
||||
isKnownVerBranch(spec0)
|
||||
) {
|
||||
if (versions0[spec]) {
|
||||
// If `version-type: strict` or version is RC, we obtain it directly
|
||||
// We obtain it directly
|
||||
version = versions0[spec]
|
||||
}
|
||||
} else if (spec0 === 'latest') {
|
||||
@@ -717,7 +728,7 @@ function xyzAbcVersion(pref, suf) {
|
||||
// https://www.erlang.org/doc/system_principles/versions.html
|
||||
const dd = '\\.?(\\d+)?'
|
||||
return new RegExp(
|
||||
`${pref}v?(\\d+)${dd}${dd}${dd}${dd}${dd}(?:-rc\\.?\\d+)?(?:-otp-\\d+)?${suf}`,
|
||||
`${pref}(?:OTP-)?v?(\\d+)${dd}${dd}${dd}${dd}${dd}(?:-rc\\.?\\d+)?(?:-otp-\\d+)?${suf}`,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -875,11 +875,31 @@ describe('.getVersionFromSpec(_)', () => {
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-20.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'maint-24'
|
||||
expected = 'maint-24'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '> 0'
|
||||
expected = 'OTP-26.2.5'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'latest'
|
||||
expected = 'OTP-27.0-rc3'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'maint-26'
|
||||
expected = 'maint-26'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '> 0'
|
||||
expected = 'OTP-27.0'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-24.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'latest'
|
||||
expected = 'OTP-27.0'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-24.04'])
|
||||
|
||||
Reference in New Issue
Block a user