Crash on invalid Elixir+OTP combo (#134)

6b2f815 · Paulo F. Oliveira · 2022-09-13 07:21

4 files +13 -8
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/ubuntu.yml
+1 −0
@@ -116,6 +116,7 @@ jobs:
116 116 - elixir-version: 'master'
117 117 otp-version: '25'
118 118 os: 'ubuntu-20.04'
119 + version-type: 'strict'
119 120 - gleam-version: 'nightly'
120 121 otp-version: '24'
121 122 - gleam-version: '0.23'
modified __tests__/setup-beam.test.js
+2 −2
@@ -171,8 +171,8 @@ async function testElixirVersions() {
171 171 let otpVersion
172 172
173 173 spec = '1.1.x'
174 otpVersion = 'OTP-23'
175 expected = 'v1.1.1'
174 + otpVersion = 'OTP-17'
175 + expected = 'v1.1.1-otp-17'
176 176 got = await setupBeam.getElixirVersion(spec, otpVersion)
177 177 assert.deepStrictEqual(got, expected)
178 178
modified dist/index.js
+5 −3
@@ -7358,9 +7358,11 @@ async function getElixirVersion(exSpec0, otpVersion) {
7358 7358 `Using Elixir ${elixirVersion} (built for OTP ${otpVersionMajor})`,
7359 7359 )
7360 7360 } else {
7361 // ... and it's not available: fallback to the 'generic' version (v1.4.5 only).
7362 elixirVersionWithOTP = elixirVersion
7363 core.info(`Using Elixir ${elixirVersion}`)
7361 + // ... and it's not available: exit with exception
7362 + throw new Error(
7363 + `Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) not ` +
7364 + 'found in version list (did you check Compatibility between Elixir and Erlang/OTP?)',
7365 + )
7364 7366 }
7365 7367 } else {
7366 7368 throw new Error(
modified src/setup-beam.js
+5 −3
@@ -188,9 +188,11 @@ async function getElixirVersion(exSpec0, otpVersion) {
188 188 `Using Elixir ${elixirVersion} (built for OTP ${otpVersionMajor})`,
189 189 )
190 190 } else {
191 // ... and it's not available: fallback to the 'generic' version (v1.4.5 only).
192 elixirVersionWithOTP = elixirVersion
193 core.info(`Using Elixir ${elixirVersion}`)
191 + // ... and it's not available: exit with exception
192 + throw new Error(
193 + `Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) not ` +
194 + 'found in version list (did you check Compatibility between Elixir and Erlang/OTP?)',
195 + )
194 196 }
195 197 } else {
196 198 throw new Error(

Parents: 7dd0d76