Allow to specify minor/patch version for clang-format
Is your idea related to an existing feature?
version
Describe the behavior you would like
First of all I'm not sure that my request can be solved from cpp-linter side, but I hope it may.
When I use Github runner ubuntu-22.04 and set version: '18' for cpp-linter, then during linter run version 18.1.8 is installed because there is no installed clang-format-18 on that image.
E: Unable to locate package clang-format-18
...
++ PRETTY_NAME='Ubuntu 22.04.5 LTS'
...
Get:1 https://apt.llvm.org/jammy llvm-toolchain-jammy-18/main amd64 clang-format-18 amd64 1:18.1.8~...
At the same time if I use ubuntu-24.04 (currently -latest) I got preinstalled clang-format 18.1.3.
clang-format-18 is already the newest version (1:18.1.3-1ubuntu1).
...
Found a installed version of clang-format: 18.1.3 at /usr/lib/llvm-18/bin/clang-format
Is there a way to use 18.1.8 for ubuntu-24.04 runner as well using only cpp-linter-action settings?
It looks weird that we have old clang-format version for new ubuntu, and new clang-format for old ubuntu.
Describe alternatives you have considered
No response
Additional context
No response
If you install the version that you want to use before running cpp-linter, then it should use that version as long as the major version number matches the version input to cpp-linter.
I'm not sure if we can support this request. On Linux runners, we use the official installer script from LLVM which uses apt to install clang tools from their PPA repo. If you can specify a minor version when installing clang tools via apt, then it should be possible, but this has not been my experience.
I think your problem might be solved by simply running
sudo apt-get update
sudo apt-get install clang-format-18
before running cpp-linter.
update and install pair didn't help. See linked thread I started for github-runners
It seems a regression (specific to building bpftrace) was discovered using LLVM v18.1.8 (see tickets 2097317 and 2081848) which prompted the build to be removed from the Ubuntu PPA repo containing the LLVM v18 toolchain.
I doubt GitHub actions will update their image for the same reason. I sincerely hope I'm wrong though.
Alternatively, you can install the latest v18 using the same LLVM install script we use.
VERSION=18
wget https://apt.llvm.org/llvm.sh -O ${{ runner.temp }}/llvm_install.sh
chmod +x ${{ runner.temp }}/llvm_install.sh
if sudo ${{ runner.temp }}/llvm_install.sh $VERSION; then
sudo apt-get install -y clang-format-$VERSION clang-tidy-$VERSION
# for compatibility with cpp-linter-action, we must remove the added PPA
sudo rm /etc/apt/sources.list.d/*llvm*.list
fi
And then run cpp-linter-action after that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.