Install OTP branches

This commit is contained in:
Eric Meadows-Jönsson
2021-01-11 23:43:23 +00:00
parent 3622b49cdd
commit 4edd0cd12d
7 changed files with 668 additions and 30 deletions
+2
View File
@@ -32,6 +32,8 @@ jobs:
# Branches
- otp-version: '22.0'
elixir-version: master
- otp-version: 'master'
elixir-version: '1.11.3'
# Pre-releases
- otp-version: '23.0'
elixir-version: '1.11.0-rc.0'
+19 -15
View File
@@ -3314,9 +3314,10 @@ main().catch(err => {
async function main() {
checkPlatform()
const osVersion = getRunnerOSVersion()
const otpSpec = core.getInput('otp-version', {required: true})
const elixirSpec = core.getInput('elixir-version', {required: true})
const otpVersion = await getOtpVersion(otpSpec)
const otpVersion = await getOtpVersion(otpSpec, osVersion)
const [elixirVersion, otpMajor] = await getElixirVersion(
elixirSpec,
otpVersion
@@ -3328,10 +3329,6 @@ async function main() {
let installRebar = core.getInput('install-rebar')
installRebar = installRebar == null ? 'true' : installRebar
const experimentalOTP = core.getInput('experimental-otp')
const osVersion =
experimentalOTP === 'true' ? getRunnerOSVersion() : 'ubuntu-14.04'
console.log(`##[group]Installing OTP ${otpVersion} - built on ${osVersion}`)
await installOTP(otpVersion, osVersion)
console.log(`##[endgroup]`)
@@ -3359,11 +3356,12 @@ function checkPlatform() {
)
}
async function getOtpVersion(spec) {
return getVersionFromSpec(spec, await getOtpVersions()) || spec
async function getOtpVersion(spec, osVersion) {
const version = getVersionFromSpec(spec, await getOtpVersions(osVersion))
return version ? `OTP-${version}` : spec
}
function getRunnerOSVersion(experimentalOTP) {
function getRunnerOSVersion() {
const mapToUbuntuVersion = {
ubuntu16: 'ubuntu-16.04',
ubuntu18: 'ubuntu-18.04',
@@ -3385,10 +3383,10 @@ async function getElixirVersion(spec, otpVersion) {
const version = getVersionFromSpec(spec, semverVersions)
const gitRef = version ? `v${version}` : spec
const [otpMajor] = otpVersion.match(/^\d+/)
const otpMatch = otpVersion.match(/^OTP-([\.\d]+)/)
if (versions.get(gitRef).includes(otpMajor)) {
return [gitRef, otpMajor]
if (otpMatch != null && versions.get(gitRef).includes(otpMatch[0])) {
return [gitRef, otpMatch[0]]
} else {
return [gitRef, null]
}
@@ -3403,17 +3401,23 @@ function getVersionFromSpec(spec, versions) {
}
}
async function getOtpVersions() {
async function getOtpVersions(osVersion) {
const result = await get(
'https://raw.githubusercontent.com/erlang/otp/master/otp_versions.table'
`https://repo.hex.pm/builds/otp/${osVersion}/builds.txt`
)
return result
.trim()
.split('\n')
.map(line => {
const [_, version] = line.match(/^OTP-([\.\d]+)/)
return version
const match = line.match(/^OTP-([\.\d]+)/)
if (match) {
const [_, version] = match
return version
} else {
return line
}
})
}
+1 -1
View File
@@ -4,7 +4,7 @@ set -eo pipefail
cd $RUNNER_TEMP
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/${2}/OTP-${1}.tar.gz
wget -q -O otp.tar.gz https://repo.hex.pm/builds/otp/${2}/${1}.tar.gz
mkdir -p .setup-elixir/otp
tar zxf otp.tar.gz -C .setup-elixir/otp --strip-components=1
rm otp.tar.gz