Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Document current resolution of versions (string prefix)
Browse files Browse the repository at this point in the history
See #248
  • Loading branch information
andreasabel committed May 6, 2023
1 parent 1c618fb commit 29c460f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
36 changes: 26 additions & 10 deletions setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,35 @@ In contrast, a proper `boolean` input like `cabal-update` only accepts values `t

## Outputs

| 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 |
| `stack-root` | The path to the stack root (equal to the `STACK_ROOT` environment variable if it is set; otherwise an OS-specific default) | string |
| `ghc-exe` | The path of the ghc _executable_ | string |
| `cabal-exe` | The path of the cabal _executable_ | string |
| `stack-exe` | The path of the stack _executable_ | string |
The action outputs parameters for the components it installed.
E.g. if `ghc-version: 8.10` is requested, the action will output `ghc-version: 8.10.7` if installation succeeded,
according to the version resolution ()[src/versions.json].

| Name | Description | Type |
| --------------- | -------------------------------------------------------------------------------------------------------------------------- | ------ |
| `ghc-version` | The resolved version of `ghc` | string |
| `cabal-version` | The resolved version of `cabal` | string |
| `stack-version` | The resolved version of `stack` | string |
| `ghc-exe` | The path of the `ghc` _executable_ | string |
| `cabal-exe` | The path of the `cabal` _executable_ | string |
| `stack-exe` | The path of the `stack` _executable_ | string |
| `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 |
| `stack-root` | The path to the stack root (equal to the `STACK_ROOT` environment variable if it is set; otherwise an OS-specific default) | string |

## Version Support

This action is conscious about the tool versions specified in [`versions.json`](src/versions.json).
This list is replicated (hopefully correctly) below.

Versions specified by the inputs, e.g. `ghc-version`, are resolved against this list,
by taking the first entry from the list if `latest` is requested,
or the first entry that is a (string-)extension of the requested version otherwise.
E.g., `8.10` will be resolved to `8.10.7`, and so will `8.10.`, `8.` and `8`
(and incorrectly, [even `8.1`](github.com/haskell/actions/issues/248)).

**GHC:**

- `latest` (default)
Expand Down
19 changes: 16 additions & 3 deletions setup/__tests__/find-haskell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ describe('haskell/actions/setup', () => {
});

it('Versions resolve correctly', () => {
const v = {ghc: '8.6.5', cabal: '2.4.1.0', stack: '2.1.3'};
const v = {ghc: '8.6.5', cabal: '3.4.1.0', stack: '1.9.3'};
forAllOS(os => {
const options = getOpts(def(os), os, {
'enable-stack': 'true',
'stack-version': '2.1',
'stack-version': '1',
'ghc-version': '8.6',
'cabal-version': '2.4'
'cabal-version': '3.4'
});
forAllTools(t => expect(options[t].resolved).toBe(v[t]));
});
Expand All @@ -96,6 +96,19 @@ describe('haskell/actions/setup', () => {
});
});

it('Versions resolve as string prefix (resolving 8.1 to 8.10.x should be considered a bug)', () => {
const v = {ghc: '8.10.7', cabal: '2.4.1.0', stack: '2.1.3'};
forAllOS(os => {
const options = getOpts(def(os), os, {
'enable-stack': 'true',
'stack-version': '2.1',
'ghc-version': '8.1',
'cabal-version': '2'
});
forAllTools(t => expect(options[t].resolved).toBe(v[t]));
});
});

it('Enabling stack does not disable GHC or Cabal', () => {
forAllOS(os => {
const {ghc, cabal, stack} = getOpts(def(os), os, {
Expand Down

0 comments on commit 29c460f

Please sign in to comment.