sonarCloud on PlatformIO project with github Actions : Analysis Warnings

I am using PlatformIO for developing embedded sw, and wanted to try SonarCloud. (Currently using CppCheck and CodeCov)

In the ‘Automatic Analysis’ mode, everything was simple to setup, but it did not include the test-coverage, and because I already have a github Actions based CI workflow, I tried to include SonarCloud into the workflow.

For reference :
my (open source) repository
the workflow yml file

I had problems with getting the build-wrapper working (actually I just don’t understand what that is…) but I can generate Compilation Database (from PlatformIO CLI), and with the python script from this post, I was able to make it work.

So when the workflow runs, the results for static code analysis and unit testing coverage, are synced to my project on sonarcloud.io. Amazing.

But the analysis has a warning :

File
/home/runner/work/MuMo-v2-Node-SW/MuMo-v2-Node-SW/cfamily-compilation-database/build-wrapper-dump.json
was generated using build-wrapper version old,
which does not match the analyzer version 6.56.0.72172.
Please download the matching version from the server
https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
Additionally, the property 'sonar.cfamily.build-wrapper-output' is deprecated.
Please switch to 'sonar.cfamily.compile-commands' after using the matching version of build-wrapper.
Visit the documentation for more up-to-date information on analysis using build-wrapper https://docs.sonarcloud.io/advanced-setup/languages/c-c-objective-c/overview/

Is it possible to improve my CI script, or the convert-compile-commands.py script to get rid of this warning ? Or maybe get rid of the workaround and get the build-wrapper working ?

Hey there @Strooom!

Yes, I think you can get rid of both warnings and move to a cleaner setup.

The build wrapper can be used to generate a compilation database, but you’re also (now) welcome to use your own compilation database. The build wrapper has been changed to now generate a compilation database instead of our own custom format…

So ideally you can:

Thank you, this indeed results in a clean CI workflow.
I really appreciate it’s free for open source sw.
I’ll build up some more experience with it, and then write a blogpost about it on PlatformIO Labs

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.