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 7bfeeb6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
9 changes: 9 additions & 0 deletions setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ In contrast, a proper `boolean` input like `cabal-update` only accepts values `t

## 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
1 change: 1 addition & 0 deletions setup/dist/index.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/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/src/opts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function getDefaults(os: OS): Defaults {
}

// E.g. resolve ghc latest to 9.4.2
// resolve ghc 8.1 to 8.10.7 (bug, https://github.com/haskell/actions/issues/248)
function resolve(
version: string,
supported: string[],
Expand Down

0 comments on commit 7bfeeb6

Please sign in to comment.