-
Notifications
You must be signed in to change notification settings - Fork 16
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
Sorbet integration #310
Sorbet integration #310
Conversation
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.
It doesn't make sense to check in RBIs when you don't check in gems.
.github/workflows/check.yml
Outdated
typecheck: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update Ubuntu package repository | ||
run: sudo apt-get update | ||
- name: Setup sqlite-devel | ||
run: sudo apt-get -y install libsqlite3-dev | ||
- name: Setup libcurl-devel | ||
run: sudo apt-get -y install libcurl4 libcurl3-gnutls libcurl4-openssl-dev | ||
|
||
- name: Set up Ruby 3.1.4 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.1.4 | ||
bundler-cache: false | ||
|
||
- name: Install dependencies | ||
run: bundle install | ||
|
||
- name: Run sorbet type check | ||
run: bundle exec srb typecheck | ||
|
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.
We already have different jobs for rspec
and rubocop
, but they actually should be one job; we can save many lines and computation time for setup in that way.
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 expect to run all jobs even if one fails. How do you propose to combine 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.
Add continue-on-error
for each of typecheck, rspec, and rubocop. You can later check if all of the steps succeeded.
Thanks for providing a proof of concept. This is very informative. Having two definitions for one JSON is terrible so we should pick one. I have mixed feelings for Sorbet, but I think the utility of its static type checker supasses its disadvantages. We can write a converter to Sorbet if we want to write a schema in another language, but it's hard to support Sorbet's static type checker with such a converter. Supporting its runtime type check-ing is easy since we can generate a type definition as Ruby objects on Ruby, but static type checking requires the generated definitions to be saved as Ruby code, and that's very complicated. The other way around is easy in contrary. If we will have a frontend written in JavaScript and need to consume Sorbet code, we can traverse the types and generate JSON, which is only a matter of calling Honestly, I don't like some syntactical aspects of Sorbet; it requires typing |
@akihikodaki I don't touch workflow-related commit, I want to investigate the ability to simplify it. As this is not related to Sorbet in general, let's move the deduplication part outside this PR. |
I think these changes are good enough to start with Sorbet. If there are no critical problems that we can see now, let's continue in the next way:
|
That sounds good to me. |
695ef94
to
d5fd9b1
Compare
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 we should also run tapioca gems --verify
. Their documentation says it breaks Dependabot, but it apparently does not. dependabot-core
itself uses Dependabot with Sorbet and it seems just fine: https://github.com/dependabot/dependabot-core/issues?page=3&q=label%3Adependencies+label%3Aruby+is%3Aclosed
When I update gems and run |
I think they mean this problem dependabot/dependabot-core#5962. Need to download tapioca definitions after updating a gem. |
Yes, what I don't get is that https://github.com/dependabot/dependabot-core/ doesn't have such code yet it seems working. |
Excluding |
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.
Things I have pointed out earlier are all correctly resolved. I still have a few comments though.
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Please ignore everything from the
sorbet
folder during a review.