diff --git a/setup/README.md b/setup/README.md index 055b07ab..7710b8ce 100644 --- a/setup/README.md +++ b/setup/README.md @@ -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) diff --git a/setup/__tests__/find-haskell.test.ts b/setup/__tests__/find-haskell.test.ts index 4f1f023d..acd91933 100644 --- a/setup/__tests__/find-haskell.test.ts +++ b/setup/__tests__/find-haskell.test.ts @@ -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])); }); @@ -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, {