Skip to content

Commit

Permalink
Coerce non-semver into semver (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira authored May 14, 2021
1 parent d2707f3 commit a550a4c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
otp-version: '23'
rebar3-version: '3.14'
os: 'ubuntu-20.04'
- elixir-version: 'v1.12'
otp-version: '24'
rebar3-version: '3.15'
os: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- name: Use erlef/setup-beam
Expand Down
6 changes: 3 additions & 3 deletions 3RD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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/>

Expand Down
24 changes: 24 additions & 0 deletions __tests__/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,30 @@ async function testOTPVersions() {
expected = 'OTP-19.3.6'
got = await setupElixir.getOTPVersion(spec, osVersion)
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() {
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4791,7 +4791,10 @@ async function getOTPVersions(osVersion) {
.forEach((line) => {
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
})

Expand Down
5 changes: 4 additions & 1 deletion src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ async function getOTPVersions(osVersion) {
.forEach((line) => {
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
})

Expand Down

0 comments on commit a550a4c

Please sign in to comment.