-
-
Notifications
You must be signed in to change notification settings - Fork 118
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 clippy to CI and fix warnings #208
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.
Thank you for the pull request, @ObiWanRohan!
I've left some comments with questions and change suggestions.
In addition, there are some problem and questions that need to be addressed before this can be merged:
- The new jobs are failing, complaining about a missing rust-toolchain file. I don't understand why. One was added earlier today (build: add
rust-toolchain.toml
configuration file #206), and this pull request seems to be up-to-date withmain
. - Does it make sense to also run
cargo build
, not justcargo test
? They're mostly redundant, but acargo build
might expose additional problems, like linker issues. Might be irrelevant right now. - We already have existing CI jobs that would need to be removed, or merged into the new jobs.
- I'm concerned about using so many different jobs. Wouldn't starting a new runner cause overhead each time, resulting in a longer CI build? Wouldn't it be better to just have one job per platform, with the appropriate steps specified for each? That would also cut down on some redundant
uses
declarations. - Can we configure Dependabot to update all those actions? It might be tedious to keep them up-to-date manually.
I should've created this as a draft PR. About your questions:
|
Looks like Dependabot has the ability to update the actions workflows too |
Understood. I've converted the pull request to a draft (I think you could have done this too; there's a subtle link in the upper right under Reviewers). Just convert it back, once you feel it's ready.
Ah, got it. Yeah, I think we can pin it to stable, as a workaround. I don't feel strongly anyway, about whether we should pin to stable in
The workflow I linked runs on every push to a pull request, so just as often as this one. There's really no difference between them, except that this one is new and contains more stuff. There's the same intent behind them, to test pull requests. There's also the Compile Binaries workflow (might get renamed soon), which only runs when
That's great, thanks for checking 👍 |
That is a really unfortunate issue. I did not see that one coming 🤔 I think pinning to stable is fine though.
@hannobraun since jobs run in parallel, the time issue is negligible. The matrix job should be kept separate, but the rest can be combined if you are more comfortable with it. Originally, I put them into individual ones for readability in the checks section of a pull-request. At a glance, you'd immediately see what part of CI went south.
The existing workflow https://github.com/hannobraun/Fornjot/blob/main/.github/workflows/fornjot.yml is superseded by this one can can be removed. Glad to get some feedback out of this to improve rust-workflows :) |
I've definitely seen that jobs where blocked because they were waiting for a runner to become available, though. So it's not always parallel. (That might have been a problem with Windows runners though? Not sure I've ever seen that with Linux.) But honestly, I don't really care. I do care that the CI run doesn't take too long, but other than that... You're definitely the expert here. So if you're telling me it's best practice to do it this way, and it won't affect the runtime negatively (at least most of the time), that's fine by me. |
I also added the same Also, the Source: https://github.com/hannobraun/Fornjot/runs/5251297420?check_suite_focus=true - name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
target: ${{ matrix.target }}
toolchain: stable Of course the |
Thanks for the praise. I'd stick with this job-split until we notice a negative impact that is significant enough to hurt the workflow. Until then, I'd keep it like it is in favor of the user experience when glancing at the "checks" section of a pull-request. |
I added a couple of suggestions with the stable toolchain. That way, it also works as expected in rust-workflows. |
Aside: here is how Dependabot updates GitHub Actions with the configuration contained in this pull-request: hendrikmaus/rust-workflows#42 I am quite pleased with it. |
Sounds good! |
@hendrikmaus You're correct. I added the |
Ci-wise this looks fine now @ObiWanRohan - thank you. The changes in the |
Those are due to the trivial fixes which I did from the Clippy suggestions and the merge from the |
Ah got it, should've looked at the change-set myself 🤦🏻 IMHO I would always submit two or more change-sets in this situation to keep the concerns separated: 1) mutate the CI pipeline 2) code changes. That is because either change can have side-effects which could make you revert partial patches. That is way cleaner if each change-set is bound to a single concern. If that makes sense :) @hannobraun are you happy to merge the change-set like this anyway? |
I also prefer to have separate concerns (like fixing Clippy warnings and making CI changes) in separate pull requests. One additional reason, on top of what @hendrikmaus mentioned, is to get changes in as soon as possible. I might merge a change today that conflicts with Clippy fixes in this PR, which would then cause unnecessary work for @ObiWanRohan. As a general rule, everything that makes sense on its own should be merged right away (but obviously you don't need to make one pull request per minute for 10 minutes, if you're doing a bunch of small cleanups; use your judgement). But that's not a blocker. I'd be happy to merge the PR anyway. There are two things I'd like to see done before merging, ideally:
But those aren't hard blockers either. If @ObiWanRohan ran out of time and couldn't work on this for a while, for example, I'd prefer to merge the existing improvements and make further changes later, instead of letting this sit here to suffer from bit rot. Also, as a general note, if merge conflicts need to be resolved in a pull request, I prefer the pull request to be rebased, instead of a merge commit being created. That leaves a simpler (and thus easier to review) history. This isn't a hard requirement either. (And by the way, this isn't a full review. I haven't looked at the commits for a while; this is just some stuff I noticed.) |
Whoops, sorry, I just noticed this PR. I've fixed some of the lints with #232. My bad. The now remaining lints were not quite as clear cut which why I haven't addressed them yet. Might require some more consideration... |
I just got back to this PR. I agree that the Clippy fixes are probably better suited to a separate PR. |
My preferred solution to that problem is to get changes merged as early as practical, exactly so that contributors like you don't have to be aware of all ongoing work 😄
My favorite solution would be to have the Clippy fixes in a separate pull request (or even multiple, if some are uncontroversial and can be merged right away, while other require discussion), then rebase/force-push this pull request to have the CI changes as a separate pull request with a clean history. But the whole point of my preferences is to make the workflows here efficient, and that's going to depend on the developer and the work. If you think you might want to fiddle with the CI some more, it's probably best to submit the other changes separately. If you want to do a final push to get everything over the finish line in one go, than just do that. Whatever works best for you! |
9ab0d78
to
51639b2
Compare
I have removed the previous checks ( |
- uses: actions-rs/clippy-check@9d09632661e31982c0be8af59aeb96b680641bc4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features |
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.
args: --all-features | |
args: --all-features | |
name: CI / Clippy run |
This should make for a nicer name to appear in the "checks" section of a pull-request. By default, the job's name appears as clippy_check
.
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.
The name currently appears as CI / Clippy Check
, the name is configured 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.
Looks like there are two Clippy entries in the "checks" section now. One with the nice name (Clippy Check), one just called clippy.
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.
The job emits a check and the step it runs emits another. I don't know a way to solve that right now.
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 don't think it's much of a problem. Just mentioned it because it seemed related to the discussion here regarding the name displayed under "checks".
I think this one is ready to be merged 👍🏻 Nicely done @ObiWanRohan |
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 agree that this looks very good. Thank you @ObiWanRohan!
I'm happy to merge as-is, with a few reservations:
- I found one tiny issue. Left a comment. I can probably apply the fix myself, after leaving this review.
- I'd prefer to have all Clippy warnings fixed or suppressed before merging, but it's also okay to fix them soon-ish after merging this check. I'll open an issue.
- GitHub tells me this branch is out-of-date with the base branch, but doesn't show me the button to let me rebase it. I'll look into that after leaving the review.
If I can cajole GitHub into letting me rebase, I'll merge this right after leaving this review. If I have to manually rebase, I'll do that later today.
Thanks again, @ObiWanRohan, and thank you @hendrikmaus for the help!
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, I can't apply my own review suggestion. Looks like @ObiWanRohan didn't check that box that would allow me to push changes to the branch. This would also explain why I can't rebase.
So, happy to merge, once:
- My suggestion has been applied.
- @hendrikmaus's suggestion also looks good. I see no reason not to apply that too.
- The branch has been rebase on
main
.
Running `cargo check` and `cargo clippy` is redundant. Clippy supersedes `cargo check`
6a0736a
to
c6a4d11
Compare
@hannobraun The PR is ready to merge. |
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.
Thank you, @ObiWanRohan, yet again!
There are some workflows which are shown as the 3 expected checks. I think that is something to be done with the merge settings
Yes, those must be because of the branch protection settings. I should be able to take care of this on my end.
Opened #261. |
Add a workflow to run Clippy.
Solving issue #139