Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit 2215b2c

Browse files
author
Patrick Thomson
authored
Merge pull request #29 from bubba/ghc-8.8.4
Add GHC 8.8.4 and use ghcup-0.1.8
2 parents 01bd6f8 + c2e19a9 commit 2215b2c

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed

dist/index.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4334,7 +4334,7 @@ function escapeProperty(s) {
43344334
/***/ 447:
43354335
/***/ (function(module) {
43364336

4337-
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"]};
4337+
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"]};
43384338

43394339
/***/ }),
43404340

@@ -11095,7 +11095,10 @@ async function apt(tool, version) {
1109511095
const toolName = tool === 'ghc' ? 'ghc' : 'cabal-install';
1109611096
const v = tool === 'cabal' ? version.slice(0, 3) : version;
1109711097
core.info(`Attempting to install ${toolName} ${v} using apt-get`);
11098-
await exec_1.exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`);
11098+
// Ignore the return code so we can fall back to ghcup
11099+
await exec_1.exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`, undefined, {
11100+
ignoreReturnCode: true
11101+
});
1109911102
}
1110011103
async function choco(tool, version) {
1110111104
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
@@ -11108,10 +11111,12 @@ async function choco(tool, version) {
1110811111
'-m',
1110911112
'--no-progress',
1111011113
'-r'
11111-
]);
11114+
], {
11115+
ignoreReturnCode: true
11116+
});
1111211117
}
1111311118
async function ghcupBin(os) {
11114-
const v = '0.1.5';
11119+
const v = '0.1.8';
1111511120
const cachedBin = tc.find('ghcup', v);
1111611121
if (cachedBin)
1111711122
return path_1.join(cachedBin, 'ghcup');
@@ -11122,8 +11127,10 @@ async function ghcupBin(os) {
1112211127
async function ghcup(tool, version, os) {
1112311128
core.info(`Attempting to install ${tool} ${version} using ghcup`);
1112411129
const bin = await ghcupBin(os);
11125-
await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]);
11126-
if (tool === 'ghc')
11130+
const returnCode = await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version], {
11131+
ignoreReturnCode: true
11132+
});
11133+
if (returnCode === 0 && tool === 'ghc')
1112711134
await exec_1.exec(bin, ['set', version]);
1112811135
}
1112911136

src/installer.ts

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,26 +161,35 @@ async function apt(tool: Tool, version: string): Promise<void> {
161161
const toolName = tool === 'ghc' ? 'ghc' : 'cabal-install';
162162
const v = tool === 'cabal' ? version.slice(0, 3) : version;
163163
core.info(`Attempting to install ${toolName} ${v} using apt-get`);
164-
await exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`);
164+
// Ignore the return code so we can fall back to ghcup
165+
await exec(`sudo -- sh -c "apt-get -y install ${toolName}-${v}"`, undefined, {
166+
ignoreReturnCode: true
167+
});
165168
}
166169

167170
async function choco(tool: Tool, version: string): Promise<void> {
168171
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
169172

170-
await exec('powershell', [
171-
'choco',
172-
'install',
173-
tool,
174-
'--version',
175-
version,
176-
'-m',
177-
'--no-progress',
178-
'-r'
179-
]);
173+
await exec(
174+
'powershell',
175+
[
176+
'choco',
177+
'install',
178+
tool,
179+
'--version',
180+
version,
181+
'-m',
182+
'--no-progress',
183+
'-r'
184+
],
185+
{
186+
ignoreReturnCode: true
187+
}
188+
);
180189
}
181190

182191
async function ghcupBin(os: OS): Promise<string> {
183-
const v = '0.1.5';
192+
const v = '0.1.8';
184193
const cachedBin = tc.find('ghcup', v);
185194
if (cachedBin) return join(cachedBin, 'ghcup');
186195

@@ -196,6 +205,12 @@ async function ghcupBin(os: OS): Promise<string> {
196205
async function ghcup(tool: Tool, version: string, os: OS): Promise<void> {
197206
core.info(`Attempting to install ${tool} ${version} using ghcup`);
198207
const bin = await ghcupBin(os);
199-
await exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]);
200-
if (tool === 'ghc') await exec(bin, ['set', version]);
208+
const returnCode = await exec(
209+
bin,
210+
[tool === 'ghc' ? 'install' : 'install-cabal', version],
211+
{
212+
ignoreReturnCode: true
213+
}
214+
);
215+
if (returnCode === 0 && tool === 'ghc') await exec(bin, ['set', version]);
201216
}

src/versions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"ghc": [
33
"8.10.1",
4+
"8.8.4",
45
"8.8.3",
56
"8.8.2",
67
"8.8.1",

0 commit comments

Comments
 (0)