Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Merged
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 setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions setup/__tests__/find-haskell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down
8 changes: 6 additions & 2 deletions setup/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion setup/lib/opts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions setup/lib/versions.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion setup/src/opts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
1 change: 1 addition & 0 deletions setup/src/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"2.4.1.0"
],
"stack": [
"2.11.1",
"2.9.3",
"2.9.1",
"2.7.5",
Expand Down