Coerce non-semver into semver (#34)

a550a4c · Paulo F. Oliveira · 2021-05-14 23:07

10 files +39 -5

Files changed

modified .github/workflows/test.yml
+4 −0
@@ -98,6 +98,10 @@ jobs:
98 98 otp-version: '23'
99 99 rebar3-version: '3.14'
100 100 os: 'ubuntu-20.04'
101 + - elixir-version: 'v1.12'
102 + otp-version: '24'
103 + rebar3-version: '3.15'
104 + os: 'ubuntu-20.04'
101 105 steps:
102 106 - uses: actions/checkout@v2
103 107 - name: Use erlef/setup-beam
modified 3RD_PARTY_LICENSES
+3 −3
@@ -1081,7 +1081,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1081 1081
1082 1082 -----
1083 1083
1084 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:
1084 +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:
1085 1085
1086 1086 The MIT License (MIT)
1087 1087
@@ -1928,7 +1928,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1928 1928
1929 1929 -----
1930 1930
1931 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:
1931 +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:
1932 1932
1933 1933 MIT License
1934 1934
@@ -2216,7 +2216,7 @@ terms above.
2216 2216
2217 2217 -----
2218 2218
2219 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:
2219 +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:
2220 2220
2221 2221 Copyright jQuery Foundation and other contributors <https://jquery.org/>
2222 2222
modified __tests__/setup-beam.test.js
+24 −0
@@ -98,6 +98,30 @@ async function testOTPVersions() {
98 98 expected = 'OTP-19.3.6'
99 99 got = await setupElixir.getOTPVersion(spec, osVersion)
100 100 assert.deepStrictEqual(got, expected)
101 +
102 + spec = '20'
103 + osVersion = 'ubuntu-20.04'
104 + expected = 'OTP-20.3.8'
105 + got = await setupElixir.getOTPVersion(spec, osVersion)
106 + assert.deepStrictEqual(got, expected)
107 +
108 + spec = '20.x'
109 + osVersion = 'ubuntu-20.04'
110 + expected = 'OTP-20.3.8'
111 + got = await setupElixir.getOTPVersion(spec, osVersion)
112 + assert.deepStrictEqual(got, expected)
113 +
114 + spec = '20.0'
115 + osVersion = 'ubuntu-20.04'
116 + expected = 'OTP-20.0.5'
117 + got = await setupElixir.getOTPVersion(spec, osVersion)
118 + assert.deepStrictEqual(got, expected)
119 +
120 + spec = '20.0.x'
121 + osVersion = 'ubuntu-20.04'
122 + expected = 'OTP-20.0.5'
123 + got = await setupElixir.getOTPVersion(spec, osVersion)
124 + assert.deepStrictEqual(got, expected)
101 125 }
102 126
103 127 async function testElixirVersions() {
modified dist/index.js
+4 −1
@@ -4791,7 +4791,10 @@ async function getOTPVersions(osVersion) {
4791 4791 .forEach((line) => {
4792 4792 const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
4793 4793
4794 const otpVersion = otpMatch[2]
4794 + let otpVersion = otpMatch[2]
4795 + if (semver.validRange(otpVersion)) {
4796 + otpVersion = semver.minVersion(otpVersion).version
4797 + }
4795 4798 otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
4796 4799 })
4797 4800
modified src/setup-beam.js
+4 −1
@@ -184,7 +184,10 @@ async function getOTPVersions(osVersion) {
184 184 .forEach((line) => {
185 185 const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
186 186
187 const otpVersion = otpMatch[2]
187 + let otpVersion = otpMatch[2]
188 + if (semver.validRange(otpVersion)) {
189 + otpVersion = semver.minVersion(otpVersion).version
190 + }
188 191 otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
189 192 })
190 193

Parents: d2707f3