diff --git a/setup/README.md b/setup/README.md index d99b48c1..2c59ba16 100644 --- a/setup/README.md +++ b/setup/README.md @@ -230,9 +230,9 @@ 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)). +or the first entry that matches exactly, +or otherwise the first entry that is a (string-)extension of the requested version extended by a `.`. +E.g., `8.10` will be resolved to `8.10.7`, and so will `8`. **GHC:** @@ -296,6 +296,7 @@ Recommendation: Use the latest available version if possible. **Stack:** (with `enable-stack: true`) - `latest` (default, recommended) +- `2.11.1` `2.11` - `2.9.3` `2.9` - `2.9.1` - `2.7.5` `2.7` diff --git a/setup/__tests__/find-haskell.test.ts b/setup/__tests__/find-haskell.test.ts index acd91933..5aaa396e 100644 --- a/setup/__tests__/find-haskell.test.ts +++ b/setup/__tests__/find-haskell.test.ts @@ -96,13 +96,13 @@ describe('haskell/actions/setup', () => { }); }); - it('Versions resolve as string prefix (resolving 8.1 to 8.10.x should be considered a bug)', () => { + it('Versions resolve as version prefix', () => { 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', + 'ghc-version': '8.10', 'cabal-version': '2' }); forAllTools(t => expect(options[t].resolved).toBe(v[t])); diff --git a/setup/dist/index.js b/setup/dist/index.js index 249ed456..c9dc01bc 100644 --- a/setup/dist/index.js +++ b/setup/dist/index.js @@ -13750,7 +13750,11 @@ function resolve(version, supported, tool, os, verbose // If resolution isn't th ) { const result = version === 'latest' ? supported[0] - : supported.find(v => v.startsWith(version)) ?? version; + : supported.find(v => v === version) ?? + supported.find(v => v.startsWith(version + '.')) ?? + // Andreas, 2023-05-19, issue #248 + // Append "." so that eg stack "2.1" resolves to "2.1.3" and not "2.11.1". + version; // Andreas 2022-12-29, issue #144: inform about resolution here where we can also output ${tool}. if (verbose === true && version !== result) core.info(`Resolved ${tool} ${version} to ${result}`); @@ -14198,7 +14202,7 @@ module.exports = JSON.parse('{"win32":{"ghc":[{"from":"9.4.3","to":"9.4.3.1"},{" /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"ghc":["9.6.1","9.4.5","9.4.4","9.4.3","9.4.2","9.4.1","9.2.7","9.2.6","9.2.5","9.2.4","9.2.3","9.2.2","9.2.1","9.0.2","9.0.1","8.10.7","8.10.6","8.10.5","8.10.4","8.10.3","8.10.2","8.10.1","8.8.4","8.8.3","8.8.2","8.8.1","8.6.5","8.6.4","8.6.3","8.6.2","8.6.1","8.4.4","8.4.3","8.4.2","8.4.1","8.2.2","8.0.2","7.10.3"],"cabal":["3.10.1.0","3.8.1.0","3.6.2.0","3.6.0.0","3.4.1.0","3.4.0.0","3.2.0.0","3.0.0.0","2.4.1.0"],"stack":["2.9.3","2.9.1","2.7.5","2.7.3","2.7.1","2.5.1","2.3.3","2.3.1","2.1.3","2.1.1","1.9.3","1.9.1","1.7.1","1.6.5","1.6.3","1.6.1","1.5.1","1.5.0","1.4.0","1.3.2","1.3.0","1.2.0"],"ghcup":["0.1.19.2"]}'); +module.exports = JSON.parse('{"ghc":["9.6.1","9.4.5","9.4.4","9.4.3","9.4.2","9.4.1","9.2.7","9.2.6","9.2.5","9.2.4","9.2.3","9.2.2","9.2.1","9.0.2","9.0.1","8.10.7","8.10.6","8.10.5","8.10.4","8.10.3","8.10.2","8.10.1","8.8.4","8.8.3","8.8.2","8.8.1","8.6.5","8.6.4","8.6.3","8.6.2","8.6.1","8.4.4","8.4.3","8.4.2","8.4.1","8.2.2","8.0.2","7.10.3"],"cabal":["3.10.1.0","3.8.1.0","3.6.2.0","3.6.0.0","3.4.1.0","3.4.0.0","3.2.0.0","3.0.0.0","2.4.1.0"],"stack":["2.11.1","2.9.3","2.9.1","2.7.5","2.7.3","2.7.1","2.5.1","2.3.3","2.3.1","2.1.3","2.1.1","1.9.3","1.9.1","1.7.1","1.6.5","1.6.3","1.6.1","1.5.1","1.5.0","1.4.0","1.3.2","1.3.0","1.2.0"],"ghcup":["0.1.19.2"]}'); /***/ }) diff --git a/setup/lib/opts.js b/setup/lib/opts.js index 599f4ec0..fb933dec 100644 --- a/setup/lib/opts.js +++ b/setup/lib/opts.js @@ -84,7 +84,11 @@ function resolve(version, supported, tool, os, verbose // If resolution isn't th ) { const result = version === 'latest' ? supported[0] - : supported.find(v => v.startsWith(version)) ?? version; + : supported.find(v => v === version) ?? + supported.find(v => v.startsWith(version + '.')) ?? + // Andreas, 2023-05-19, issue #248 + // Append "." so that eg stack "2.1" resolves to "2.1.3" and not "2.11.1". + version; // Andreas 2022-12-29, issue #144: inform about resolution here where we can also output ${tool}. if (verbose === true && version !== result) core.info(`Resolved ${tool} ${version} to ${result}`); diff --git a/setup/lib/versions.json b/setup/lib/versions.json index 3c621aca..f55c581c 100644 --- a/setup/lib/versions.json +++ b/setup/lib/versions.json @@ -51,6 +51,7 @@ "2.4.1.0" ], "stack": [ + "2.11.1", "2.9.3", "2.9.1", "2.7.5", diff --git a/setup/src/opts.ts b/setup/src/opts.ts index 4fff340c..9fe2dc15 100644 --- a/setup/src/opts.ts +++ b/setup/src/opts.ts @@ -97,7 +97,11 @@ function resolve( const result = version === 'latest' ? supported[0] - : supported.find(v => v.startsWith(version)) ?? version; + : supported.find(v => v === version) ?? + supported.find(v => v.startsWith(version + '.')) ?? + // Andreas, 2023-05-19, issue #248 + // Append "." so that eg stack "2.1" resolves to "2.1.3" and not "2.11.1". + version; // Andreas 2022-12-29, issue #144: inform about resolution here where we can also output ${tool}. if (verbose === true && version !== result) core.info(`Resolved ${tool} ${version} to ${result}`); diff --git a/setup/src/versions.json b/setup/src/versions.json index 419388c5..275b9538 100644 --- a/setup/src/versions.json +++ b/setup/src/versions.json @@ -51,6 +51,7 @@ "2.4.1.0" ], "stack": [ + "2.11.1", "2.9.3", "2.9.1", "2.7.5",