-
Notifications
You must be signed in to change notification settings - Fork 556
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
add justfile #1513
add justfile #1513
Conversation
|
||
typecheck: | ||
{{ if semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7") == "true" { \ | ||
"bundle exec srb tc" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this whole line gets executed if the expression is truthy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you clarify this? im not sure what the comment is calling out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly just explaining the just
syntax. If the semver_matches
call above is "true"
, then just
runs bundle exec src tc
. I found it a little counter intuitive, because it looks like the expression is returning a string (which it is, but that string just becomes a line in the file). Was just adding context to the reviewer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh. so this conditionally inserts "bundle exec srb tc" into the typecheck: step when it is run/evaluated, and thats what just executes. is that the standard way to do conditional execution in just, or is that something special we had to do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh. so this conditionally inserts "bundle exec srb tc" into the typecheck: ste
exactly!
is that the standard way to do conditional execution in just
Yes, or something like:
should_sorbet := semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7")
typecheck:
[ {{ should_sorbet }} == "true" ] && bundle exec srb tc
But then we shell out to ruby every time someone runs just
, which has a small performance implication. Otherwise, they're equivalent!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me, and it seems readable on its face.
bundle exec rake test | ||
|
||
typecheck: | ||
{{ if semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7") == "true" { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just supports semver checks out of the box, so I got to simplify this block!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, is this the "runs directly" referenced from the Rakefile? I think the same concerns I had with node/package.json applies; does having it in the Rakefile support some base level of development that someone who isnt comfortable with just can still benefit from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, is this the "runs directly" referenced from the Rakefile?
no, that's that we call bundle exec rubocop
in just
in CI instead of bundle exec rake rubocop
in CI.
does having [rubocop] in the Rakefile ...
probably a little, but it's also a very common ruby pattern to bundle exec <tool>
to run local tools.
Having it in the rakefile means a user could bundle exec rake rubocop
instead of bundle exec rubocop
. That would be useful if we were adding other arguments or configuration in that task, but since it's literally just calling rubocop
like the user would, involving rake
with rubocop
at all strikes me as unnecessary abstraction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is referencing how much clear this is compared to the same check in the Makefile
, which is a bunch of extra bash code (compared to just
, which supports semver checks directly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense to me
They literally changed what We can pin to the older ubuntu or update our jruby (maybe to |
@@ -40,20 +41,21 @@ jobs: | |||
|
|||
test: | |||
name: Test (${{ matrix.ruby-version }}) | |||
# this is needed because our JRuby test version isnt supported on ubuntu-24 (which is now ubuntu-latest) | |||
# this version of jruby isn't available in the new latest (24.04) so we have to pin (or update jruby) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you changed all of the runs-on, i might suggest moving some version of this comment to the top of the file so a future dev who might be tempted to upgrade the runs-as version would have the full context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah, that's fine too. Also this change doesn't need to be included - we both changed the runs-on
line in separate PRs, so this was my explanation for it. Yours also works though
Rakefile
Outdated
@@ -8,6 +8,7 @@ Rake::TestTask.new do |t| | |||
t.pattern = "./test/**/*_test.rb" | |||
end | |||
|
|||
# I think we can remove this; we'll run rubocop directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the key here is the version test, since we support back to 2.3. is that easier to do here vs where you wanted to move it to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the version check in this block isn't relevant anymore.
We only install rubocop on >= 2.7
(in the gemfile), so when we were calling rake
across all versions, it was important to only require rubocop
on versions in which it was available. But CI now calls rubocop
directly (not through rake
), so we don't need the task here at all (in a conditional or otherwise).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh interesting. agreed then it makes sense to remove it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the answers/additional info. Looks good!
Why?
In an effort to modernize and simplify our local tooling, we're moving our dev commands from makefiles to justfiles. This is intended to be mostly a drop-in replacement, but some command names may change per standardization efforts.
What?
just
See Also
DEVSDK-2325