mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Test Erlang/OTP 26 + Elixir 1.14 on top Windows (#191)
* Add more stuff to test on * Tweak our debugging (more verbose when the runner is in debug mode) * Hopefully make it easier to debug * Have the distribution work :-) * Adapt to a better reality
This commit is contained in:
committed by
GitHub
parent
61e01a43a5
commit
145c80cf85
@@ -20,6 +20,14 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
combo:
|
combo:
|
||||||
|
- otp-version: '26.0'
|
||||||
|
elixir-version: 'v1.14-otp-25'
|
||||||
|
os: 'ubuntu-latest'
|
||||||
|
version-type: 'strict'
|
||||||
|
- otp-version: '26.0'
|
||||||
|
elixir-version: '1.14.5'
|
||||||
|
os: 'ubuntu-latest'
|
||||||
|
version-type: 'strict'
|
||||||
- otp-version: '25.2'
|
- otp-version: '25.2'
|
||||||
elixir-version: '1.14.3'
|
elixir-version: '1.14.3'
|
||||||
os: 'ubuntu-latest'
|
os: 'ubuntu-latest'
|
||||||
@@ -106,7 +114,7 @@ jobs:
|
|||||||
- elixir-version: '1.10.3'
|
- elixir-version: '1.10.3'
|
||||||
otp-version: '22.3.4.1'
|
otp-version: '22.3.4.1'
|
||||||
os: 'ubuntu-20.04'
|
os: 'ubuntu-20.04'
|
||||||
- elixir-version: 'master'
|
- elixir-version: 'main'
|
||||||
otp-version: '23.1'
|
otp-version: '23.1'
|
||||||
os: 'ubuntu-20.04'
|
os: 'ubuntu-20.04'
|
||||||
- elixir-version: 'main'
|
- elixir-version: 'main'
|
||||||
|
|||||||
@@ -20,6 +20,18 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
combo:
|
combo:
|
||||||
|
- otp-version: '26.0'
|
||||||
|
elixir-version: 'main'
|
||||||
|
os: 'windows-latest'
|
||||||
|
version-type: 'strict'
|
||||||
|
- otp-version: '26.0'
|
||||||
|
elixir-version: 'v1.14-otp-25'
|
||||||
|
os: 'windows-latest'
|
||||||
|
version-type: 'strict'
|
||||||
|
- otp-version: '26.0'
|
||||||
|
elixir-version: '1.14.5'
|
||||||
|
os: 'windows-latest'
|
||||||
|
version-type: 'strict'
|
||||||
- otp-version: '25'
|
- otp-version: '25'
|
||||||
rebar3-version: 'nightly'
|
rebar3-version: 'nightly'
|
||||||
os: 'windows-latest'
|
os: 'windows-latest'
|
||||||
@@ -61,6 +73,7 @@ jobs:
|
|||||||
elixir-version: ${{matrix.combo.elixir-version}}
|
elixir-version: ${{matrix.combo.elixir-version}}
|
||||||
gleam-version: ${{matrix.combo.gleam-version}}
|
gleam-version: ${{matrix.combo.gleam-version}}
|
||||||
rebar3-version: ${{matrix.combo.rebar3-version}}
|
rebar3-version: ${{matrix.combo.rebar3-version}}
|
||||||
|
version-type: ${{matrix.combo.version-type}}
|
||||||
- name: Erlang/OTP version (action)
|
- name: Erlang/OTP version (action)
|
||||||
run: echo "Erlang/OTP ${{steps.setup-beam.outputs.otp-version}}"
|
run: echo "Erlang/OTP ${{steps.setup-beam.outputs.otp-version}}"
|
||||||
- name: Elixir version (action)
|
- name: Elixir version (action)
|
||||||
|
|||||||
Vendored
+78
-18
@@ -9719,6 +9719,9 @@ const os = __nccwpck_require__(2037)
|
|||||||
* @param {string[]} hexMirrors
|
* @param {string[]} hexMirrors
|
||||||
*/
|
*/
|
||||||
async function installOTP(osVersion, otpVersion, hexMirrors) {
|
async function installOTP(osVersion, otpVersion, hexMirrors) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
if (hexMirrors.length === 0) {
|
if (hexMirrors.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not install Erlang/OTP ${otpVersion} from any hex.pm mirror`,
|
`Could not install Erlang/OTP ${otpVersion} from any hex.pm mirror`,
|
||||||
@@ -9743,7 +9746,9 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
cachedPath = await tc.cacheDir(extractPath, 'otp', fullVersion)
|
cachedPath = await tc.cacheDir(extractPath, 'otp', fullVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
await exec(path.join(cachedPath, 'Install'), ['-minimal', cachedPath])
|
cmd = path.join(cachedPath, 'Install')
|
||||||
|
args = ['-minimal', cachedPath]
|
||||||
|
await exec(cmd, args)
|
||||||
|
|
||||||
const otpPath = path.join(cachedPath, 'bin')
|
const otpPath = path.join(cachedPath, 'bin')
|
||||||
|
|
||||||
@@ -9751,7 +9756,9 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
core.exportVariable('INSTALL_DIR_FOR_OTP', cachedPath)
|
core.exportVariable('INSTALL_DIR_FOR_OTP', cachedPath)
|
||||||
|
|
||||||
core.info('Installed Erlang/OTP version')
|
core.info('Installed Erlang/OTP version')
|
||||||
await exec(path.join(otpPath, 'erl'), ['-version'])
|
cmd = path.join(otpPath, 'erl')
|
||||||
|
args = ['-version']
|
||||||
|
await exec(cmd, args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
if (!cachedPath) {
|
if (!cachedPath) {
|
||||||
const exePath = await tc.downloadTool(
|
const exePath = await tc.downloadTool(
|
||||||
@@ -9765,13 +9772,19 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
const otpPath = path.join(otpDir, 'bin')
|
const otpPath = path.join(otpDir, 'bin')
|
||||||
|
|
||||||
await fs.promises.mkdir(otpDir, { recursive: true })
|
await fs.promises.mkdir(otpDir, { recursive: true })
|
||||||
await exec(path.join(cachedPath, 'otp.exe'), ['/S', `/D=${otpDir}`])
|
|
||||||
|
cmd = path.join(cachedPath, 'otp.exe')
|
||||||
|
args = ['/S', `/D=${otpDir}`]
|
||||||
|
await exec(cmd, args)
|
||||||
|
|
||||||
core.addPath(otpPath)
|
core.addPath(otpPath)
|
||||||
core.exportVariable('INSTALL_DIR_FOR_OTP', otpDir)
|
core.exportVariable('INSTALL_DIR_FOR_OTP', otpDir)
|
||||||
|
|
||||||
core.info('Installed Erlang/OTP version')
|
core.info('Installed Erlang/OTP version')
|
||||||
await exec(path.join(otpPath, 'erl'), ['+V'])
|
|
||||||
|
cmd = path.join(otpPath, 'erl.exe')
|
||||||
|
args = ['+V']
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.info(`Install OTP failed for mirror ${hexMirror}`)
|
core.info(`Install OTP failed for mirror ${hexMirror}`)
|
||||||
@@ -9787,6 +9800,10 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
* @param {string[]} hexMirrors
|
* @param {string[]} hexMirrors
|
||||||
*/
|
*/
|
||||||
async function installElixir(elixirVersion, hexMirrors) {
|
async function installElixir(elixirVersion, hexMirrors) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
let options
|
||||||
|
|
||||||
if (hexMirrors.length === 0) {
|
if (hexMirrors.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not install Elixir ${elixirVersion} from any hex.pm mirror`,
|
`Could not install Elixir ${elixirVersion} from any hex.pm mirror`,
|
||||||
@@ -9796,6 +9813,7 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let cachedPath = tc.find('elixir', elixirVersion)
|
let cachedPath = tc.find('elixir', elixirVersion)
|
||||||
|
const OS = process.platform
|
||||||
|
|
||||||
if (!cachedPath) {
|
if (!cachedPath) {
|
||||||
const zipPath = await tc.downloadTool(
|
const zipPath = await tc.downloadTool(
|
||||||
@@ -9813,7 +9831,21 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
core.exportVariable('INSTALL_DIR_FOR_ELIXIR', cachedPath)
|
core.exportVariable('INSTALL_DIR_FOR_ELIXIR', cachedPath)
|
||||||
|
|
||||||
core.info('Installed Elixir version')
|
core.info('Installed Elixir version')
|
||||||
await exec(path.join(elixirPath, 'elixir'), ['-v'])
|
|
||||||
|
if (debugLoggingEnabled()) {
|
||||||
|
core.exportVariable('ELIXIR_CLI_ECHO', 'true')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OS === 'linux') {
|
||||||
|
cmd = path.join(elixirPath, 'elixir')
|
||||||
|
args = ['-v']
|
||||||
|
options = {}
|
||||||
|
} else if (OS === 'win32') {
|
||||||
|
cmd = path.join(elixirPath, 'elixir.bat')
|
||||||
|
args = ['-v']
|
||||||
|
options = { windowsVerbatimArguments: true }
|
||||||
|
}
|
||||||
|
await exec(cmd, args, options)
|
||||||
|
|
||||||
await fs.promises.mkdir(escriptsPath, { recursive: true })
|
await fs.promises.mkdir(escriptsPath, { recursive: true })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -9829,12 +9861,18 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
* @param {string} gleamVersion
|
* @param {string} gleamVersion
|
||||||
*/
|
*/
|
||||||
async function installGleam(gleamVersion) {
|
async function installGleam(gleamVersion) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
const OS = process.platform
|
const OS = process.platform
|
||||||
if (OS === 'linux') {
|
if (OS === 'linux') {
|
||||||
await exec(__nccwpck_require__.ab + "install-gleam.sh", [gleamVersion])
|
cmd = __nccwpck_require__.ab + "install-gleam.sh"
|
||||||
|
args = [gleamVersion]
|
||||||
|
await exec(__nccwpck_require__.ab + "install-gleam.sh", args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
const script = __nccwpck_require__.ab + "install-gleam.ps1"
|
cmd = `pwsh.exe ${path.join(__dirname, 'install-gleam.ps1')}`
|
||||||
await exec(`pwsh.exe ${script} -VSN:${gleamVersion}`)
|
args = [`-VSN:${gleamVersion}`]
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9844,12 +9882,18 @@ async function installGleam(gleamVersion) {
|
|||||||
* @param {string} rebar3Version
|
* @param {string} rebar3Version
|
||||||
*/
|
*/
|
||||||
async function installRebar3(rebar3Version) {
|
async function installRebar3(rebar3Version) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
const OS = process.platform
|
const OS = process.platform
|
||||||
if (OS === 'linux') {
|
if (OS === 'linux') {
|
||||||
await exec(__nccwpck_require__.ab + "install-rebar3.sh", [rebar3Version])
|
cmd = __nccwpck_require__.ab + "install-rebar3.sh"
|
||||||
|
args = [rebar3Version]
|
||||||
|
await exec(__nccwpck_require__.ab + "install-rebar3.sh", args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
const script = __nccwpck_require__.ab + "install-rebar3.ps1"
|
cmd = `pwsh.exe ${path.join(__dirname, 'install-rebar3.ps1')}`
|
||||||
await exec(`pwsh.exe ${script} -VSN:${rebar3Version}`)
|
args = [`-VSN:${rebar3Version}`]
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9861,6 +9905,10 @@ function checkPlatform() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugLoggingEnabled() {
|
||||||
|
return !!process.env.RUNNER_DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
installOTP,
|
installOTP,
|
||||||
installElixir,
|
installElixir,
|
||||||
@@ -10128,7 +10176,6 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
'https://api.github.com/repos/erlang/otp/releases?per_page=100'
|
'https://api.github.com/repos/erlang/otp/releases?per_page=100'
|
||||||
otpVersionsListings = await get(originListing, [1, 2, 3])
|
otpVersionsListings = await get(originListing, [1, 2, 3])
|
||||||
}
|
}
|
||||||
debugLog(`OTP versions listings from ${originListing}`, otpVersionsListings)
|
|
||||||
|
|
||||||
const otpVersions = new Map()
|
const otpVersions = new Map()
|
||||||
|
|
||||||
@@ -10141,6 +10188,7 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
.match(/^([^ ]+)?( .+)/)[1]
|
.match(/^([^ ]+)?( .+)/)[1]
|
||||||
.match(/^([^-]+-)?(.+)$/)
|
.match(/^([^-]+-)?(.+)$/)
|
||||||
const otpVersion = otpMatch[2]
|
const otpVersion = otpMatch[2]
|
||||||
|
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
|
||||||
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
|
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
|
||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
@@ -10152,10 +10200,17 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
.forEach((x) => {
|
.forEach((x) => {
|
||||||
const otpMatch = x.name.match(/^otp_win64_(.*).exe$/)
|
const otpMatch = x.name.match(/^otp_win64_(.*).exe$/)
|
||||||
const otpVersion = otpMatch[1]
|
const otpVersion = otpMatch[1]
|
||||||
|
debugLog('OTP line and parsing', [otpMatch, otpVersion])
|
||||||
otpVersions.set(otpVersion, otpVersion)
|
otpVersions.set(otpVersion, otpVersion)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debugLog(
|
||||||
|
`OTP versions from ${originListing}`,
|
||||||
|
JSON.stringify([...otpVersions.entries()]),
|
||||||
|
)
|
||||||
|
|
||||||
return otpVersions
|
return otpVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10262,7 +10317,7 @@ function maybeCoerced(v) {
|
|||||||
try {
|
try {
|
||||||
ret = semver.coerce(v).version
|
ret = semver.coerce(v).version
|
||||||
} catch {
|
} catch {
|
||||||
// some stuff can't be coerced, like 'master'
|
// some stuff can't be coerced, like 'main'
|
||||||
ret = v
|
ret = v
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10445,11 +10500,16 @@ function jsonParseAsList(maybeJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function debugLog(groupName, message) {
|
function debugLog(groupName, message) {
|
||||||
if (process.env.RUNNER_DEBUG) {
|
const group = `Debugging for ${groupName}`
|
||||||
core.startGroup(`Debugging for ${groupName}`)
|
core.debug(
|
||||||
core.debug(message)
|
'┌──────────────────────────────────────────────────────────────────────────',
|
||||||
core.endGroup()
|
)
|
||||||
}
|
core.debug(`│ ${group} - start`)
|
||||||
|
core.debug(message)
|
||||||
|
core.debug(`│ ${group} - stop`)
|
||||||
|
core.debug(
|
||||||
|
'└──────────────────────────────────────────────────────────────────────────',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
+59
-11
@@ -13,6 +13,9 @@ const os = require('os')
|
|||||||
* @param {string[]} hexMirrors
|
* @param {string[]} hexMirrors
|
||||||
*/
|
*/
|
||||||
async function installOTP(osVersion, otpVersion, hexMirrors) {
|
async function installOTP(osVersion, otpVersion, hexMirrors) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
if (hexMirrors.length === 0) {
|
if (hexMirrors.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not install Erlang/OTP ${otpVersion} from any hex.pm mirror`,
|
`Could not install Erlang/OTP ${otpVersion} from any hex.pm mirror`,
|
||||||
@@ -37,7 +40,9 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
cachedPath = await tc.cacheDir(extractPath, 'otp', fullVersion)
|
cachedPath = await tc.cacheDir(extractPath, 'otp', fullVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
await exec(path.join(cachedPath, 'Install'), ['-minimal', cachedPath])
|
cmd = path.join(cachedPath, 'Install')
|
||||||
|
args = ['-minimal', cachedPath]
|
||||||
|
await exec(cmd, args)
|
||||||
|
|
||||||
const otpPath = path.join(cachedPath, 'bin')
|
const otpPath = path.join(cachedPath, 'bin')
|
||||||
|
|
||||||
@@ -45,7 +50,9 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
core.exportVariable('INSTALL_DIR_FOR_OTP', cachedPath)
|
core.exportVariable('INSTALL_DIR_FOR_OTP', cachedPath)
|
||||||
|
|
||||||
core.info('Installed Erlang/OTP version')
|
core.info('Installed Erlang/OTP version')
|
||||||
await exec(path.join(otpPath, 'erl'), ['-version'])
|
cmd = path.join(otpPath, 'erl')
|
||||||
|
args = ['-version']
|
||||||
|
await exec(cmd, args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
if (!cachedPath) {
|
if (!cachedPath) {
|
||||||
const exePath = await tc.downloadTool(
|
const exePath = await tc.downloadTool(
|
||||||
@@ -59,13 +66,19 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
const otpPath = path.join(otpDir, 'bin')
|
const otpPath = path.join(otpDir, 'bin')
|
||||||
|
|
||||||
await fs.promises.mkdir(otpDir, { recursive: true })
|
await fs.promises.mkdir(otpDir, { recursive: true })
|
||||||
await exec(path.join(cachedPath, 'otp.exe'), ['/S', `/D=${otpDir}`])
|
|
||||||
|
cmd = path.join(cachedPath, 'otp.exe')
|
||||||
|
args = ['/S', `/D=${otpDir}`]
|
||||||
|
await exec(cmd, args)
|
||||||
|
|
||||||
core.addPath(otpPath)
|
core.addPath(otpPath)
|
||||||
core.exportVariable('INSTALL_DIR_FOR_OTP', otpDir)
|
core.exportVariable('INSTALL_DIR_FOR_OTP', otpDir)
|
||||||
|
|
||||||
core.info('Installed Erlang/OTP version')
|
core.info('Installed Erlang/OTP version')
|
||||||
await exec(path.join(otpPath, 'erl'), ['+V'])
|
|
||||||
|
cmd = path.join(otpPath, 'erl.exe')
|
||||||
|
args = ['+V']
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.info(`Install OTP failed for mirror ${hexMirror}`)
|
core.info(`Install OTP failed for mirror ${hexMirror}`)
|
||||||
@@ -81,6 +94,10 @@ async function installOTP(osVersion, otpVersion, hexMirrors) {
|
|||||||
* @param {string[]} hexMirrors
|
* @param {string[]} hexMirrors
|
||||||
*/
|
*/
|
||||||
async function installElixir(elixirVersion, hexMirrors) {
|
async function installElixir(elixirVersion, hexMirrors) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
let options
|
||||||
|
|
||||||
if (hexMirrors.length === 0) {
|
if (hexMirrors.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not install Elixir ${elixirVersion} from any hex.pm mirror`,
|
`Could not install Elixir ${elixirVersion} from any hex.pm mirror`,
|
||||||
@@ -90,6 +107,7 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let cachedPath = tc.find('elixir', elixirVersion)
|
let cachedPath = tc.find('elixir', elixirVersion)
|
||||||
|
const OS = process.platform
|
||||||
|
|
||||||
if (!cachedPath) {
|
if (!cachedPath) {
|
||||||
const zipPath = await tc.downloadTool(
|
const zipPath = await tc.downloadTool(
|
||||||
@@ -107,7 +125,21 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
core.exportVariable('INSTALL_DIR_FOR_ELIXIR', cachedPath)
|
core.exportVariable('INSTALL_DIR_FOR_ELIXIR', cachedPath)
|
||||||
|
|
||||||
core.info('Installed Elixir version')
|
core.info('Installed Elixir version')
|
||||||
await exec(path.join(elixirPath, 'elixir'), ['-v'])
|
|
||||||
|
if (debugLoggingEnabled()) {
|
||||||
|
core.exportVariable('ELIXIR_CLI_ECHO', 'true')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OS === 'linux') {
|
||||||
|
cmd = path.join(elixirPath, 'elixir')
|
||||||
|
args = ['-v']
|
||||||
|
options = {}
|
||||||
|
} else if (OS === 'win32') {
|
||||||
|
cmd = path.join(elixirPath, 'elixir.bat')
|
||||||
|
args = ['-v']
|
||||||
|
options = { windowsVerbatimArguments: true }
|
||||||
|
}
|
||||||
|
await exec(cmd, args, options)
|
||||||
|
|
||||||
await fs.promises.mkdir(escriptsPath, { recursive: true })
|
await fs.promises.mkdir(escriptsPath, { recursive: true })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -123,12 +155,18 @@ async function installElixir(elixirVersion, hexMirrors) {
|
|||||||
* @param {string} gleamVersion
|
* @param {string} gleamVersion
|
||||||
*/
|
*/
|
||||||
async function installGleam(gleamVersion) {
|
async function installGleam(gleamVersion) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
const OS = process.platform
|
const OS = process.platform
|
||||||
if (OS === 'linux') {
|
if (OS === 'linux') {
|
||||||
await exec(path.join(__dirname, 'install-gleam.sh'), [gleamVersion])
|
cmd = path.join(__dirname, 'install-gleam.sh')
|
||||||
|
args = [gleamVersion]
|
||||||
|
await exec(cmd, args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
const script = path.join(__dirname, 'install-gleam.ps1')
|
cmd = `pwsh.exe ${path.join(__dirname, 'install-gleam.ps1')}`
|
||||||
await exec(`pwsh.exe ${script} -VSN:${gleamVersion}`)
|
args = [`-VSN:${gleamVersion}`]
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,12 +176,18 @@ async function installGleam(gleamVersion) {
|
|||||||
* @param {string} rebar3Version
|
* @param {string} rebar3Version
|
||||||
*/
|
*/
|
||||||
async function installRebar3(rebar3Version) {
|
async function installRebar3(rebar3Version) {
|
||||||
|
let cmd
|
||||||
|
let args
|
||||||
|
|
||||||
const OS = process.platform
|
const OS = process.platform
|
||||||
if (OS === 'linux') {
|
if (OS === 'linux') {
|
||||||
await exec(path.join(__dirname, 'install-rebar3.sh'), [rebar3Version])
|
cmd = path.join(__dirname, 'install-rebar3.sh')
|
||||||
|
args = [rebar3Version]
|
||||||
|
await exec(cmd, args)
|
||||||
} else if (OS === 'win32') {
|
} else if (OS === 'win32') {
|
||||||
const script = path.join(__dirname, 'install-rebar3.ps1')
|
cmd = `pwsh.exe ${path.join(__dirname, 'install-rebar3.ps1')}`
|
||||||
await exec(`pwsh.exe ${script} -VSN:${rebar3Version}`)
|
args = [`-VSN:${rebar3Version}`]
|
||||||
|
await exec(cmd, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +199,10 @@ function checkPlatform() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugLoggingEnabled() {
|
||||||
|
return !!process.env.RUNNER_DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
installOTP,
|
installOTP,
|
||||||
installElixir,
|
installElixir,
|
||||||
|
|||||||
+19
-7
@@ -256,7 +256,6 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
'https://api.github.com/repos/erlang/otp/releases?per_page=100'
|
'https://api.github.com/repos/erlang/otp/releases?per_page=100'
|
||||||
otpVersionsListings = await get(originListing, [1, 2, 3])
|
otpVersionsListings = await get(originListing, [1, 2, 3])
|
||||||
}
|
}
|
||||||
debugLog(`OTP versions listings from ${originListing}`, otpVersionsListings)
|
|
||||||
|
|
||||||
const otpVersions = new Map()
|
const otpVersions = new Map()
|
||||||
|
|
||||||
@@ -269,6 +268,7 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
.match(/^([^ ]+)?( .+)/)[1]
|
.match(/^([^ ]+)?( .+)/)[1]
|
||||||
.match(/^([^-]+-)?(.+)$/)
|
.match(/^([^-]+-)?(.+)$/)
|
||||||
const otpVersion = otpMatch[2]
|
const otpVersion = otpMatch[2]
|
||||||
|
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
|
||||||
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
|
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
|
||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
@@ -280,10 +280,17 @@ async function getOTPVersions(osVersion, hexMirrors) {
|
|||||||
.forEach((x) => {
|
.forEach((x) => {
|
||||||
const otpMatch = x.name.match(/^otp_win64_(.*).exe$/)
|
const otpMatch = x.name.match(/^otp_win64_(.*).exe$/)
|
||||||
const otpVersion = otpMatch[1]
|
const otpVersion = otpMatch[1]
|
||||||
|
debugLog('OTP line and parsing', [otpMatch, otpVersion])
|
||||||
otpVersions.set(otpVersion, otpVersion)
|
otpVersions.set(otpVersion, otpVersion)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debugLog(
|
||||||
|
`OTP versions from ${originListing}`,
|
||||||
|
JSON.stringify([...otpVersions.entries()]),
|
||||||
|
)
|
||||||
|
|
||||||
return otpVersions
|
return otpVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +397,7 @@ function maybeCoerced(v) {
|
|||||||
try {
|
try {
|
||||||
ret = semver.coerce(v).version
|
ret = semver.coerce(v).version
|
||||||
} catch {
|
} catch {
|
||||||
// some stuff can't be coerced, like 'master'
|
// some stuff can't be coerced, like 'main'
|
||||||
ret = v
|
ret = v
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,11 +580,16 @@ function jsonParseAsList(maybeJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function debugLog(groupName, message) {
|
function debugLog(groupName, message) {
|
||||||
if (process.env.RUNNER_DEBUG) {
|
const group = `Debugging for ${groupName}`
|
||||||
core.startGroup(`Debugging for ${groupName}`)
|
core.debug(
|
||||||
core.debug(message)
|
'┌──────────────────────────────────────────────────────────────────────────',
|
||||||
core.endGroup()
|
)
|
||||||
}
|
core.debug(`│ ${group} - start`)
|
||||||
|
core.debug(message)
|
||||||
|
core.debug(`│ ${group} - stop`)
|
||||||
|
core.debug(
|
||||||
|
'└──────────────────────────────────────────────────────────────────────────',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
+12
-9
@@ -199,7 +199,7 @@ async function testElixirVersions() {
|
|||||||
|
|
||||||
before = simulateInput('version-type', 'strict')
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '1.14.0'
|
spec = '1.14.0'
|
||||||
otpVersion = 'master'
|
otpVersion = 'main'
|
||||||
expected = 'v1.14.0'
|
expected = 'v1.14.0'
|
||||||
got = await setupBeam.getElixirVersion(spec, otpVersion, hexMirrors)
|
got = await setupBeam.getElixirVersion(spec, otpVersion, hexMirrors)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
@@ -213,6 +213,14 @@ async function testElixirVersions() {
|
|||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
|
spec = 'v1.11.0-rc.0-otp-23'
|
||||||
|
otpVersion = 'OTP-23'
|
||||||
|
expected = 'v1.11.0-rc.0-otp-23'
|
||||||
|
got = await setupBeam.getElixirVersion(spec, otpVersion, hexMirrors)
|
||||||
|
assert.deepStrictEqual(got, expected)
|
||||||
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
before = simulateInput('version-type', 'strict')
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = 'v1.11.0'
|
spec = 'v1.11.0'
|
||||||
otpVersion = '22.3.4.2'
|
otpVersion = '22.3.4.2'
|
||||||
@@ -309,7 +317,7 @@ async function testGetVersionFromSpec() {
|
|||||||
'22.3.4.9.1',
|
'22.3.4.9.1',
|
||||||
'22.3.4.12.1',
|
'22.3.4.12.1',
|
||||||
'22.3.4.10.1',
|
'22.3.4.10.1',
|
||||||
'master',
|
'main',
|
||||||
'v11.11.0-rc.0-otp-23',
|
'v11.11.0-rc.0-otp-23',
|
||||||
'22.3.4.2',
|
'22.3.4.2',
|
||||||
]
|
]
|
||||||
@@ -396,17 +404,12 @@ async function testGetVersionFromSpec() {
|
|||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
before = simulateInput('version-type', 'strict')
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = 'master'
|
spec = 'main'
|
||||||
expected = 'master'
|
expected = 'main'
|
||||||
got = setupBeam.getVersionFromSpec(spec, versions)
|
got = setupBeam.getVersionFromSpec(spec, versions)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
spec = 'master'
|
|
||||||
expected = 'master'
|
|
||||||
got = setupBeam.getVersionFromSpec(spec, versions)
|
|
||||||
assert.deepStrictEqual(got, expected)
|
|
||||||
|
|
||||||
before = simulateInput('version-type', 'strict')
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '22.3.4.2'
|
spec = '22.3.4.2'
|
||||||
expected = '22.3.4.2'
|
expected = '22.3.4.2'
|
||||||
|
|||||||
Reference in New Issue
Block a user