Skip to content
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

Wildcard character not respected #251

Closed
jcoyne opened this issue Dec 26, 2021 · 14 comments
Closed

Wildcard character not respected #251

jcoyne opened this issue Dec 26, 2021 · 14 comments

Comments

@jcoyne
Copy link

jcoyne commented Dec 26, 2021

I set my config to use version 3.0.x per the instruction here: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-ruby#testing-with-multiple-versions-of-ruby

but when I did that it doesn't look like it could resolve the wildcard:

Run ruby/setup-ruby@v1
Error: Unknown version 3.0.x for ruby on ubuntu-20.04
        available versions for ruby on ubuntu-20.04: 1.9.3-p551, 2.0.0-p648, 2.1.9, 2.2.10, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.9, 2.4.10, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 3.0.0-preview1, 3.0.0-preview2, 3.0.0-rc1, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0-preview1, 3.1.0, head, debug
        Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1
        File an issue at https://github.com/ruby/setup-ruby/issues if would like support for a new version

https://github.com/projectblacklight/blacklight/runs/4637642004?check_suite_focus=true

@dentarg
Copy link

dentarg commented Dec 26, 2021

Can you try ruby: [2.7, '3.0.x'] instead of ruby: [2.7, 3.0.x]?

@MSP-Greg
Copy link
Collaborator

@jcoyne

As to your specific problem, please uses 3.0 for the most recent Ruby 3.0 release.

When GitHub first released Actions, they had their own 'setup-*' actions for several programming languages. So, one used actions/setup-ruby to use Ruby. I believe that repo/action may have supported wildcards.

For many reasons, they decided it was better to allow organizations/users that were strongly connected to the languages to create/maintain their own 'setup' actions. They now recommend that this action be used for Ruby workflows/CI.

So, I believe that document is mistaken, in that 'wildcard' characters have never been supported in this repo. Note that the wildcard character format is not tested in Actions CI here.

Sometime soon I'll open an issue or PR with https://github.com/github/docs to fix/update the info you found.

@MSP-Greg
Copy link
Collaborator

MSP-Greg commented Dec 27, 2021

@dentarg @eregon @jcoyne

If you have time, re updating the GitHub doc, see:

MSP-Greg/docs@e76da6064cf

https://github.com/MSP-Greg/docs/blob/b-t-ruby/content/actions/automating-builds-and-tests/building-and-testing-ruby.md

Haven't created a PR for it. If I do, I'll remind them that pinning to an SHA is a PITA for new users, and offer to push a commit for that...

@jcoyne
Copy link
Author

jcoyne commented Dec 27, 2021

@MSP-Greg If I put in 3.0, then it installs 3.1.0, which I'm attempting to avoid, because Rails 7 does not work with Ruby 3.1.0

@jcoyne
Copy link
Author

jcoyne commented Dec 27, 2021

@dentarg ruby: [2.7, '3.0.x'] does not work. It has the same error I originally reported.

@MSP-Greg
Copy link
Collaborator

MSP-Greg commented Dec 27, 2021

@jcoyne

The yaml parser truncates trailing zeros. So, [2.7, 3.0] is converted to [2.7, 3], and the 'three' just locks the major version. Use '3.0'. Same issue causes 3.10 to be interpreted as 3.1 (hypothetical). Or, any version of the form x.y will truncate trailing zeros and must be quoted. Note that x.y.z can't be interpreted as a number, so it isn't a problem.

@jcoyne
Copy link
Author

jcoyne commented Dec 27, 2021

@MSP-Greg Ah, that was the trick. Thanks for the help.

@dentarg
Copy link

dentarg commented Dec 27, 2021

The yaml parser truncates trailing zeros

The issue about that is actions/runner#849

@dentarg
Copy link

dentarg commented Dec 27, 2021

Haven't created a PR for it. If I do, I'll remind them that pinning to an SHA is a PITA for new users, and offer to push a commit for that...

Hope you don't mind but I opened a PR for your branch: github/docs#13418

@MSP-Greg
Copy link
Collaborator

@dentarg

Thanks. Re your suggestion, not sure about it. I suspect part of the reason for the 'parsing' issue is that Ruby treats 3 as an int, and 3.0 as a float. So, in Ruby

1/3 = 0    1/3.0 = 0.3333333333333333

But in js, 1/3 = 0.3333333333333333 and 3.0.toString() is "3"

Also, many parsers (including Psych) truncate zeros...

@eregon
Copy link
Member

eregon commented Dec 28, 2021

The GHA YAML parser is in C# AFAIK, and it should be able to differentiate 3.0 and 3 like most YAML parsers do (and as the YAML spec says IIRC).
That would be good to fix in GHA, but yeah it seems there hasn't been much progress on that issue.

2.10->2.1 is a separate issue and indeed also happens with Psych.
Although it's unlikely there will ever be a Ruby X.10.Z.

Maybe we should always use string versions in examples?

@MSP-Greg
Copy link
Collaborator

I haven't checked the spec, nor do I recall how many 'non-typed' languages consider 3.0 equivalent to 3.

Maybe we should always use string versions in examples?

Don't know. There are obviously going to be many workflows that don't do that, so I thought including examples with 3.0 and a brief explanation would be enough to limit issues. Haven't checked the doc here recently... Sorry.

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

No branches or pull requests

5 participants
@dentarg @jcoyne @eregon @MSP-Greg and others