Hi,
I fork sonar-scanning-examples for test analyze a C++ project on Github Action.
I always get the error message “The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed.”
I follow the readme on GitHub and steps on Sonarqube server.
I already create public repo GitHub - jeff51419/cpp-build-wrapper: source from https://github.com/SonarSource/sonar-scanning-examples/ and output log files on action flow.
build.yml
name: SonarQube
on:
push:
branches:
- master # or the name of your main branch
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Download and install the build wrapper, build the project
run: |
mkdir $HOME/.sonar
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output ./build.sh
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
-
name: Verify build wrapper output
run: |
ls -lh bw-output
cat bw-output/build-wrapper-dump.json
cat bw-output/build-wrapper.log
-
name: SonarQube analysis
uses: SonarSource/sonarqube-scan-action@v1.0.0
with:
args: -Dsonar.cfamily.build-wrapper-output=bw-output
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
sonar-project.properties
sonar.projectKey=cpp-build-wrapper
sonar.projectName=cpp-build-wrapper
sonar.projectVersion=1.0
sonar.sources=src
# The build-wrapper output dir
sonar.cfamily.build-wrapper-output=bw-output
# Encoding of the source files
sonar.sourceEncoding=UTF-8
sonar.cfamily.threads=1
sonar.cfamily.cache.enabled=false
build.sh
#!/bin/bash
echo "REMOVE PREVIOUS BUILD"
rm -rf build
echo "BUILDING"
mkdir build
g++ -c -Wall -o build/BiggestUnInt src/BiggestUnInt.cc
g++ -c -Wall -o build/HelloWorld src/HelloWorld.cpp
g++ -c -Wall -o build/SimpleClass src/SimpleClass.cc
RC=$?
if [ $RC -ne 0 ]; then
echo "BUILD FAILURE"
else
echo "BUILD SUCCESS"
fi
I’d be obliged if someone point out what I miss or misunderstand.
Thanks in Advance,
Jeff