Verify Cabal functionality for various installs
This patch adds functionality to * Test cabal build and cabal run in the CI workflow * Test GHC 7.10.3 on Linux and ensures that it works * On Linux, try hvr's PPA before ghcup
This commit is contained in:
22
dist/index.js
vendored
22
dist/index.js
vendored
@@ -8640,21 +8640,33 @@ async function installStack(version) {
|
||||
exports.installStack = installStack;
|
||||
async function installTool(tool, version) {
|
||||
core.startGroup(`Installing ${tool}`);
|
||||
// Currently only linux comes pre-installed with some versions of GHC.
|
||||
// They're intalled to /opt. Let's see if we can save ourselves a download
|
||||
// Linux comes pre-installed with some versions of GHC and supports older
|
||||
// versions through hvr's PPA.
|
||||
if (process.platform === 'linux') {
|
||||
// Cabal is installed to /opt/cabal/x.x but cabal's full version is X.X.Y.Z
|
||||
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
||||
const p = path_1.join('/opt', tool, v, 'bin');
|
||||
const installed = await fs_1.promises
|
||||
.access(p)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (tool === 'ghc' && !installed) {
|
||||
try {
|
||||
// hvr's PPA has better support for GHC < 8.0
|
||||
await exec_1.exec(`sudo -- sh -c "apt-get -y install ghc-${v}"`);
|
||||
}
|
||||
catch {
|
||||
// oh well, we tried
|
||||
}
|
||||
}
|
||||
try {
|
||||
const p = path_1.join('/opt', tool, v, 'bin');
|
||||
await fs_1.promises.access(p);
|
||||
core.debug(`Using pre-installed ${tool} ${version}`);
|
||||
core.addPath(p);
|
||||
core.endGroup();
|
||||
return;
|
||||
}
|
||||
catch {
|
||||
// oh well, we tried
|
||||
// ok, let's try the generic install now
|
||||
}
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
Reference in New Issue
Block a user