I’m trying to setup build-wrapper and sonar-scanner for a CMake C project on GitHub using GitHub Actions.
Actually my strategy to do it is the following (but you can tell me it’s a shit if required):
- In the GitHub workflow file, create a docker in which I execute a script called “sonar.sh”;
- In the GitHub project, SONAR_TOKEN is added to the Secret confuguration;
- The script “sonar.sh” fetch build-wrapper and sonar-scanner, extract the ZIP files and try to execute build-wrapper and sonar-scanner.
My project : https://github.com/joelguittet/c-amp
Workflow file : https://github.com/joelguittet/c-amp/blob/master/.github/workflows/sonar.yml
Script : https://github.com/joelguittet/c-amp/blob/master/.github/workflows/sonar.sh
The result is visible in GitHub Action menu (https://github.com/joelguittet/c-amp/runs/1658643454?check_suite_focus=true) and is simply:
/work/.github/workflows/sonar.sh: line 24: /work/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64: not found
Calling “ls -l /work/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64” command on the path returns:
-rwxr-xr-x 1 root root 1935176 Jan 6 20:04 /work/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64
So I don’t understand why it’s “not found”.
After several hours on this topic, I have no more idea and decided to ask here.
I’m open to alternative solutions too to do the same job.
At the beginning I was also thinking to some code coverage analysis, but not look at this subject yet. I’m open also to some interesting information on this subject.
Thanks for your advice and help,