Add Windows and macOS Support (#1)

* Re-base onto upstream master

* Use os over operating-system per json schema suggestion

* Upgrade dependencies

* Update action.yml syntax

* Restructure repo on latest typescript-action

* Update workflow.yml to use same node version as action.yml

* Pull in improvements from open PRs. Fix package.json scripts

* Type function return arguments

* Don't eslint automatic formatting changes

* Initial implementation of ghc+cabal install for linux/mac/windows

* Update README

* Fix cabal version in action.yml

* Implement initial simplistic test suite

* Test action with CI

* Use chocolatey directly to install ghc and cabal

* Try pre-installed tool on linux first

* Clean up documentation

* Expand README

* Test super old GHC on ubuntu

* Implement support for stack

* Update documentation about Stack support

* Test stack install in Github Actions CI

authored-by: Jared Weakly <jweakly@galois.com>
This commit is contained in:
jared-w
2020-03-23 11:18:29 -07:00
committed by Jared Weakly
parent a6006d2c28
commit 8154472447
195 changed files with 12947 additions and 15942 deletions

View File

@@ -1,28 +1,26 @@
import * as core from '@actions/core';
import {findHaskellGHCVersion, findHaskellCabalVersion} from './installer';
import {getOpts, getDefaults} from './installer';
import {exec} from '@actions/exec';
// 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 defaultCabalVersion = '3.0';
async function run() {
(async () => {
try {
let ghcVersion = core.getInput('ghc-version');
if (!ghcVersion) {
ghcVersion = defaultGHCVersion;
}
findHaskellGHCVersion(baseInstallDir, ghcVersion);
const opts = getOpts(getDefaults());
core.info('Preparing to setup a Haskell environment');
core.debug(`Options are: ${JSON.stringify(opts)}`);
let cabalVersion = core.getInput('cabal-version');
if (!cabalVersion) {
cabalVersion = defaultCabalVersion;
for (const [tool, o] of Object.entries(opts)) {
if (o.enable) {
core.info(`Installing ${tool} version ${o.version}`);
await o.install(o.version);
}
}
if (opts.stack.setup) {
core.startGroup('Pre-installing GHC with stack');
await exec('stack', ['setup', opts.ghc.version]);
core.endGroup();
}
findHaskellCabalVersion(baseInstallDir, cabalVersion);
} catch (error) {
core.setFailed(error.message);
}
}
run();
})();