Skip to content

Commit

Permalink
Crash on invalid Elixir+OTP combo (#134)
Browse files Browse the repository at this point in the history
* Prevent "future" errors when choosing incompatible Elixir v. OTP versions

* Fix tests as per GitHub Actions' output

* Make test elixir `master` strict

It has no -otp- in the name
  • Loading branch information
paulo-ferraz-oliveira authored Sep 13, 2022
1 parent 7dd0d76 commit 6b2f815
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ jobs:
- elixir-version: 'master'
otp-version: '25'
os: 'ubuntu-20.04'
version-type: 'strict'
- gleam-version: 'nightly'
otp-version: '24'
- gleam-version: '0.23'
Expand Down
4 changes: 2 additions & 2 deletions __tests__/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ async function testElixirVersions() {
let otpVersion

spec = '1.1.x'
otpVersion = 'OTP-23'
expected = 'v1.1.1'
otpVersion = 'OTP-17'
expected = 'v1.1.1-otp-17'
got = await setupBeam.getElixirVersion(spec, otpVersion)
assert.deepStrictEqual(got, expected)

Expand Down
8 changes: 5 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7358,9 +7358,11 @@ async function getElixirVersion(exSpec0, otpVersion) {
`Using Elixir ${elixirVersion} (built for OTP ${otpVersionMajor})`,
)
} else {
// ... and it's not available: fallback to the 'generic' version (v1.4.5 only).
elixirVersionWithOTP = elixirVersion
core.info(`Using Elixir ${elixirVersion}`)
// ... and it's not available: exit with exception
throw new Error(
`Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) not ` +
'found in version list (did you check Compatibility between Elixir and Erlang/OTP?)',
)
}
} else {
throw new Error(
Expand Down
8 changes: 5 additions & 3 deletions src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ async function getElixirVersion(exSpec0, otpVersion) {
`Using Elixir ${elixirVersion} (built for OTP ${otpVersionMajor})`,
)
} else {
// ... and it's not available: fallback to the 'generic' version (v1.4.5 only).
elixirVersionWithOTP = elixirVersion
core.info(`Using Elixir ${elixirVersion}`)
// ... and it's not available: exit with exception
throw new Error(
`Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) not ` +
'found in version list (did you check Compatibility between Elixir and Erlang/OTP?)',
)
}
} else {
throw new Error(
Expand Down

0 comments on commit 6b2f815

Please sign in to comment.