Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f838c36d | ||
|
|
a5186f2ae5 | ||
|
|
6c40c293ec | ||
|
|
f59ee06298 | ||
|
|
048c299797 | ||
|
|
8c47402eee | ||
|
|
7b9c49b13d | ||
|
|
0ab446a68d | ||
|
|
4cd1e346a4 | ||
|
|
4861e20f66 | ||
|
|
cf5c1bc931 |
17
README.md
17
README.md
@@ -1,5 +1,22 @@
|
|||||||
# setup-haskell
|
# setup-haskell
|
||||||
|
|
||||||
|
**Please note:** This repository is currently unmaintained by a team of developers at GitHub. The
|
||||||
|
repository is here and you can use it as an example, or in Actions. However please be aware that
|
||||||
|
we are not going to be updating issues or pull requests on this repository.
|
||||||
|
|
||||||
|
**Maintained forks:**
|
||||||
|
* [haskell/actions](https://github.com/haskell/actions)
|
||||||
|
|
||||||
|
You could also fork this code and maintain it, if you do please let us know.
|
||||||
|
|
||||||
|
To reflect this state we’ve marked this repository as Archived.
|
||||||
|
|
||||||
|
If you are having an issue or question about GitHub Actions then please [contact customer support](https://help.github.com/en/articles/about-github-actions#contacting-support).
|
||||||
|
|
||||||
|
If you have found a security issue [please submit it here](https://hackerone.com/github).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
[](https://github.com/actions/setup-haskell)
|
[](https://github.com/actions/setup-haskell)
|
||||||
|
|
||||||
This action sets up a Haskell environment for use in actions by:
|
This action sets up a Haskell environment for use in actions by:
|
||||||
|
|||||||
14155
dist/index.js
vendored
14155
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -56,14 +56,7 @@ async function isInstalled(
|
|||||||
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
const v = tool === 'cabal' ? version.slice(0, 3) : version;
|
||||||
const aptPath = `/opt/${tool}/${v}/bin`;
|
const aptPath = `/opt/${tool}/${v}/bin`;
|
||||||
|
|
||||||
const chocoPath = join(
|
const chocoPath = getChocoPath(tool, version);
|
||||||
`${process.env.ChocolateyInstall}`,
|
|
||||||
'lib',
|
|
||||||
`${tool}.${version}`,
|
|
||||||
'tools',
|
|
||||||
`${tool}-${version}`,
|
|
||||||
tool === 'ghc' ? 'bin' : ''
|
|
||||||
);
|
|
||||||
|
|
||||||
const locations = {
|
const locations = {
|
||||||
stack: [], // Always installed into the tool cache
|
stack: [], // Always installed into the tool cache
|
||||||
@@ -169,7 +162,8 @@ async function apt(tool: Tool, version: string): Promise<void> {
|
|||||||
|
|
||||||
async function choco(tool: Tool, version: string): Promise<void> {
|
async function choco(tool: Tool, version: string): Promise<void> {
|
||||||
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
|
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
|
||||||
|
// Choco tries to invoke `add-path` command on earlier versions of ghc, which has been deprecated and fails the step, so disable command execution during this.
|
||||||
|
console.log('::stop-commands::SetupHaskellStopCommands');
|
||||||
await exec(
|
await exec(
|
||||||
'powershell',
|
'powershell',
|
||||||
[
|
[
|
||||||
@@ -186,6 +180,11 @@ async function choco(tool: Tool, version: string): Promise<void> {
|
|||||||
ignoreReturnCode: true
|
ignoreReturnCode: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
console.log('::SetupHaskellStopCommands::'); // Re-enable command execution
|
||||||
|
// Add GHC to path automatically because it does not add until the end of the step and we check the path.
|
||||||
|
if (tool == 'ghc') {
|
||||||
|
core.addPath(getChocoPath(tool, version));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ghcupBin(os: OS): Promise<string> {
|
async function ghcupBin(os: OS): Promise<string> {
|
||||||
@@ -214,3 +213,21 @@ async function ghcup(tool: Tool, version: string, os: OS): Promise<void> {
|
|||||||
);
|
);
|
||||||
if (returnCode === 0 && tool === 'ghc') await exec(bin, ['set', version]);
|
if (returnCode === 0 && tool === 'ghc') await exec(bin, ['set', version]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getChocoPath(tool: Tool, version: string): string {
|
||||||
|
// Manually add the path because it won't happen until the end of the step normally
|
||||||
|
const pathArray = version.split('.');
|
||||||
|
const pathVersion =
|
||||||
|
pathArray.length > 3
|
||||||
|
? pathArray.slice(0, pathArray.length - 1).join('.')
|
||||||
|
: pathArray.join('.');
|
||||||
|
const chocoPath = join(
|
||||||
|
`${process.env.ChocolateyInstall}`,
|
||||||
|
'lib',
|
||||||
|
`${tool}.${version}`,
|
||||||
|
'tools',
|
||||||
|
tool === 'ghc' ? `${tool}-${pathVersion}` : `${tool}-${version}`, // choco trims the ghc version here
|
||||||
|
tool === 'ghc' ? 'bin' : ''
|
||||||
|
);
|
||||||
|
return chocoPath;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user