2019-09-23 19:56:26 -07:00
|
|
|
import * as core from '@actions/core';
|
2019-09-23 20:07:29 -07:00
|
|
|
import {
|
|
|
|
|
findHaskellGHCVersion,
|
|
|
|
|
findHaskellCabalVersion,
|
|
|
|
|
cacheHaskellTool
|
|
|
|
|
} from './installer';
|
2019-09-23 19:56:26 -07:00
|
|
|
|
2019-09-23 20:32:15 -07:00
|
|
|
const defaultGHCVersion = '8.6.5';
|
|
|
|
|
const defualtCabalVersion = '3.0';
|
|
|
|
|
|
2019-09-23 19:56:26 -07:00
|
|
|
async function run() {
|
|
|
|
|
try {
|
|
|
|
|
await cacheHaskellTool('/opt', 'ghc');
|
|
|
|
|
await cacheHaskellTool('/opt', 'cabal');
|
2019-09-23 20:32:15 -07:00
|
|
|
|
2019-09-23 19:56:26 -07:00
|
|
|
let ghcVersion = core.getInput('ghc-version');
|
2019-09-23 20:32:15 -07:00
|
|
|
if (!ghcVersion) {
|
|
|
|
|
ghcVersion = defaultGHCVersion;
|
|
|
|
|
}
|
2019-09-23 19:56:26 -07:00
|
|
|
await findHaskellGHCVersion(ghcVersion);
|
2019-09-23 20:07:29 -07:00
|
|
|
|
|
|
|
|
let cabalVersion = core.getInput('cabal-version');
|
2019-09-23 20:32:15 -07:00
|
|
|
if (!cabalVersion) {
|
|
|
|
|
cabalVersion = defualtCabalVersion;
|
|
|
|
|
}
|
2019-09-23 20:07:29 -07:00
|
|
|
await findHaskellCabalVersion(cabalVersion);
|
2019-09-23 19:56:26 -07:00
|
|
|
} catch (error) {
|
|
|
|
|
core.setFailed(error.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
run();
|