8000 Improve visibility (+fix bugs) over version-type and opt-in versions by paulo-ferraz-oliveira · Pull Request #57 · erlef/setup-beam · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve visibility (+fix bugs) over version-type and opt-in versions #57

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

Merged
merged 1 commit into from
Jul 9, 2021
Merged

Improve visibility (+fix bugs) over version-type and opt-in versions #57

merged 1 commit into from
Jul 9, 2021

Conversation

paulo-ferraz-oliveira
Copy link
Collaborator

(and tweak README regarding action versioning)

This hopefully closes #56. I'm adding the info on that ticket to the tests, as I go.

@paulo-ferraz-oliveira paulo-ferraz-oliveira marked this pull request as ready for review July 8, 2021 18:09
@@ -92,6 +92,10 @@ jobs:
otp-version: '24'
rebar3-version: '3.15'
os: 'ubuntu-20.04'
- elixir-version: 'v1.11.0'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added because an issue was found live for this specific combo (and also because 'version-type': 'strict' was not being tested in the GitHub workflows).

specifier (`1.11.0-rc.0`). Pre-release versions are opt-in, so `1.11.x` will
not match a pre-release.
For pre-release versions, such as `v1.11.0-rc.0`, use the full version
specifier (`v1.11.0-rc.0`) and set option `version-type` to `strict`. Pre-release versions are
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version-type will not always be required, for rc, but it's best to recommend it because if used results are guaranteed to be better.

@@ -159,6 +159,18 @@ jobs:

The Elixir Problem Matchers in this repository are adapted from [here](https://github.com/fr1zle/vscode-elixir/blob/45eddb589acd7ac98e0c7305d1c2b24668ca709a/package.json#L70-L118). See [MATCHER_NOTICE](MATCHER_NOTICE.md) for license details.

## Action versioning
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know about this: this is my attempt at making sure consumers don't rely on potentially breaking versions (this schema is almost like the "ranges" we implement) 😄

@@ -4788,7 +4789,7 @@ async function getElixirVersion(exSpec0, otpVersion) {
const elixirVersions = await getElixirVersions()
const semverVersions = Array.from(elixirVersions.keys()).sort()

const exSpec = exSpec0.match(/^(.+)(-otp-.+)/) || exSpec0.match(/^(.+)/)
const exSpec = exSpec0.match(/^v?(.+)(-otp-.+)/) || exSpec0.match(/^v?(.+)/)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We remove the v from the input, to later add it back again (this way we allow v1.12 as well as 1.12).

@@ -4896,7 +4899,7 @@ async function getElixirVersions() {
.split('\n')
.forEach((line) => {
const elixirMatch =
line.match(/^(.+)-otp-([^ ]+)/) || line.match(/^([^ ]+)/)
line.match(/^v?(.+)-otp-([^ ]+)/) || line.match(/^v?([^ ]+)/)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we remove the v from the listing (this way we allow v1.12 as well as 1.12).

@@ -4928,18 +4931,24 @@ async function getRebar3Versions() {
function getVersionFromSpec(spec, versions) {
let version = null

if (core.getInput('version-type', { required: false }) === 'strict') {
if (
spec.match(/rc/) ||
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not allowing rc below we try to fetch one from the listing, here. If it is an rc we consider the match to be strict.

)
}

return elixirVersionWithOTP
return `v${elixirVersionWithOTP}`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is where we add it back. Mind you (https://repo.hex.pm/builds/elixir/builds.txt) all versions start with a v except for master (I'm not sure we want an exception for master, so keeping it out, for the time being).

(and tweak README regarding action versioning)
otp-version: '22.3.4.1'
os: 'ubuntu-20.04'
version-type: 'strict'
- elixir-version: '1.10.3'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before, without 'strict'. This proves strict isn't always required in non-semver cases.

@@ -4948,13 +4952,26 @@ function getVersionFromSpec(spec, versions) {
version =
versionsMap[semver.maxSatisfying(Object.keys(versionsMap), rangeForMax)]
} else {
version = versionsMap[spec]
version = versionsMap[maybeCoerced(spec)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were missing this. We added, say, 1.13.2 for 1.13.2.1 but then searched for 1.13.2.1, which wouldn't be found.

@paulo-ferraz-oliveira paulo-ferraz-oliveira merged commit 8306425 into erlef:main Jul 9, 2021
@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Improve visibility over version-type and opt-in versions Improve visibility (+fix bugs) over version-type and opt-in versions Jul 9, 2021
@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the fix/rc-opt-in branch July 9, 2021 09:18
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.

OTP version undefined
2 participants
0