linebender / glazier

Deprecated Rust Window Creation Library
Apache License 2.0
206 stars 32 forks source link

Split CI `clippy` into main & auxiliary steps. #155

Closed xStrom closed 1 year ago

xStrom commented 1 year ago

We ran into an interesting situation with #151 where the CI succeeded despite our Cargo.toml not correctly specifying the winerror feature for winapi. --- ( Cargo.toml was fixed by #153. )

This happened because some of our dev dependencies enable the winerror feature of winapi. This can be seen by comparing cargo tree -e features vs cargo tree -e features -e no-dev.

Looking deeper, this happened because cargo builds with dev dependencies if any of --tests / --benches / --examples are enabled. This was always the case for us, as we either did cargo test or cargo clippy --all-targets.

This issue has bitten us before too, just this year. Back in April we received a bug report for Druid (druid#2373) that a simple hello world type app won't compile. The same story there, the CI always ran with dev dependencies enabled. I concluded back then: Seems like a shortcoming of our testing methodology that it always builds with dev dependencies. Something to look into. Looking into it is probably somewhere in my mountain of todo tasks but obviously I didn't get to it fast enough for the issue to not repeat.

This PR here addresses that shortcoming. We split clippy into two steps. That is, --all-targets becomes --lib --bins and also --tests --benches --examples. This will increase the CI runtime a bit but there's just no way around that. Tests require dev dependencies, however we don't want those enabled for the main checks.

xStrom commented 1 year ago

I also disabled the CI for main pushes. Direct pushes to main are not allowed anyway, but previously there was the benefit of having the green checkmark next to commits when looking at the history. Merge queues graduated to general availability last month and it looks like one of the changes is that the merge queue checks are now displayed in the history too. So now we not only run the CI twice per merge, but also display both results. Hence the removal.