From d8110230de9b4ef8aaf820b58052e26195b05ad4 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Thu, 23 Jul 2020 12:35:18 +0100 Subject: [PATCH] Update ghcup to 0.1.8 and add ghc-8.8.4 support Need to make the apt install function not error whenever it returns a non-zero exit code, because ghc-8.8.4 isn't available via apt just yet --- dist/index.js | 9 ++++++--- src/installer.ts | 7 +++++-- src/versions.json | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6d3f838..2bbacc8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4334,7 +4334,7 @@ function escapeProperty(s) { /***/ 447: /***/ (function(module) { -module.exports = {"ghc":["8.10.1","8.8.3","8.8.2","8.8.1","8.6.5","8.6.4","8.6.3","8.6.2","8.6.1","8.4.4","8.4.3","8.4.2","8.4.1","8.2.2","8.0.2","7.10.3"],"cabal":["3.2.0.0","3.0.0.0","2.4.1.0","2.4.0.0","2.2.0.0"],"stack":["2.3.1","2.1.3","2.1.1","1.9.3","1.9.1","1.7.1","1.6.5","1.6.3","1.6.1","1.5.1","1.5.0","1.4.0","1.3.2","1.3.0","1.2.0"]}; +module.exports = {"ghc":["8.10.1","8.8.4","8.8.3","8.8.2","8.8.1","8.6.5","8.6.4","8.6.3","8.6.2","8.6.1","8.4.4","8.4.3","8.4.2","8.4.1","8.2.2","8.0.2","7.10.3"],"cabal":["3.2.0.0","3.0.0.0","2.4.1.0","2.4.0.0","2.2.0.0"],"stack":["2.3.1","2.1.3","2.1.1","1.9.3","1.9.1","1.7.1","1.6.5","1.6.3","1.6.1","1.5.1","1.5.0","1.4.0","1.3.2","1.3.0","1.2.0"]}; /***/ }), @@ -11095,7 +11095,10 @@ async function apt(tool, version) { const toolName = tool === 'ghc' ? 'ghc' : 'cabal-install'; const v = tool === 'cabal' ? version.slice(0, 3) : version; core.info(`Attempting to install ${toolName} ${v} using apt-get`); - await exec_1.exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`); + // Ignore the return code so we can fall back to ghcup + await exec_1.exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`, undefined, { + ignoreReturnCode: true + }); } async function choco(tool, version) { core.info(`Attempting to install ${tool} ${version} using chocolatey`); @@ -11111,7 +11114,7 @@ async function choco(tool, version) { ]); } async function ghcupBin(os) { - const v = '0.1.5'; + const v = '0.1.8'; const cachedBin = tc.find('ghcup', v); if (cachedBin) return path_1.join(cachedBin, 'ghcup'); diff --git a/src/installer.ts b/src/installer.ts index 3d5967f..d71c42f 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -161,7 +161,10 @@ async function apt(tool: Tool, version: string): Promise { const toolName = tool === 'ghc' ? 'ghc' : 'cabal-install'; const v = tool === 'cabal' ? version.slice(0, 3) : version; core.info(`Attempting to install ${toolName} ${v} using apt-get`); - await exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`); + // Ignore the return code so we can fall back to ghcup + await exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`, undefined, { + ignoreReturnCode: true + }); } async function choco(tool: Tool, version: string): Promise { @@ -180,7 +183,7 @@ async function choco(tool: Tool, version: string): Promise { } async function ghcupBin(os: OS): Promise { - const v = '0.1.5'; + const v = '0.1.8'; const cachedBin = tc.find('ghcup', v); if (cachedBin) return join(cachedBin, 'ghcup'); diff --git a/src/versions.json b/src/versions.json index ecc96dd..f13493c 100644 --- a/src/versions.json +++ b/src/versions.json @@ -1,6 +1,7 @@ { "ghc": [ "8.10.1", + "8.8.4", "8.8.3", "8.8.2", "8.8.1",