Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ jobs:
| Name | Description | Type |
| ------------- | -------------------------------------------- | ------ |
| `ghc-path` | The path of the ghc executable _directory_ | string |
| `cabal-path` | The path of the cabal executable _directory_ | string |
| `stack-path` | The path of the stack executable _directory_ | string |
| `cabal-store` | The path to the cabal store | string |
| `ghc-exe` | The path of the ghc _executable_ | string |
| `cabal-path` | The path of the cabal executable _directory_ | string |
| `cabal-exe` | The path of the cabal _executable_ | string |
| `cabal-store` | The path to the cabal store | string |
| `stack-path` | The path of the stack executable _directory_ | string |
| `stack-exe` | The path of the stack _executable_ | string |
| `stack-root` | The path to the stack root | string |

## Version Support

Expand Down
14 changes: 8 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ inputs:
outputs:
ghc-path:
description: 'The path of the ghc executable _directory_'
cabal-path:
description: 'The path of the cabal executable _directory_'
stack-path:
description: 'The path of the stack executable _directory_'
cabal-store:
description: 'The path to the cabal store'
ghc-exe:
description: 'The path of the ghc _executable_'
cabal-path:
description: 'The path of the cabal executable _directory_'
cabal-exe:
description: 'The path of the cabal _executable_'
cabal-store:
description: 'The path to the cabal store'
stack-path:
description: 'The path of the stack executable _directory_'
stack-exe:
description: 'The path of the stack _executable_'
stack-root:
description: 'The path to the stack root'
runs:
using: 'node12'
main: 'dist/index.js'
14 changes: 8 additions & 6 deletions dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ inputs:
outputs:
ghc-path:
description: 'The path of the ghc executable _directory_'
cabal-path:
description: 'The path of the cabal executable _directory_'
stack-path:
description: 'The path of the stack executable _directory_'
cabal-store:
description: 'The path to the cabal store'
ghc-exe:
description: 'The path of the ghc _executable_'
cabal-path:
description: 'The path of the cabal executable _directory_'
cabal-exe:
description: 'The path of the cabal _executable_'
cabal-store:
description: 'The path to the cabal store'
stack-path:
description: 'The path of the stack executable _directory_'
stack-exe:
description: 'The path of the stack _executable_'
stack-root:
description: 'The path to the stack root'
runs:
using: 'node12'
main: 'dist/index.js'
10 changes: 9 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8728,7 +8728,15 @@ async function cabalConfig() {
for (const [t, { resolved }] of Object.entries(opts).filter(o => o[1].enable))
await core.group(`Installing ${t} version ${resolved}`, async () => installer_1.installTool(t, resolved, process.platform));
if (opts.stack.setup)
await core.group('Pre-installing GHC with stack', async () => exec_1.exec('stack', ['setup', opts.ghc.resolved]));
await core.group('Pre-installing GHC with stack', async () => {
await exec_1.exec('stack', ['setup', opts.ghc.resolved]);
if (process.platform === 'win32') {
core.setOutput('stack-root', 'C:\\sr');
}
else {
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
}
});
if (opts.cabal.enable)
await core.group('Setting up cabal', async () => {
await exec_1.exec('cabal', ['user-config', 'update'], { silent: true });
Expand Down
12 changes: 9 additions & 3 deletions src/setup-haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ async function cabalConfig(): Promise<string> {
);

if (opts.stack.setup)
await core.group('Pre-installing GHC with stack', async () =>
exec('stack', ['setup', opts.ghc.resolved])
);
await core.group('Pre-installing GHC with stack', async () => {
await exec('stack', ['setup', opts.ghc.resolved]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This codepath isn't executed every time stack is installed. The action first checks to see if the tool already exists, and if so, exits early. The success function in src/installer.ts is responsible for setting this up correctly and is probably the best place to put this logic.

I'm glad this was submitted, though! Walking through the code helped me realize that I had placed some stack specific code beyond the early exit codepath, making it (probably) possible to end up with a windows system without STACK_ROOT set correctly.


if (process.platform === 'win32') {
core.setOutput('stack-root', 'C:\\sr');
} else {
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
}
});

if (opts.cabal.enable)
await core.group('Setting up cabal', async () => {
Expand Down