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

CI: Add rustfmt and cargo clippy to CI #95

Merged
merged 17 commits into from
Apr 26, 2023

Conversation

Mossaka
Copy link
Member

@Mossaka Mossaka commented Mar 21, 2023

This PR follows the discussion from #93

- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be a rolling version. It means PR might pass a check when merging but main branch might fail later and need to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you explain why will the main branch might fail later if the CI passes?

Copy link
Contributor

Choose a reason for hiding this comment

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

if this runs on 1.68 and passes, later 1.69 comes out with new clippy rules. Then locally update to 1.69, pull main, run clippy and it will fail.

This can be annoying for contributors as they might have a PR open and rebased on the main branch but now this starts failing when the new tool chain comes out. Either they need to submit a sperate PR and fix then rebase or fix it in same PR to get it in.

If you do release branches this can be a similar issue, where before the fix goes into the branch the formats need to be applied for the new version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I see. What do you recommend to mitigate this issue? I think what we can do is that whenever a new release of clippy comes out (together with a new cargo release), we manually submit a PR to fix the main branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should be pinning the version of Rust that we build against. This creates a little bit more work from a maintenance perspective but it allows more control, sets up for repeatable builds and avoids the pitfalls I mentioned above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I've pinned the rust version to 1.69.0

@ipuustin
Copy link
Contributor

I made a PR (Mossaka#2) for amending to this PR for marking all the existing clippy issues as "allowed". We can fix them later and we will get the CI to catch any new clippy issues.

ipuustin and others added 2 commits March 27, 2023 10:45
Mark unfixed clippy warnings as allowed.

The idea is that we'll catch new errors in CI and also we can fix the
existing warnings whenever we like.

Signed-off-by: Ismo Puustinen <[email protected]>
Mark unfixed clippy warnings as allowed
@Mossaka
Copy link
Member Author

Mossaka commented Mar 28, 2023

I made a PR (Mossaka#2) for amending to this PR for marking all the existing clippy issues as "allowed". We can fix them later and we will get the CI to catch any new clippy issues.

Thanks for your contribution! Merged it in

@Mossaka
Copy link
Member Author

Mossaka commented Mar 28, 2023

I will be holding off on this PR until #78 merged in to main

Mossaka and others added 2 commits March 28, 2023 20:56
Signed-off-by: jiaxiao zhou <[email protected]>
Signed-off-by: Ismo Puustinen <[email protected]>
@cpuguy83
Copy link
Member

Needs a rebase.

Mossaka and others added 5 commits April 24, 2023 13:52
@Mossaka Mossaka requested a review from cpuguy83 April 26, 2023 18:11
@Mossaka
Copy link
Member Author

Mossaka commented Apr 26, 2023

Rebased, PTAL @cpuguy83

@jsturtevant
Copy link
Contributor

LGTM

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

Build is failing due to missing system libs

@cpuguy83
Copy link
Member

Looks like a fmt error:

image

Signed-off-by: jiaxiao zhou <[email protected]>
@Mossaka
Copy link
Member Author

Mossaka commented Apr 26, 2023

Alright, should be passing now as cargo clippy passed on my local env.

@cpuguy83 cpuguy83 merged commit c2665d7 into containerd:main Apr 26, 2023
5 checks passed
@Mossaka Mossaka deleted the add-fmt-to-ci branch April 26, 2023 19:18
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.

None yet

4 participants