Coerce non-semver into semver (#34)

This commit is contained in:
Paulo F. Oliveira
2021-05-15 00:07:41 +01:00
committed by GitHub
parent d2707f347b
commit a550a4c889
5 changed files with 39 additions and 5 deletions
+4
View File
@@ -98,6 +98,10 @@ jobs:
otp-version: '23' otp-version: '23'
rebar3-version: '3.14' rebar3-version: '3.14'
os: 'ubuntu-20.04' os: 'ubuntu-20.04'
- elixir-version: 'v1.12'
otp-version: '24'
rebar3-version: '3.15'
os: 'ubuntu-20.04'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Use erlef/setup-beam - name: Use erlef/setup-beam
+3 -3
View File
@@ -1081,7 +1081,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----- -----
The following software may be included in this product: es-to-primitive, is-boolean-object, is-callable, is-date-object, is-number-object, is-string, is-symbol, object.entries. A copy of the source code may be downloaded from git://github.com/ljharb/es-to-primitive.git (es-to-primitive), git://github.com/ljharb/is-boolean-object.git (is-boolean-object), git://github.com/ljharb/is-callable.git (is-callable), git://github.com/ljharb/is-date-object.git (is-date-object), git://github.com/inspect-js/is-number-object.git (is-number-object), git://github.com/ljharb/is-string.git (is-string), git://github.com/inspect-js/is-symbol.git (is-symbol), git://github.com/es-shims/Object.entries.git (object.entries). This software contains the following license and notice below: The following software may be included in this product: es-to-primitive, is-boolean-object, is-callable, is-date-object, is-number-object, is-string, is-symbol, object.entries. A copy of the source code may be downloaded from git://github.com/ljharb/es-to-primitive.git (es-to-primitive), git://github.com/inspect-js/is-boolean-object.git (is-boolean-object), git://github.com/ljharb/is-callable.git (is-callable), git://github.com/inspect-js/is-date-object.git (is-date-object), git://github.com/inspect-js/is-number-object.git (is-number-object), git://github.com/ljharb/is-string.git (is-string), git://github.com/inspect-js/is-symbol.git (is-symbol), git://github.com/es-shims/Object.entries.git (object.entries). This software contains the following license and notice below:
The MIT License (MIT) The MIT License (MIT)
@@ -1928,7 +1928,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----- -----
The following software may be included in this product: is-bigint. A copy of the source code may be downloaded from git+https://github.com/ljharb/is-bigint.git. This software contains the following license and notice below: The following software may be included in this product: is-bigint. A copy of the source code may be downloaded from git+https://github.com/inspect-js/is-bigint.git. This software contains the following license and notice below:
MIT License MIT License
@@ -2216,7 +2216,7 @@ terms above.
----- -----
The following software may be included in this product: lodash.clonedeep, lodash.flatten, lodash.snakecase, lodash.truncate. A copy of the source code may be downloaded from https://github.com/lodash/lodash.git (lodash.clonedeep), https://github.com/lodash/lodash.git (lodash.flatten), https://github.com/lodash/lodash.git (lodash.snakecase), https://github.com/lodash/lodash.git (lodash.truncate). This software contains the following license and notice below: The following software may be included in this product: lodash.clonedeep, lodash.snakecase, lodash.truncate. A copy of the source code may be downloaded from https://github.com/lodash/lodash.git (lodash.clonedeep), https://github.com/lodash/lodash.git (lodash.snakecase), https://github.com/lodash/lodash.git (lodash.truncate). This software contains the following license and notice below:
Copyright jQuery Foundation and other contributors <https://jquery.org/> Copyright jQuery Foundation and other contributors <https://jquery.org/>
+24
View File
@@ -98,6 +98,30 @@ async function testOTPVersions() {
expected = 'OTP-19.3.6' expected = 'OTP-19.3.6'
got = await setupElixir.getOTPVersion(spec, osVersion) got = await setupElixir.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected) assert.deepStrictEqual(got, expected)
spec = '20'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.3.8'
got = await setupElixir.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
spec = '20.x'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.3.8'
got = await setupElixir.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
spec = '20.0'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.0.5'
got = await setupElixir.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
spec = '20.0.x'
osVersion = 'ubuntu-20.04'
expected = 'OTP-20.0.5'
got = await setupElixir.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
} }
async function testElixirVersions() { async function testElixirVersions() {
+4 -1
View File
@@ -4791,7 +4791,10 @@ async function getOTPVersions(osVersion) {
.forEach((line) => { .forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/) const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpVersion = otpMatch[2] let otpVersion = otpMatch[2]
if (semver.validRange(otpVersion)) {
otpVersion = semver.minVersion(otpVersion).version
}
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
}) })
+4 -1
View File
@@ -184,7 +184,10 @@ async function getOTPVersions(osVersion) {
.forEach((line) => { .forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/) const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpVersion = otpMatch[2] let otpVersion = otpMatch[2]
if (semver.validRange(otpVersion)) {
otpVersion = semver.minVersion(otpVersion).version
}
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
}) })