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

startsWith (string) isn't appropriate for versions #248

Closed
andreasabel opened this issue May 6, 2023 · 5 comments · Fixed by #253
Closed

startsWith (string) isn't appropriate for versions #248

andreasabel opened this issue May 6, 2023 · 5 comments · Fixed by #253
Assignees
Labels
bug Something isn't working re: inputs Concerning handling the inputs to this action
Milestone

Comments

@andreasabel
Copy link
Member

version === 'latest'
? supported[0]
: supported.find(v => v.startsWith(version)) ?? version;

Say the user requests stack-version: 2.1 this will atm resolve to 2.1.3, according to the action's current consciousness about versions:

"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",

However, once we add stack version 2.11.1, requesting 2.1 will resolve to 2.11.1. Ooops!

I suppose the proper ("Haskell") way to fix this to use a datatype for versions rather than mocking around with strings.

@andreasabel andreasabel added bug Something isn't working re: inputs Concerning handling the inputs to this action labels May 6, 2023
@andreasabel andreasabel added this to the 3.0.0 milestone May 6, 2023
andreasabel added a commit to haskell-actions/setup that referenced this issue May 6, 2023
@andreasabel
Copy link
Member Author

@sol Thanks for the pointer! (Which makes me think why I am maintaining another setup action; maybe it is more general by allowing to pick a cabal or stack version, but I am not sure how useful this is; I do need the output cabal-store, though, how do you get the value of this in your workflows?)

You seem to have solved the same problems, and in a nice way; I was thinking of using the https://www.npmjs.com/package/compare-versions library for comparing versions, and maybe also its satisfies function, so that one could also write ghc-version: >= 9.4 etc.

@sol
Copy link
Member

sol commented May 6, 2023

@sol Thanks for the pointer! (Which makes me think why I am maintaining another setup action; maybe it is more general by allowing to pick a cabal or stack version, but I am not sure how useful this is

It's possible to install what you need with ghcup directly (I think @hasufell has made this point elsewhere before).

The main reason why I rolled my own back then was that I needed old versions of GHC that need to be apt installed + that this was notoriously broken here.

That, and the fact that this repo includes multiple actions, which is broken in its own way (not only can't you publish anything to the marketplace, but it also makes it hard to version those actions independently).

the output cabal-store, though, how do you get the value of this in your workflows?

As of now, I do set it manually (https://github.com/sol/hpack/blob/21480fd93c0538bf010bff1bc6d6f9d2f19f8653/.github/workflows/build.yml#L51), which is not ideal.

so that one could also write ghc-version: >= 9.4

Given that the runner images already provide the latest version of GHC (which satisfies constraints of that form), I am puzzled when you would actually need something like this.

@hasufell
Copy link
Member

hasufell commented May 7, 2023

Say the user requests stack-version: 2.1 this will atm resolve to 2.1.3

ghcup install stack 2.9 already works.

@andreasabel
Copy link
Member Author

andreasabel commented May 19, 2023

However, once we add stack version 2.11.1,

Sooner than expected, the calamity strikes us: https://discourse.haskell.org/t/ann-stack-2-11-1/6287

Trying to add stack 2.11.1 breaks the internal testsuite.

    Expected: "2.1.3"
    Received: "2.11.1"

Great to have the testsuite!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working re: inputs Concerning handling the inputs to this action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants