Use ghc/cabal where they are installed (no toolcache)

This commit is contained in:
Timothy Clem
2019-09-30 10:01:13 -07:00
parent d0615c7f8e
commit 11998570ec
3 changed files with 59 additions and 87 deletions

View File

@@ -1,29 +1,25 @@
import * as core from '@actions/core';
import {
findHaskellGHCVersion,
findHaskellCabalVersion,
cacheHaskellTool
} from './installer';
import {findHaskellGHCVersion, findHaskellCabalVersion} from './installer';
// ghc and cabal are installed directly to /opt so use that directlly instead of
// copying over to the toolcache dir.
const baseInstallDir = '/opt';
const defaultGHCVersion = '8.6.5';
const defualtCabalVersion = '3.0';
const defaultCabalVersion = '3.0';
async function run() {
try {
await cacheHaskellTool('/opt', 'ghc');
await cacheHaskellTool('/opt', 'cabal');
let ghcVersion = core.getInput('ghc-version');
if (!ghcVersion) {
ghcVersion = defaultGHCVersion;
}
await findHaskellGHCVersion(ghcVersion);
await findHaskellGHCVersion(baseInstallDir, ghcVersion);
let cabalVersion = core.getInput('cabal-version');
if (!cabalVersion) {
cabalVersion = defualtCabalVersion;
cabalVersion = defaultCabalVersion;
}
await findHaskellCabalVersion(cabalVersion);
await findHaskellCabalVersion(baseInstallDir, cabalVersion);
} catch (error) {
core.setFailed(error.message);
}