Kaleidoscope icon indicating copy to clipboard operation
Kaleidoscope copied to clipboard

Switch to clang-format-15 for CI

Open gedankenexperimenter opened this issue 3 years ago • 9 comments
trafficstars

Now that clang-format-15 is available on GitHub Actions, I think we can upgrade. I've made the necessary changes to the clang-format config file, and run make check-code-style locally.

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

I'm stumped. GitHub claims to support clang-format-15 now (https://github.com/marketplace/actions/clang-format-check), but I can't figure out how to get it installed on the VM that runs the CI.

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

Och, I'm an idiot. It's notthing to do with GitHub's clang-format-check; it's the Linux VM that needs it installed…

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

I'm stumped. GitHub claims to support clang-format-15 now (https://github.com/marketplace/actions/clang-format-check), but I can't figure out how to get it installed on the VM that runs the CI.

This is a GitHub action, so it's supposed to be used like this: https://github.com/marketplace/actions/clang-format-check#single-path

That doesn't work for our case, because we want to run make check-code-style. What the action does under the hood, is pull a docker image with clang-format-15 installed, and run stuff through that. It doesn't install it in the VM or anything, it delegates the job to a docker container.

Perhaps we should do something similar, rather than waiting for ubuntu-latest to have clang-format-15, just run make check-code-style within a docker image, like the GH Action does?

algernon avatar Oct 17 '22 15:10 algernon

We're running it in the ubuntu-latest image, which claims to have clang-format-14 available, but if I set it up to use that, it errors because the file doesn't exit. This page appears to be inaccurate: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

Alternatively: https://apt.llvm.org/. We could just use the packages from there, and then we'd have clang-format-15 available in the VM, no docker necessary.

algernon avatar Oct 17 '22 15:10 algernon

We're running it in the ubuntu-latest image, which claims to have clang-format-14 available, but if I set it up to use that, it errors because the file doesn't exit. This page appears to be inaccurate: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

That's because ubuntu-latest is confusingly not 22.04, but 20.04: https://github.com/actions/runner-images#available-images, ad 20.04 only has clang-format-10, as far as I see.

algernon avatar Oct 17 '22 15:10 algernon

Aha! ubuntu-latest is not actually the latest, apparently. If I specify ubuntu-22.04, it does have clang-format-14 (which is still older than what I really want, but it might solve the formatting discrepancy that makes make check-code-style fail every time I run it locally because of some bug in clang-format-12, which I don't have a version of.

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

That's because ubuntu-latest is confusingly not 22.04, but 20.04: https://github.com/actions/runner-images#available-images, ad 20.04 only has clang-format-10, as far as I see.

The GitHub VM for 20.04 has versions of clang-format up to 12, actually.

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

Well, I've tried it with clang-format-14, and unfortunately, I haven't found a way to configure it that doesn't munge some of our code unnecessarily, so until clang-format-15 actually becomes available, we're stuck.

gedankenexperimenter avatar Oct 17 '22 15:10 gedankenexperimenter

Now that we're on clang-format-15 in CI, I extracted the remaining bits of this PR and merged them as #1375

obra avatar Dec 21 '23 19:12 obra