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

Run a diff of lintcheck against the merge base for pull requests #10398

Merged
merged 2 commits into from
Jun 16, 2024

Conversation

Alexendoo
Copy link
Member

@Alexendoo Alexendoo commented Feb 24, 2023

changelog: none

This is an MVP of sorts, it consists of #9764 + a GitHub action that feeds the output to the job summary. It doesn't yet do anything fancy like --recursive or adding comments to the PR, so you'd have to click through to the action to see the results

Example output of a change (Alexendoo@0be1ab8): https://github.com/Alexendoo/rust-clippy/actions/runs/4264858870#summary-11583333018

r? @flip1995

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 24, 2023
@bors
Copy link
Collaborator

bors commented Mar 4, 2023

☔ The latest upstream changes (presumably #10445) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented Mar 9, 2023

☔ The latest upstream changes (presumably #10458) made this pull request unmergeable. Please resolve the merge conflicts.

@Alexendoo Alexendoo force-pushed the auto-lintcheck branch 3 times, most recently from 454bfa2 to 80879c6 Compare June 4, 2023 18:00
@bors
Copy link
Collaborator

bors commented Jul 13, 2023

☔ The latest upstream changes (presumably #11095) made this pull request unmergeable. Please resolve the merge conflicts.

@xFrednet
Copy link
Member

Hey @flip1995 this is a ping from triage. Would you mind taking a look at this?

If you don't have the time, you can reassign it to me or a random other member by commenting r? clippy.

@bors
Copy link
Collaborator

bors commented Apr 5, 2024

☔ The latest upstream changes (presumably #12439) made this pull request unmergeable. Please resolve the merge conflicts.

@xFrednet
Copy link
Member

r? @xFrednet

@rustbot rustbot assigned xFrednet and unassigned flip1995 Jun 12, 2024
@rust-cloud-vms rust-cloud-vms bot force-pushed the auto-lintcheck branch 2 times, most recently from 383dc1b to 346ce89 Compare June 12, 2024 16:39
@xFrednet
Copy link
Member

xFrednet commented Jun 14, 2024

I've started to review this PR. Could you push a dummy commit, that breaks a lint and adds some diffs in the lintcheck step?

@Alexendoo
Copy link
Member Author

https://github.com/rust-lang/rust-clippy/actions/runs/9517584950?pr=10398#summary-26236690016

Will have to take a look why those #[must_use] lints showed up as being added & removed

@Alexendoo
Copy link
Member Author

It seems to be a GitHub bug? 🤔

The merge commit is correct (8290f72) https://github.com/rust-lang/rust-clippy/actions/runs/9517584950/job/26236510601?pr=10398#step:2:300

But ${{ github.event.pull_request.base.sha }} is resolving to aaade2d (one commit behind master) https://github.com/rust-lang/rust-clippy/actions/runs/9517584950/job/26236510601?pr=10398#step:3:1

Despite the base of 8290f72 (the merge commit) being 3e5a02b (current master)

But on the later runs it has updated to be the current master https://github.com/rust-lang/rust-clippy/actions/runs/9519822264/job/26243848420#step:4:1. Seems like it can be out of sync with the actual CI that's running

I guess we can just use HEAD^ instead so we don't run into this again

@Alexendoo
Copy link
Member Author

Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

The changes (besides the dummy error changes) look mostly good to me. I have some questions and comments, but most of those can be pushed into follow-up PRs or addressed here. Thank you for putting this together! :D

.github/workflows/lintcheck.yml Show resolved Hide resolved
Comment on lines +54 to +52
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum Commands {
Diff { old: PathBuf, new: PathBuf },
}
Copy link
Member

Choose a reason for hiding this comment

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

It feels like lintcheck is becoming more and more a monster that can do everything related to lint checking. I think this makes sense, especially if we might consider extracting lintcheck to be used outside of Clippy as well. We should consider merging lintcheck/src/popular-crates.rs into this as well.

This is a followup though, nothing that should be done in this PR

.github/workflows/lintcheck.yml Show resolved Hide resolved
lintcheck/src/config.rs Outdated Show resolved Hide resolved
lintcheck/src/json.rs Show resolved Hide resolved
lintcheck/src/json.rs Show resolved Hide resolved
.github/workflows/lintcheck.yml Show resolved Hide resolved
@rust-cloud-vms rust-cloud-vms bot force-pushed the auto-lintcheck branch 2 times, most recently from c8de273 to feb0671 Compare June 15, 2024 14:11
@xFrednet
Copy link
Member

LGTM, let's get this prototype merged and see how it goes :D


Roses are red,
CI is green,
lincheck will run,
for everyones fun!

@bors
Copy link
Collaborator

bors commented Jun 16, 2024

📌 Commit feb0671 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 16, 2024

⌛ Testing commit feb0671 with merge a2c9782...

@bors
Copy link
Collaborator

bors commented Jun 16, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing a2c9782 to master...

@bors bors merged commit a2c9782 into rust-lang:master Jun 16, 2024
8 checks passed
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

A few comments on the workflow. Thanks for getting this through!

.github/workflows/lintcheck.yml Show resolved Hide resolved
Comment on lines +40 to +42
- name: Create cache key
id: key
run: echo "key=lintcheck-base-${{ hashfiles('lintcheck/**') }}-$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
Copy link
Member

@flip1995 flip1995 Jun 17, 2024

Choose a reason for hiding this comment

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

Using cache here is a bit weird IMO. I think the upload-artifacts action would fit better here? Or am I missing something? https://github.com/actions/upload-artifact

Copy link
Member Author

Choose a reason for hiding this comment

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

It does do some caching as well as act as a way to share it between steps e.g. here base had a cache hit

I don't know if you can do that with artifacts, mostly I went with cache because I'm already familiar with it

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok. True, base can have cache hits between PRs based on the same master commit.

head however will never have a cache hit, neither will diff. I think the cleaner way would be to just cache base. To share the json files however, it would be cleaner to use {down,up}load-artifacts IMO.

But this is a NIT on the action

@Alexendoo Alexendoo deleted the auto-lintcheck branch June 17, 2024 13:32
bors added a commit that referenced this pull request Jun 24, 2024
Cache lintcheck binary in ci

Always trims ~40s off the `diff` job as it no longer needs to install the rust toolchain or compile lintcheck. Saves a further ~20s for the `base`/`head` jobs when the cache is warm

It now uses artifacts for restoring the JSON between jobs as per #10398 (comment), cc `@flip1995`

The lintcheck changes are to make `./target/debug/lintcheck` work, running `cargo-clippy`/`clippy-driver` directly doesn't work without `LD_LIBRARY_PATH`/etc being set which is currently being done by `cargo run`. By merging the `--recursive` and normal cases to both go via regular `cargo check` we can have Cargo set up the environment for us

r? `@xFrednet`

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants