Files
setup-haskell/src/setup-haskell.ts

40 lines
1013 B
TypeScript
Raw Normal View History

import * as core from '@actions/core';
import {getOpts, getDefaults} from './installer';
import {exec} from '@actions/exec';
(async () => {
try {
const opts = getOpts(getDefaults());
core.info('Preparing to setup a Haskell environment');
core.debug(`Options are: ${JSON.stringify(opts)}`);
for (const [tool, o] of Object.entries(opts)) {
if (o.enable) {
core.info(`Installing ${tool} version ${o.version}`);
await o.install(o.version);
}
2019-09-23 20:32:15 -07:00
}
2019-09-23 20:07:29 -07:00
if (opts.stack.setup) {
core.startGroup('Pre-installing GHC with stack');
await exec('stack', ['setup', opts.ghc.version]);
core.endGroup();
2019-09-23 20:32:15 -07:00
}
2020-03-25 17:29:40 -07:00
if (opts.cabal.enable) {
core.startGroup('Setting up cabal');
await exec('cabal', [
'user-config',
'update',
'-a',
'http-transport: plain-http',
'-v3'
]);
await exec('cabal', ['update']);
core.endGroup();
}
} catch (error) {
core.setFailed(error.message);
}
})();