From ac7b7d515b83e752e74d7b78fc759b079b78f5c9 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Mon, 30 May 2022 15:11:49 +0100 Subject: [PATCH] Test on top of Erlang/OTP 25+ (not RC) (#118) * Add Erlang/OTP 25+ (not RC) to tests * Test a specific combo And a strict version * Allow testing "edge" cases We weren't taking our own considerations into account for version strictness We want to be able to test cases where we use -otp- (if the consumer is doing it, at least they have to use _strict_ to assert their decision) --- .github/workflows/ubuntu.yml | 12 +++++++++++- .github/workflows/windows.yml | 2 +- dist/index.js | 13 +++++++------ src/setup-beam.js | 13 +++++++------ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9d69587..eea5709 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,7 +21,17 @@ jobs: fail-fast: false matrix: combo: - - otp-version: '25.0-rc1' + - otp-version: '25.0' + elixir-version: 'v1.13.4-otp-25' + rebar3-version: '3.18.0' + os: 'ubuntu-latest' + version-type: 'strict' + - otp-version: '25.0' + elixir-version: 'v1.13.4' + rebar3-version: '3.18.0' + os: 'ubuntu-latest' + version-type: 'strict' + - otp-version: '25' rebar3-version: 'nightly' os: 'ubuntu-latest' - otp-version: '24' diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index df95bd8..13290c6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: combo: - - otp-version: '25.0-rc1' + - otp-version: '25' rebar3-version: 'nightly' os: 'windows-latest' - otp-version: '24.0.2' diff --git a/dist/index.js b/dist/index.js index ff232af..3a1b1cb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6193,7 +6193,7 @@ async function getOTPVersion(otpSpec0, osVersion) { const otpVersions = await getOTPVersions(osVersion) const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/) let otpVersion - if (otpSpec[1]) { + if (otpSpec[1] && !isStrictVersion()) { throw new Error( `Requested Erlang/OTP version (${otpSpec0}) ` + "should not contain 'OTP-'", @@ -6221,7 +6221,7 @@ async function getElixirVersion(exSpec0, otpVersion) { const exSpec = exSpec0.match(/^v?(.+)(-otp-.+)/) || exSpec0.match(/^v?(.+)/) let elixirVersion - if (exSpec[2]) { + if (exSpec[2] && !isStrictVersion()) { throw new Error( `Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) ` + "should not contain '-otp-...'", @@ -6387,13 +6387,14 @@ async function getRebar3Versions() { return rebar3VersionsListing } +function isStrictVersion() { + return core.getInput('version-type', { required: false }) === 'strict' +} + function getVersionFromSpec(spec, versions) { let version = null - if ( - spec.match(/rc/) || - core.getInput('version-type', { required: false }) === 'strict' - ) { + if (spec.match(/rc/) || isStrictVersion()) { version = spec } diff --git a/src/setup-beam.js b/src/setup-beam.js index e47bc4f..74e1d91 100644 --- a/src/setup-beam.js +++ b/src/setup-beam.js @@ -141,7 +141,7 @@ async function getOTPVersion(otpSpec0, osVersion) { const otpVersions = await getOTPVersions(osVersion) const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/) let otpVersion - if (otpSpec[1]) { + if (otpSpec[1] && !isStrictVersion()) { throw new Error( `Requested Erlang/OTP version (${otpSpec0}) ` + "should not contain 'OTP-'", @@ -169,7 +169,7 @@ async function getElixirVersion(exSpec0, otpVersion) { const exSpec = exSpec0.match(/^v?(.+)(-otp-.+)/) || exSpec0.match(/^v?(.+)/) let elixirVersion - if (exSpec[2]) { + if (exSpec[2] && !isStrictVersion()) { throw new Error( `Requested Elixir / Erlang/OTP version (${exSpec0} / ${otpVersion}) ` + "should not contain '-otp-...'", @@ -335,13 +335,14 @@ async function getRebar3Versions() { return rebar3VersionsListing } +function isStrictVersion() { + return core.getInput('version-type', { required: false }) === 'strict' +} + function getVersionFromSpec(spec, versions) { let version = null - if ( - spec.match(/rc/) || - core.getInput('version-type', { required: false }) === 'strict' - ) { + if (spec.match(/rc/) || isStrictVersion()) { version = spec }