@@ -7120,6 +7120,7 @@ try {
|
7120
|
7120
|
/***/ 2127: |
|
7121
|
7121
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { |
|
7122
|
7122
|
|
|
|
7123
|
+const core = __nccwpck_require__(2186) |
|
7123
|
7124
|
const { exec } = __nccwpck_require__(1514) |
|
7124
|
7125
|
const path = __nccwpck_require__(1017) |
|
7125
|
7126
|
|
@@ -7128,11 +7129,28 @@ const path = __nccwpck_require__(1017)
|
7128
|
7129
|
* |
|
7129
|
7130
|
* @param {string} osVersion |
|
7130
|
7131
|
* @param {string} otpVersion |
|
|
7132
|
+ * @param {string[]} hexMirrors |
|
7131
|
7133
|
*/ |
|
7132
|
|
−async function installOTP(osVersion, otpVersion) { |
|
|
7134
|
+async function installOTP(osVersion, otpVersion, hexMirrors) { |
|
7133
|
7135
|
const OS = process.platform |
|
7134
|
7136
|
if (OS === 'linux') { |
|
7135
|
|
− await exec(__nccwpck_require__.ab + "install-otp.sh", [osVersion, otpVersion]) |
|
|
7137
|
+ if (hexMirrors.length === 0) { |
|
|
7138
|
+ throw new Error( |
|
|
7139
|
+ `Could not install Erlang/OTP ${otpVersion} from any hex.pm mirror`, |
|
|
7140
|
+ ) |
|
|
7141
|
+ } |
|
|
7142
|
+ const [hexMirror, ...hexMirrorsT] = hexMirrors |
|
|
7143
|
+ try { |
|
|
7144
|
+ await exec(__nccwpck_require__.ab + "install-otp.sh", [ |
|
|
7145
|
+ osVersion, |
|
|
7146
|
+ otpVersion, |
|
|
7147
|
+ hexMirror, |
|
|
7148
|
+ ]) |
|
|
7149
|
+ return |
|
|
7150
|
+ } catch (err) { |
|
|
7151
|
+ core.info(`install-otp.sh failed for mirror ${hexMirror}`) |
|
|
7152
|
+ } |
|
|
7153
|
+ await installOTP(osVersion, otpVersion, hexMirrorsT) |
|
7136
|
7154
|
} else if (OS === 'win32') { |
|
7137
|
7155
|
const script = __nccwpck_require__.ab + "install-otp.ps1" |
|
7138
|
7156
|
await exec(`pwsh.exe ${script} -VSN:${otpVersion}`) |
@@ -7143,15 +7161,34 @@ async function installOTP(osVersion, otpVersion) {
|
7143
|
7161
|
* Install Elixir. |
|
7144
|
7162
|
* |
|
7145
|
7163
|
* @param {string} elixirVersion |
|
|
7164
|
+ * @param {string[]} hexMirrors |
|
7146
|
7165
|
*/ |
|
7147
|
|
−async function installElixir(elixirVersion) { |
|
|
7166
|
+async function installElixir(elixirVersion, hexMirrors) { |
|
|
7167
|
+ if (hexMirrors.length === 0) { |
|
|
7168
|
+ throw new Error( |
|
|
7169
|
+ `Could not install Elixir ${elixirVersion} from any hex.pm mirror`, |
|
|
7170
|
+ ) |
|
|
7171
|
+ } |
|
|
7172
|
+ const [hexMirror, ...hexMirrorsT] = hexMirrors |
|
7148
|
7173
|
const OS = process.platform |
|
7149
|
|
− if (OS === 'linux') { |
|
7150
|
|
− await exec(__nccwpck_require__.ab + "install-elixir.sh", [elixirVersion]) |
|
7151
|
|
− } else if (OS === 'win32') { |
|
7152
|
|
− const script = __nccwpck_require__.ab + "install-elixir.ps1" |
|
7153
|
|
− await exec(`pwsh.exe ${script} -VSN:${elixirVersion}`) |
|
|
7174
|
+ let script |
|
|
7175
|
+ try { |
|
|
7176
|
+ if (OS === 'linux') { |
|
|
7177
|
+ script = __nccwpck_require__.ab + "install-elixir.sh" |
|
|
7178
|
+ await exec(__nccwpck_require__.ab + "install-elixir.sh", [elixirVersion, hexMirror]) |
|
|
7179
|
+ return |
|
|
7180
|
+ } |
|
|
7181
|
+ if (OS === 'win32') { |
|
|
7182
|
+ script = __nccwpck_require__.ab + "install-elixir.ps1" |
|
|
7183
|
+ await exec( |
|
|
7184
|
+ `pwsh.exe ${script} -VSN:${elixirVersion} -HEX_MIRROR:${hexMirror}`, |
|
|
7185
|
+ ) |
|
|
7186
|
+ return |
|
|
7187
|
+ } |
|
|
7188
|
+ } catch (err) { |
|
|
7189
|
+ core.info(`${script} failed for mirror ${hexMirror}`) |
|
7154
|
7190
|
} |
|
|
7191
|
+ await installElixir(elixirVersion, hexMirrorsT) |
|
7155
|
7192
|
} |
|
7156
|
7193
|
|
|
7157
|
7194
|
/** |
@@ -7238,16 +7275,23 @@ async function main() {
|
7238
|
7275
|
const elixirSpec = getInput('elixir-version', false, 'elixir', versions) |
|
7239
|
7276
|
const gleamSpec = getInput('gleam-version', false, 'gleam', versions) |
|
7240
|
7277
|
const rebar3Spec = getInput('rebar3-version', false, 'rebar', versions) |
|
|
7278
|
+ const hexMirrors = core.getMultilineInput('hexpm-mirrors', { |
|
|
7279
|
+ required: false, |
|
|
7280
|
+ }) |
|
7241
|
7281
|
|
|
7242
|
7282
|
if (otpSpec !== 'false') { |
|
7243
|
|
− await installOTP(otpSpec, osVersion) |
|
7244
|
|
− const elixirInstalled = await maybeInstallElixir(elixirSpec, otpSpec) |
|
|
7283
|
+ await installOTP(otpSpec, osVersion, hexMirrors) |
|
|
7284
|
+ const elixirInstalled = await maybeInstallElixir( |
|
|
7285
|
+ elixirSpec, |
|
|
7286
|
+ otpSpec, |
|
|
7287
|
+ hexMirrors, |
|
|
7288
|
+ ) |
|
7245
|
7289
|
|
|
7246
|
7290
|
if (elixirInstalled === true) { |
|
7247
|
7291
|
const shouldMixRebar = getInput('install-rebar', false) |
|
7248
|
|
− await mix(shouldMixRebar, 'rebar') |
|
|
7292
|
+ await mix(shouldMixRebar, 'rebar', hexMirrors) |
|
7249
|
7293
|
const shouldMixHex = getInput('install-hex', false) |
|
7250
|
|
− await mix(shouldMixHex, 'hex') |
|
|
7294
|
+ await mix(shouldMixHex, 'hex', hexMirrors) |
|
7251
|
7295
|
} |
|
7252
|
7296
|
} else if (!gleamSpec) { |
|
7253
|
7297
|
throw new Error('otp-version=false is only available when installing Gleam') |
@@ -7257,12 +7301,12 @@ async function main() {
|
7257
|
7301
|
await maybeInstallRebar3(rebar3Spec) |
|
7258
|
7302
|
} |
|
7259
|
7303
|
|
|
7260
|
|
−async function installOTP(otpSpec, osVersion) { |
|
7261
|
|
− const otpVersion = await getOTPVersion(otpSpec, osVersion) |
|
|
7304
|
+async function installOTP(otpSpec, osVersion, hexMirrors) { |
|
|
7305
|
+ const otpVersion = await getOTPVersion(otpSpec, osVersion, hexMirrors) |
|
7262
|
7306
|
console.log( |
|
7263
|
7307
|
`##[group]Installing Erlang/OTP ${otpVersion} - built on ${osVersion}`, |
|
7264
|
7308
|
) |
|
7265
|
|
− await installer.installOTP(osVersion, otpVersion) |
|
|
7309
|
+ await installer.installOTP(osVersion, otpVersion, hexMirrors) |
|
7266
|
7310
|
core.setOutput('otp-version', otpVersion) |
|
7267
|
7311
|
core.addPath(`${process.env.RUNNER_TEMP}/.setup-beam/otp/bin`) |
|
7268
|
7312
|
console.log('##[endgroup]') |
@@ -7270,13 +7314,17 @@ async function installOTP(otpSpec, osVersion) {
|
7270
|
7314
|
return otpVersion |
|
7271
|
7315
|
} |
|
7272
|
7316
|
|
|
7273
|
|
−async function maybeInstallElixir(elixirSpec, otpVersion) { |
|
|
7317
|
+async function maybeInstallElixir(elixirSpec, otpSpec, hexMirrors) { |
|
7274
|
7318
|
let installed = false |
|
7275
|
7319
|
|
|
7276
|
7320
|
if (elixirSpec) { |
|
7277
|
|
− const elixirVersion = await getElixirVersion(elixirSpec, otpVersion) |
|
|
7321
|
+ const elixirVersion = await getElixirVersion( |
|
|
7322
|
+ elixirSpec, |
|
|
7323
|
+ otpSpec, |
|
|
7324
|
+ hexMirrors, |
|
|
7325
|
+ ) |
|
7278
|
7326
|
console.log(`##[group]Installing Elixir ${elixirVersion}`) |
|
7279
|
|
− await installer.installElixir(elixirVersion) |
|
|
7327
|
+ await installer.installElixir(elixirVersion, hexMirrors) |
|
7280
|
7328
|
core.setOutput('elixir-version', elixirVersion) |
|
7281
|
7329
|
const disableProblemMatchers = getInput('disable_problem_matchers', false) |
|
7282
|
7330
|
if (disableProblemMatchers === 'false') { |
@@ -7295,12 +7343,28 @@ async function maybeInstallElixir(elixirSpec, otpVersion) {
|
7295
|
7343
|
return installed |
|
7296
|
7344
|
} |
|
7297
|
7345
|
|
|
7298
|
|
−async function mix(shouldMix, what) { |
|
|
7346
|
+async function mixWithMirrors(cmd, args, hexMirrors) { |
|
|
7347
|
+ if (hexMirrors.length === 0) { |
|
|
7348
|
+ throw new Error('mix failed with every mirror') |
|
|
7349
|
+ } |
|
|
7350
|
+ const [hexMirror, ...hexMirrorsT] = hexMirrors |
|
|
7351
|
+ process.env.HEX_MIRROR = hexMirror |
|
|
7352
|
+ try { |
|
|
7353
|
+ return await exec(cmd, args) |
|
|
7354
|
+ } catch (err) { |
|
|
7355
|
+ core.info( |
|
|
7356
|
+ `mix failed with mirror ${process.env.HEX_MIRROR} with message ${err.message})`, |
|
|
7357
|
+ ) |
|
|
7358
|
+ } |
|
|
7359
|
+ return mixWithMirrors(cmd, args, hexMirrorsT) |
|
|
7360
|
+} |
|
|
7361
|
+ |
|
|
7362
|
+async function mix(shouldMix, what, hexMirrors) { |
|
7299
|
7363
|
if (shouldMix === 'true') { |
|
7300
|
7364
|
const cmd = 'mix' |
|
7301
|
7365
|
const args = [`local.${what}`, '--force'] |
|
7302
|
7366
|
console.log(`##[group]Running ${cmd} ${args}`) |
|
7303
|
|
− await exec(cmd, args) |
|
|
7367
|
+ await mixWithMirrors(cmd, args, hexMirrors) |
|
7304
|
7368
|
console.log('##[endgroup]') |
|
7305
|
7369
|
} |
|
7306
|
7370
|
} |
@@ -7344,8 +7408,8 @@ async function maybeInstallRebar3(rebar3Spec) {
|
7344
|
7408
|
return installed |
|
7345
|
7409
|
} |
|
7346
|
7410
|
|
|
7347
|
|
−async function getOTPVersion(otpSpec0, osVersion) { |
|
7348
|
|
− const otpVersions = await getOTPVersions(osVersion) |
|
|
7411
|
+async function getOTPVersion(otpSpec0, osVersion, hexMirrors) { |
|
|
7412
|
+ const otpVersions = await getOTPVersions(osVersion, hexMirrors) |
|
7349
|
7413
|
let otpSpec = otpSpec0 // might be a branch (?) |
|
7350
|
7414
|
const otpVersion = getVersionFromSpec( |
|
7351
|
7415
|
otpSpec, |
@@ -7364,10 +7428,10 @@ async function getOTPVersion(otpSpec0, osVersion) {
|
7364
|
7428
|
return otpVersions.get(otpVersion) // from the reference, for download |
|
7365
|
7429
|
} |
|
7366
|
7430
|
|
|
7367
|
|
−async function getElixirVersion(exSpec0, otpVersion0) { |
|
|
7431
|
+async function getElixirVersion(exSpec0, otpVersion0, hexMirrors) { |
|
7368
|
7432
|
const otpVersion = otpVersion0.match(/^([^-]+-)?(.+)$/)[2] |
|
7369
|
7433
|
const otpVersionMajor = otpVersion.match(/^([^.]+).*$/)[1] |
|
7370
|
|
− const elixirVersions = await getElixirVersions() |
|
|
7434
|
+ const elixirVersions = await getElixirVersions(hexMirrors) |
|
7371
|
7435
|
const semverVersions = Array.from(elixirVersions.keys()).sort() |
|
7372
|
7436
|
const exSpec = exSpec0.replace(/-otp-.*$/, '') |
|
7373
|
7437
|
const elixirVersionFromSpec = getVersionFromSpec(exSpec, semverVersions, true) |
@@ -7427,19 +7491,19 @@ async function getRebar3Version(r3Spec) {
|
7427
|
7491
|
return rebar3Version |
|
7428
|
7492
|
} |
|
7429
|
7493
|
|
|
7430
|
|
−async function getOTPVersions(osVersion) { |
|
7431
|
|
− let originListing |
|
7432
|
|
− let pageIdxs |
|
|
7494
|
+async function getOTPVersions(osVersion, hexMirrors) { |
|
|
7495
|
+ let otpVersionsListings |
|
7433
|
7496
|
if (process.platform === 'linux') { |
|
7434
|
|
− originListing = `https://builds.hex.pm/builds/otp/${osVersion}/builds.txt` |
|
7435
|
|
− pageIdxs = [null] |
|
|
7497
|
+ otpVersionsListings = await getWithMirrors( |
|
|
7498
|
+ `/builds/otp/${osVersion}/builds.txt`, |
|
|
7499
|
+ hexMirrors, |
|
|
7500
|
+ ) |
|
7436
|
7501
|
} else if (process.platform === 'win32') { |
|
7437
|
|
− originListing = |
|
|
7502
|
+ const originListing = |
|
7438
|
7503
|
'https://api.github.com/repos/erlang/otp/releases?per_page=100' |
|
7439
|
|
− pageIdxs = [1, 2, 3] |
|
|
7504
|
+ otpVersionsListings = await get(originListing, [1, 2, 3]) |
|
7440
|
7505
|
} |
|
7441
|
7506
|
|
|
7442
|
|
− const otpVersionsListings = await get(originListing, pageIdxs) |
|
7443
|
7507
|
const otpVersions = new Map() |
|
7444
|
7508
|
|
|
7445
|
7509
|
if (process.platform === 'linux') { |
@@ -7469,10 +7533,10 @@ async function getOTPVersions(osVersion) {
|
7469
|
7533
|
return otpVersions |
|
7470
|
7534
|
} |
|
7471
|
7535
|
|
|
7472
|
|
−async function getElixirVersions() { |
|
7473
|
|
− const elixirVersionsListings = await get( |
|
7474
|
|
− 'https://builds.hex.pm/builds/elixir/builds.txt', |
|
7475
|
|
− [null], |
|
|
7536
|
+async function getElixirVersions(hexMirrors) { |
|
|
7537
|
+ const elixirVersionsListings = await getWithMirrors( |
|
|
7538
|
+ '/builds/elixir/builds.txt', |
|
|
7539
|
+ hexMirrors, |
|
7476
|
7540
|
) |
|
7477
|
7541
|
const otpVersionsForElixirMap = new Map() |
|
7478
|
7542
|
|
@@ -7656,6 +7720,19 @@ async function get(url0, pageIdxs) {
|
7656
|
7720
|
return Promise.all(pageIdxs.map(getPage)) |
|
7657
|
7721
|
} |
|
7658
|
7722
|
|
|
|
7723
|
+async function getWithMirrors(resourcePath, hexMirrors) { |
|
|
7724
|
+ if (hexMirrors.length === 0) { |
|
|
7725
|
+ throw new Error(`Could not fetch ${resourcePath} from any hex.pm mirror`) |
|
|
7726
|
+ } |
|
|
7727
|
+ const [hexMirror, ...hexMirrorsT] = hexMirrors |
|
|
7728
|
+ try { |
|
|
7729
|
+ return await get(`${hexMirror}${resourcePath}`, [null]) |
|
|
7730
|
+ } catch (err) { |
|
|
7731
|
+ core.info(`get failed for URL ${hexMirror}${resourcePath}`) |
|
|
7732
|
+ } |
|
|
7733
|
+ return getWithMirrors(resourcePath, hexMirrorsT) |
|
|
7734
|
+} |
|
|
7735
|
+ |
|
7659
|
7736
|
function maybePrependWithV(v) { |
|
7660
|
7737
|
if (isVersion(v)) { |
|
7661
|
7738
|
return `v${v.replace('v', '')}` |