8000 Add support for latest release by JanEricNitschke · Pull Request #323 · erlef/setup-beam · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for latest release #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JanEricNitschke
Copy link

Description

I added an additional version specifier of stable, that works just like latest except that it ignores RC versions.

Another way to do this is to directly adjust latest to also ignore those, but the tests are currently very explicit about RCs being favoured over previous stable versions so i opted for this approach.

Closes #<issue>.

@JanEricNitschke
Copy link
Author

Couldnt get the tests running locally despite setting the GITHUB_TOKEN, not sure whats wrong there

> test
> node test/setup-beam.test.js

::error::Tried to map a target OS from env. variable 'ImageOS' (got undefined), but failed. If you're using a self-hosted runner, you should set 'env': 'ImageOS': ... to one of the following: ['ubuntu18', 'ubuntu20', 'ubuntu22', 'ubuntu24', 'win19', '
win22']
::debug::Error fetching from https://api.github.com/repos/erlang/otp/releases?per_page=100&page=2: Error: Unauthorized
::debug::Error during fetch. Retrying in 2000ms
::debug::Error fetching from https://api.github.com/repos/erlang/otp/releases?per_page=100&page=1: Error: Unauthorized
::debug::Error during fetch. Retrying in 2000ms

@wojtekmach
Copy link
Collaborator

Id change the meaning of “latest” to “stable”, ie not introduce a new concept.

GitHub releases can be marked as latest, eg:

https://api.github.com/repos/erlang/otp/releases/latest

and I think it is useful to maintain parity with that.

this would remove ability to get latest published RC, as it works right now, but honestly I’m not sure if it is that useful. If people want to test against the bleeding edge they probably should test against main branch anyway.

curious what others think!

@starbelly
Copy link
Member

Id change the meaning of “latest” to “stable”, ie not introduce a new concept.

GitHub releases can be marked as latest, eg:

https://api.github.com/repos/erlang/otp/releases/latest

and I think it is useful to maintain parity with that.

this would remove ability to get latest published RC, as it works right now, but honestly I’m not sure if it is that useful. If people want to test against the bleeding edge they probably should test against main branch anyway.

curious what others think!

I fully agree with this. Maybe latest-stable?

@JanEricNitschke
Copy link
Author

So just rename what is currently latest to latest-stable and have it have the functionality if what i introduced as stable?

Because neither versions exactly match the GH release that is marked as latest, as per the readme entry for the current latest.

@christhekeele
Copy link

this would remove ability to get latest published RC, as it works right now, but honestly I’m not sure if it is that useful. If people want to test against the bleeding edge they probably should test against main branch anyway.

curious what others think!

My 2 🪙, I find this behaviour useful, though not a common case. I have a library that uses private Elixir compiler internals, and I test against edge Elixir to get ahead of breaking changes. Right now I use master, but my preference would be to just run on RCs, to ignore false positives that a breakage is coming, so it is useful to me.

Only started looking into changing over to RCs today, but will hold off until a decision is made here. 🙂

@starbelly
Copy link
Member

So just rename what is currently latest to latest-stable and have it have the functionality if what i introduced as stable?

Yeah, it's a bit tricky, there's ambiguity in both terms, which led to this to begin with. I suppose it comes down to expectations, which is also why I suggested perhaps latest (current behavior) and latest-stable or just stable. Just stable on its own is a bit more ambiguous, but we shouldn't aim for perfection either.

Would like to hear what people think of that.

@christhekeele
Copy link
christhekeele commented Mar 26, 2025

To me, "latest" means latest release, which stands in contrast to a pre-release/release candidate—which is definitively not a release, so should not be in the "latest release" category. So using both "stable" and "latest" would be confusing to me in this context.

My vote would be for a "stable" vs "edge" dichotomy, each a different classification of latest release. We could soft-deprecated "latest" and keep its current behaviour, until a cut-off date/version.

@JanEricNitschke
Copy link
Author

I think "stable" and "edge" make sense to me. The most important part should be that they are properly documented.

@JanEricNitschke JanEricNitschke force-pushed the main branch 2 times, most recently from 625f243 to 77fe764 Compare April 5, 2025 08:48
@JanEricNitschke
Copy link
Author

I have now made it so that edge works like the current latest and specified that as the main way that this should be used in the readme, although latest is still an (deprecated) alias for that, as noted in the readme.

@starbelly
Copy link
Member

I think I'm good on stable and edge. I'd like to hear what @wojtekmach thinks.

@JanEricNitschke
Copy link
Author

Fixed the main error from the CI

@JanEricNitschke
Copy link
Author
JanEricNitschke commented Apr 5, 2025

Not sure about the failure of ubuntu / OTP 27, Elixir , Gleam 1.5.1, rebar3 that seems to be unrelated to my changed.

The unit test failure changes i assume come from this test case, but i dont quite know where exactly.

And unfortunately i couldnt get the tests running locally, so i cant easily debug this

@JanEricNitschke
Copy link
Author

Ok, i fixed the first issue with the object, which was just that i had stable and edge missing in the isValidVersion regex. However now i am running into issues that isRC is not working correctly with things like OTP-27.0-rc1 because it requires the actual version pattern to start at the beginning of the string.

Unfortunately i am not sure if i can just remove that requirement?

@paulo-ferraz-oliveira
Copy link
Collaborator

I'd still like to have the ability to test "edge" (e.g. not deprecating it as the PR suggests). Whatever naming comes out of it (parity with other resources, e.g. GitHub, as @wojtekmach mentions, is Ok, but we can also build on top of it).

So, whether it's latest, stable, latest-stable, edge, my expectations would be:

  1. if we're to break current behaviour, it should be signalled in a MIGRATION document (or the README itself) and bump the action to 2.x
  2. if we're to keep current behaviour, but extend it, documentation should reflect the new names appropriately (as the PR hints at)
  3. it'd be nice to have a stable channel on testing updates to upcoming versions (it's not the same testing an RC as it is testing master, since -rc comes from a different branch)

@JanEricNitschke
Copy link
Author

@paulo-ferraz-oliveira

The current idea for the PR is to add a stable tag that works exactly like the current latest but ignores RCs.

Also an alias for the current latest is added as edge while the original latest is deprecated. It would be to be removed at some point while keeping just edge with the same functionality.

@wojtekmach
Copy link
Collaborator
wojtekmach commented Apr 7, 2025

I don't have a strong opinion but I'm not 100% sold on "edge" meaning "latest published released including RCs". I mean, it can mean anything and be documented as such, but my immediate association would be with nightly builds, the bleeding edge, way more unstable than an RC.

@paulo-ferraz-oliveira mentioned in the ticket:

we could update the existing latest to not take -rc into account (I can't remember the details of the initial requirement for that, but it's in the Issues' section, for sure). We could have e.g. latest and latest-rc, because "rc" also seems like a good candidate for testing every now and then.

A big +1 for latest and latest-rc from me. I think it's immediately obvious what's what. It's not ideal to change the meaning of latest but I really think that's what people expect of that value and I'm not sure it's worth to go through deprecation period just to end up with the same value anyway.

@JanEricNitschke
Copy link
Author

I am completely impartial to the naming and how you want the readme entry to look. I only care that there is the functionality o get the latest non-RC version

@paulo-ferraz-oliveira
Copy link
Collaborator

I agree with @wojtekmach. latest and latest-rc are more explicit, even if that means a seemingly breaking change. But we can deal with versioning later. We can consider it a fix, too, since we're now updating the README...

@JanEricNitschke
Copy link
Author

So change the current (as in for this PR) latest/edge to latest-rc and the current stable to latest. Anything else i should change?

@paulo-ferraz-oliveira
Copy link
Collaborator

I'm good with those, for the time being. I'll let others pitch in, too, though.

@wojtekmach
Copy link
Collaborator
wojtekmach commented Apr 13, 2025 8000

+1 from me!

@JanEricNitschke
Copy link
Author
JanEricNitschke commented Apr 13, 2025

Done, hopefully i didnt mess anything up in the rename, but tests did pass locally.

@Schultzer
Copy link
Contributor
Schultzer commented Apr 23, 2025

As I wrote this feature initially, then I would consider not returning rc in latest a breaking change.

However, I still don’t understand what the issue is with breaking actions. As this was specifically developed with the intention of something breaking rather that be somewhere in cldr or any other place.
Even Ubuntu latest is breaking OTP. So there is precedent and IMO you should expect things might not work in the future. #318

I do see the benefit in getting the most recent major version. Today it is already possible to retrieve the latest minor and patch releases by only setting the major version. So there might be an opportunity to leverage that to set a minimum major version e.g +27

@paulo-ferraz-oliveira
Copy link
Collaborator
paulo-ferraz-oliveira commented Apr 23, 2025

I think that, even if it can be considered breaking, this comment by @wojtekmach supports our decision to have latest not include -rc:

https://api.github.com/repos/erlang/otp/releases/latest

and I think it is useful to maintain parity with that.

For Erlang/OTP latest is 27.x, not 28.x (as still -rc, atm).

Edit: later, @Schultzer clarified, and well, that it's not just Erlang/OTP that takes that input, so the parity argument loses some relevance.

Where we discussed this initially I asked "And would we consider release candidates?", and your reply was "RC is welcome but unnecessary"; it seems to us that having it clearer as latest-rc make for less confusion.

@Schultzer
Copy link
Contributor

I think that, even if it can be considered breaking, this comment by @wojtekmach supports our decision to have latest not include -rc:

https://api.github.com/repos/erlang/otp/releases/latest

and I think it is useful to maintain parity with that.

For Erlang/OTP latest is 27.x, not 28.x (as still -rc, atm).

Where we discussed this initially I asked "And would we consider release candidates?", and your reply was "RC is welcome but unnecessary"; it seems to us that having it clearer as latest-rc make for less confusion.

Correct, but I think we’re forgetting that the context of that comment was about getting the feature landed, and I was willing to not include RC if for some reason that would be technically impossible or resistant towards its. So it was still intentional that it included RC in the end.
However I don’t have an issue if the community wants to change it, but I do think that if breaking changes are introduced that it should follow semver.

@paulo-ferraz-oliveira
Copy link
Collaborator

I'm personally Ok to release:

  • 1.x
    • considering the initial implementation had a "bug" around the implemented intention: it seems like it, if we take the README's "Pre-release versions are opt-in" into account, or
  • 2.x
    • forcing many a CI element to be updated for something that:
      • won't "break" - except for expectations - more than actually using the latest as-is
      • most users of the action aren't using - I have no hard stats for this, but I'm making an educated guess, that most people try to have some sort of deterministic approach in their CI.

@Schultzer
Copy link
Contributor
Schultzer commented Apr 25, 2025

Personelly I would prefer a major bump, since there is no bug in latest and we won't break anyone who is expecting rc to be included, people that would like the new behavior can easily upgrade to 2. where we would have both latest and latest-rc.

From my perspective then this is the best of both worlds, and what most developers would expect.

After all it is right in the readme and part of the test cases:

"Latest" versions

Set a tool's version to latest to retrieve the latest version of a given tool. The latest version is (locally) calculated by the action based on the (retrieved) versions it knows (note: it is not the same as GitHub considers it and some repositories might propose).

If in doubt do a test run and compare the obtained release with the one you were expecting to be the latest.

https://github.com/erlef/setup-beam/blob/4b97eeaf23ad23397976bb25e8345cb633a53ee4/test/setup-beam.test.js#L826L843

  versions = {
    '27.0.0-rc3': '27.0.0-rc3',
    '27.0.0-rc2': '27.0.0-rc2',
  }
  spec = 'latest'
  expected = '27.0.0-rc3'
  got = setupBeam.getVersionFromSpec(spec, versions)
  assert.deepStrictEqual(got, expected)

  versions = {
    '27.0.0-rc3': '27.0.0-rc3',
    '27.0.0-rc2': '27.0.0-rc2',
    '27.0.0': '27.0.0',
  }
  spec = 'latest'
  expected = '27.0.0'
  got = setupBeam.getVersionFromSpec(spec, versions)
  assert.deepStrictEqual(got, expected)

@starbelly
Copy link
Member

I want to float an alternative that may satisfy all interested parties. Why not keep latest as is and add an additional option for excluding certain types of releases?

This would keep latest as is and avoid a breaking change (behavioral) and give us a way to solve the original issue. After all, all proposed solutions add a new additional option, yet as stated this avoids concerns with breaking changes.

Thoughts?

@Schultzer
Copy link
Contributor

I want to float an alternative that may satisfy all interested parties. Why not keep latest as is and add an additional option for excluding certain types of releases?

This would keep latest as is and avoid a breaking change (behavioral) and give us a way to solve the original issue. After all, all proposed solutions add a new additional option, yet as stated this avoids concerns with breaking changes.

Thoughts?

I like that, and it keeps it very clean with an option!

@paulo-ferraz-oliveira
Copy link
Collaborator

add a new additional option

This is only partially correct. The options are still the same (which is why action.yml is unchanged): it's the value that changes from latest to something else (or the semantics, depending on how we want to move forward).

@starbelly, mind you we already have a lot of options, for an action that's supposed to do one thing only (install a CI environment for OTP + optional language):

  • otp-version
  • otp-architecture
  • elixir-version
  • gleam-version
  • install-hex
  • install-rebar
  • rebar3-version
  • version-type
  • disable_problem_matchers
  • version-file
  • hexpm-mirrors

(I'm aware most of them have defaults)

What would the scope of the option be? Let's suppose such an option is called include-rc (same applies for exclude-...). Should the fetched versions (as per the normal listing) now include rc too? Or would it just apply to latest? Because if it's there by default it'd be include-rc false since the normal listing doesn't include release candidates, and this would go against what we're discussing, since you'd have to have include-rc true and latest as value (to keep same behaviour) thus also being a breaking change.

I think:

  1. most people don't use latest, as is - I have no data to support this
  2. the ones that do might not expect it to include rc (because none of the installers have rc as their latest) - I have no data to support this
  3. making most consumers bump to 2.x, reading a changelog just to figure out they have to do nothing, seems like overkill

@wojtekmach had a good suggestion about including a What's new in the release notes and keep at 1.x.

Thus:

  1. we either "break" it per the above reasons and keep at 1.x
  2. we move with 2.x

@starbelly
Copy link
Member

Thus:

1. we either "break" it per the above reasons and keep at 1.x

2. we move with 2.x

I hear what you're saying. I think we can all agree has nice api has as few options as possible and just does the right thing 90% of the time. I'd like to figure out how to reduce our number of options, yet that would require a 2.x, and a digression from the convo.

What I'm seeing though is the addition of a new option latest-rc, so this is what I meant when I said all solutions proposed (and written) thus far add a new additional option 😄. So my point was, if we're going to add that, why not just add an exclusion option and keep latest as is? Admittedly, it would be some what odd because there only differing type of release other than "stable" is indeed RC, so you would only end up with one type of release to exclude really 😄

I will yield to consensus, but I did want to try and offer up a simple solution that will keep everyone happy, based on all the commentary that I was indeed following.

Ergo, I'm ok with going with a breaking behavioral change if we are loud about it.

@Schultzer
Copy link
Contributor
Schultzer commented Apr 27, 2025

Thus:

1. we either "break" it per the above reasons and keep at 1.x

2. we move with 2.x

I hear what you're saying. I think we can all agree has nice api has as few options as possible and just does the right thing 90% of the time. I'd like to figure out how to reduce our number of options, yet that would require a 2.x, and a digression from the convo.

What I'm seeing though is the addition of a new option latest-rc, so this is what I meant when I said all solutions proposed (and written) thus far add a new additional option 😄. So my point was, if we're going to add that, why not just add an exclusion option and keep latest as is? Admittedly, it would be some what odd because there only differing type of release other than "stable" is indeed RC, so you would only end up with one type of release to exclude really 😄

I will yield to consensus, but I did want to try and offer up a simple solution that will keep everyone happy, based on all the commentary that I was indeed following.

Ergo, I'm ok with going with a breaking behavioral change if we are loud about it.

I think the option is properly the best stop gap, until there is a clearer idea about what to do with the options in general, it might be the best option (pun intended) since it forces us to think real hard about improving the overall API and deal with them for a 2.

Introducing a breaking change or bump just for latest-rc seams equally bad in hindsight.

@starbelly thank you for suggesting this alternative that can satisfy all, until there is a good consensus about what is a good API for 2.x. I don’t think we should rush this, and a stop gap unblock everyone without breaking anything. It’s fairly easy to add the option for your workflow if you don’t want rc in certain workflows.

Hindsight is always 20/20. I wish I saw this as clear as you!

@paulo-ferraz-oliveira
Copy link
Collaborator
paulo-ferraz-oliveira commented Apr 27, 2025

Ok, so let's try to think about the option... what would that be?, and how would it apply to both latest (which is not an option, but an option's value) and -version in general...?

Do you mean having a value like latest-no/without-rc? I thought this was discussed and refused, but I might not have understood it...

Edit:

It’s fairly easy to add the option for your workflow

I don't think it is easy. As I stated above, if e.g. your option is exclude-rc this applies to latest Ok (would have to be false by default), but what would happen for the non-latest version calculations with that default? Behaviour would be inconsistent.

@Schultzer
Copy link
Contributor

Ok, so let's try to think about the option... what would that be?, and how would it apply to both latest (which is not an option, but an option's value) and -version in general...?

Do you mean having a value like latest-no/without-rc? I thought this was discussed and refused, but I might not have understood it...

Edit:

It’s fairly easy to add the option for your workflow

I don't think it is easy. As I stated above, if e.g. your option is exclude-rc this applies to latest Ok (would have to be false by default), but what would happen for the non-latest version calculations with that default? Behaviour would be inconsistent.

Something just hit me, maybe all of this is completely unnecessary, as we’re using https://www.npmjs.com/package/semver I believe you could simply define your version as >0 or >27 and get the latest major version. Keep in mind that I haven’t tested this and I don’t see anything in our test suite. I think it is important to verify if we could solve this by adding a test and some more documentation for this functionality.

@paulo-ferraz-oliveira
Copy link
Collaborator

I'd be Ok, as per your latest reply, if:

  1. >ver would mean rc are accepted (we'd clarify the doc specifically for this)
  2. we would clarify the doc. for the fact that latest includes rc
  3. we would clarify the doc. by stating "no ranges" don't include rc (basically the same as 1. but written for clarify)

@Schultzer
Copy link
Contributor
Schultzer commented May 1, 2025

I'd be Ok, as per your latest reply, if:

  1. >ver would mean rc are accepted (we'd clarify the doc specifically for this)
  2. we would clarify the doc. for the fact that latest includes rc
  3. we would clarify the doc. by stating "no ranges" don't include rc (basically the same as 1. but written for clarify)
  1. When I read semver.js then to allow for rc with > then you have to specify it explicitly e.g >1.5.0-rc.
  2. it’s been a while but I actually believe due to how semver.js works, was the original reason for the inclusion of latest. So one could test against upcoming releases, and in that sense latest is semantically correct.
  3. Yeah, I think it would be great to expand on the docs explicitly and with examples of when to use latest vs version range.

Regardless of all of this, I think having proper tests for this functionality is a requirement, and we can reference them in the readme, for anyone who might be in doubt of how the resolution works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for latest **stable** release
6 participants
0