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

Trigger Github checks via Github API instead of commits + Refactor checks #84

Merged
merged 10 commits into from
Oct 2, 2024

Conversation

manuelmeurer
Copy link
Collaborator

It would be much more effective to trigger checks in the checker repo via the Github API instead of checking out the repo, adding a commit and pushing it.
The workflow action in the checker repo would need to accept some inputs, and call an endpoint in the Railsbump API (which still needs to be added), but overall this would be a much faster and more stable setup.
Happy to do a PR in the checker repo with the necessary changes!

@etagwerker wdyt?

compat_id: @compat.id.to_s,
ruby_version: @compat.rails_release.compatible_ruby_version.to_s,
bundler_version: @compat.rails_release.compatible_bundler_version.to_s,
dependencies: dependencies.to_json
Copy link
Member

Choose a reason for hiding this comment

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

@manuelmeurer Is this workflow running synchronously? I don't quite follow how the status is updated after getting the result from the GitHub action... Maybe I'm missing something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it just triggers the workflow, which runs asynchronously in a GitHub action. It would then be the workflow's responsibility to ping the RailsBump API with the results.

@etagwerker
Copy link
Member

The workflow action in the checker repo would need to accept some inputs, and call an endpoint in the Railsbump API (which still needs to be added), but overall this would be a much faster and more stable setup.

Oh, right, now it makes sense. We would need to specify these versions:

  • Ruby version
  • Rails version
  • Bundler version

We already have some of this information in text format over here: https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html

Then we would need one of these things:

  1. A job to check the workflow and update the compatibility status
  2. A callback from the checker once the workflow completed execution

@manuelmeurer
Copy link
Collaborator Author

Sounds good! I implemented a similar flow in another app recently, and went with option 2 (callback in the workflow to the API, when the workflow finishes).

@etagwerker
Copy link
Member

@manuelmeurer I took a stab at this and I moved the "check with bundler locally" logic to this project: https://github.com/railsbump/checker/blob/main/lib/rails_bump/checker/bundle_locally_check.rb

I'm interested in moving most of the "check" logic to the checker project and lean heavily on GitHub Actions to get the results we need.

I think that will provide us the most flexibility because we should be able to set up environments for these platforms:

  • linux
  • win
  • mac

@etagwerker
Copy link
Member

@manuelmeurer After some tinkering and debugging, I managed to get the "check with bundler" logic to work over here: https://github.com/railsbump/checker/actions/runs/11061342765

I'll start working on the callback mechanism/logic now. Stay tuned! 🤓

@etagwerker
Copy link
Member

@manuelmeurer Quick update: I got the new GitHub action to work and call back the RailsBump API. If it is okay with you, I can continue your work in this PR?

@etagwerker
Copy link
Member

@etagwerker
Copy link
Member

@manuelmeurer Alright, I think this is in a state where it can be reviewed. Could you please take a look?

It's working for some cases but not for all cases

I think some of the issues might be related to the combination of ruby + bundler + rails. I don't know if the database has the right information.

On top of that, what could happen is that GitHub Actions simply doesn't support certain combinations of older Ruby + Bundler versions? That's why this is a good strategy but not bulletproof. :)

This is an example of the compatibility check working: https://github.com/railsbump/checker/actions/runs/11075699535/job/30777217054

This is an example of the compatibility check action erroring before it gets to the check code: https://github.com/railsbump/checker/actions/runs/11075783938/job/30777474329

I think it might be a Rails Bump issue that is trying to combine a version of Rails + Bundler that will never work (?)

@etagwerker etagwerker force-pushed the trigger-github-checks-via-api branch from 7a2c33b to 3205fc7 Compare October 2, 2024 00:49
@etagwerker etagwerker changed the title Trigger Github checks via Github API instead of commits Trigger Github checks via Github API instead of commits + Refactor checks Oct 2, 2024
@etagwerker etagwerker force-pushed the trigger-github-checks-via-api branch from 5b8e8cd to 9c06372 Compare October 2, 2024 13:02
@etagwerker etagwerker merged commit 34b4fce into main Oct 2, 2024
1 check passed
@etagwerker etagwerker deleted the trigger-github-checks-via-api branch October 2, 2024 13:54
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.

2 participants