Hello, @acgetchell, and welcome to the community!
And I appreciate the amount of research you’ve done.
I believe your issue stems from the use of the SonarSource/sonarcloud-github-action.
Unfortunately, SonarCloud GitHub Action uses a Docker container that does not support analysis of C-family languages.
Instead of the SonarCloud Action you should invoke sonar-scanner directly, like this:
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page:
# https://sonarcloud.io/documentation/analysis/scan/sonarscanner/
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.1.2450-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="https://sonarcloud.io"
You can also take a look at this repository for a complete working example.
Let me know if this helps or if the issue persists.
Thank you @necto for your reply, that did indeed fix the issue.
As a note, I don’t think the Cache SonarCloud packages will do anything without checking the results of cache hits. That is, I think the main.yml file given will always download and unzip sonar-scanner and build-wrapper. Thanks to your guide, I do have a working analysis file that does the right thing for cached SonarCloud packages:
Note that because the download/unzip steps are conditional, a separate step is required to set $GITHUB_PATH to the correct values whether or not there’s a cache hit.
The next trick is to get Code Coverage working. I have this working with Travis-CI and CodeCov, but I am not sure of the correct values for SonarCloud.
Thanks for the speedy replies, SonarCloud and SonarLint have been quite useful in catching mistakes other scanners have not.