Skip to content

Lintcheck: Update crates and expand CI testset to 200 crates #13124

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

Merged
merged 5 commits into from
Jul 19, 2024

Conversation

xFrednet
Copy link
Member

@xFrednet xFrednet commented Jul 18, 2024

This PR adds a new ci_crates.toml to lintcheck for our CI. The 200 crates take about 14 minutes, which is slightly more than the 10 I aimed for but still reasonable. The testset is constructed from:

  • 5 crates that compile to binaries
  • 4 crates that have been mentioned in ICE issues
  • 1 crates "random" crates from lintcheck_crates.toml
  • 190 crates from the top 200 crates from crates.io

During testing, I noticed a few panics in lintcheck. I've fixed them where possible, or at least improved the error message.

The new test set generates 500+ MB of json lints, which are compressed to a ~24mb artifact.


This PR also updates our lintcheck_crates.toml. I mainly updated the versions, removed some very outdated crates, and added some new ones. I targeted 25 crates as those are pretty fast to lint and a good precursor for our CI.


Optional TODO:

  • It's likely that some crates are compiled several times. We could potentially safe some time, by using --recursive in our CI.
    This is something I want to investigate, but it shouldn't be a blocker for this PR.

r? @Alexendoo

changelog: none

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 18, 2024
@flip1995
Copy link
Member

which is slightly more than the 10 I aimed for but still reasonable.

Could we just cut down the most popular crates to 100-150 to achieve that? 15 minutes is a long time for a CI run. I think all other jobs finish in about 5-7 minutes usually.

@xFrednet
Copy link
Member Author

xFrednet commented Jul 18, 2024

I think it's fine if lintcheck takes a bit longer, since it will usually pass unless, there are ICEs. I intentionally aimed for the top 200 crates due to this comment from @y21 on Zulip

I almost always run lintcheck on the top 200 crates and it's fairly common that FPs only show up in the lower top 100-200 and nothing with the default crates list

Also, I'm guessing that it's usually the reviewer or triage that looks at the lintcheck output. Then it's better if we have more data. This is also usually async to the PR author.

@xFrednet xFrednet force-pushed the 00000-lintcheck-crates branch 3 times, most recently from d7123b2 to 01ea926 Compare July 18, 2024 20:20
@Alexendoo
Copy link
Member

  • It's likely that some crates are compiled several times. We could potentially safe some time, by using --recursive in our CI.
    This is something I want to investigate, but it shouldn't be a blocker for this PR.

Yeah there'll be a whole bunch

Getting --recursive to be deterministic enough to use in CI is something I've been looking at. Currently dependencies of checked crates can change between runs, usually this doesn't cause issues but it definitely would if we're linting those deps

@xFrednet xFrednet force-pushed the 00000-lintcheck-crates branch from 01ea926 to 813df2e Compare July 18, 2024 20:53
@xFrednet
Copy link
Member Author

xFrednet commented Jul 18, 2024

Currently dependencies of checked crates can change between runs, usually this doesn't cause issues but it definitely would if we're linting those deps

Is this because cargo doesn't always respect the lock files?

Then let's not block the PR on that, but keep that as a hopeful performance boost in the future

@Alexendoo
Copy link
Member

Some things didn't have Cargo.locks IIRC, but that's worth double checking, maybe we don't have to do anything

@xFrednet
Copy link
Member Author

Should I check that in this branch ?

@Alexendoo
Copy link
Member

Nah doesn't have to be done here

@Alexendoo
Copy link
Member

I had a look and yeah many libraries don't include Cargo.locks in the package because they're gitignored

How long are we talking for 100/150 crates?

@xFrednet
Copy link
Member Author

xFrednet commented Jul 19, 2024

I had a look and yeah many libraries don't include Cargo.locks in the package because they're gitignored

We could try to hack around that by having a crate in our repo that includes all of them with a Cargo.lock file. But that seems very hacky :/

@xFrednet
Copy link
Member Author

xFrednet commented Jul 19, 2024

Crates Time [min]
100 ~11
150 ~13
200 ~14
Without binaries ~8
No deno 10:40
No deno cargo 9:40

@xFrednet
Copy link
Member Author

xFrednet commented Jul 19, 2024

Removing the binary crates drastically cuts down the time to ~8 min. Even with the other 200 crates 🤔

I would like to at least keep a few binary crates. I can see which ones take the longest:

image

Deno and cargo. Let's see what happens without deno

@xFrednet
Copy link
Member Author

Without cargo and deno, w#re at slightly below 10 minutes. Does that sound like a better CI time?

@flip1995
Copy link
Member

Could we start a parallel job for the binaries?

@xFrednet
Copy link
Member Author

xFrednet commented Jul 19, 2024

We would need to modify lintcheck to be able to load and compare multiple json files (To keep the uniform output in a single step). I still don't think it's worth it, though. As mentioned, I'm guessing that it will be mostly us as reviewers that look at lintcheck and regular contributors that know about our CI. And since this only runs on PRs, it's less a thing which you check during development, but instead in the PR once you feel like the implementation is mostly done.

So based on this, I think having a longer run time of now 9 minutes (or 10 with cargo) is totally fine.

@xFrednet xFrednet force-pushed the 00000-lintcheck-crates branch from 73e707b to 243a2a3 Compare July 19, 2024 15:21
@flip1995
Copy link
Member

You could run lintcheck twice and upload the json files with 2 different names and then also run the comparison twice. No need to modify lintcheck. Just the workflow would get a bit more complicated and we'd need 2 crates.toml files in the repo.

And since this only runs on PRs

Oh, it doesn't run on bors? In that case it would not slow down merging PRs, which was my main concern.

@flip1995
Copy link
Member

Yeah, 9 or 10 minutes are fine. Just tried to figure out how we could manage to not drop binaries you planned to include, without increasing CI time.

@Alexendoo
Copy link
Member

10 minutes including cargo sounds good to me too, cargo catches a lot since it's a nice large codebase

@xFrednet
Copy link
Member Author

Oh, it doesn't run on bors? In that case it would not slow down merging PRs, which was my main concern.

It only runs on PRs and is meant as input for discussions. The CI is always green, unless there is an ICE. So we assume that an ICE would be caught by the reviewer, but otherwise there is little reason to run it with bors I'd say.

10 minutes including cargo sounds good to me too, cargo catches a lot since it's a nice large codebase

Awesome, then I'll squash the testing commits :D

@xFrednet xFrednet force-pushed the 00000-lintcheck-crates branch from 243a2a3 to 8940bc3 Compare July 19, 2024 17:52
@xFrednet
Copy link
Member Author

I've only squashed and reordered the commits. The content should be the same :D

@Alexendoo
Copy link
Member

🚀

@bors r+

@bors
Copy link
Contributor

bors commented Jul 19, 2024

📌 Commit 8940bc3 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 19, 2024

⌛ Testing commit 8940bc3 with merge 057c4ae...

@bors
Copy link
Contributor

bors commented Jul 19, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 057c4ae to master...

@bors bors merged commit 057c4ae into rust-lang:master Jul 19, 2024
8 checks passed
@xFrednet xFrednet deleted the 00000-lintcheck-crates branch July 19, 2024 18:16
@xFrednet
Copy link
Member Author

xFrednet commented Jul 19, 2024

Nice! Lintcheck is getting better every day. Now there are like one or two more small things I want to add, and that should be it for now =^.^=

@flip1995
Copy link
Member

Thank you both for all the work on our tooling recently! ❤️

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