Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KDESKTOP-962] Enable Sonar's CI Analysis on Linux with code coverage computation via Bullseye #303

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,58 @@ jobs:

- name: Grant building script execute permission
run : chmod +x ./infomaniak-build-tools/linux/build-ci-amd64.sh

- name: Build kDrive desktop
run : ./infomaniak-build-tools/linux/build-ci-amd64.sh
run : |
# Configure BullseyeCoverage
rm -f "${HOME}/BullseyeCoverageEnv.txt"
echo "COVFILE=${PWD}/src/test.cov" > "${HOME}/BullseyeCoverageEnv.txt"
export PATH="/opt/BullseyeCoverage/bin/:${PATH}"
cov01 -1 -q --no-banner # coverage on
cov01 -s

# Build the application
./infomaniak-build-tools/linux/build-ci-amd64.sh

- name: Grant tests script execute permission
run : chmod +x ./infomaniak-build-tools/run-tests.sh

- name: Execute tests
run : ./infomaniak-build-tools/run-tests.sh
run : |
# Configure Bullseye
export PATH="/opt/BullseyeCoverage/bin/:${PATH}"
cov01 -1 -q --no-banner # coverage on
cov01 -s

# Execute tests
./infomaniak-build-tools/run-tests.sh

- name: Compute code coverage
run : |
rm -f BullseyeCoverageExclusions
echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
PATH="/opt/BullseyeCoverage/bin/:${PATH}"
cov01 -0 # coverage off
covselect --import BullseyeCoverageExclusions
covxml -f src/test.cov -o coverage.xml

- name: Install sonar-scanner
uses: SonarSource/sonarcloud-github-c-cpp@v3
env:
SONAR_HOST_URL: https://sonarcloud.io

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ secrets.DESKTOP_KDRIVE_SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
run: |
sonar-scanner -X --define sonar.projectKey=Infomaniak_desktop-kDrive \
--define sonar.organization=infomaniak \
--define sonar.sources=src \
--define sonar.exclusions=src/3rdparty/** \
--define sonar.cfamily.compile-commands="build-linux/build/compile_commands.json" \
--define sonar.cfamily.bullseye.reportPaths=coverage.xml

- name: Upload tests logs artifacts
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions infomaniak-build-tools/linux/build-ci-amd64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cmake -B$BUILDDIR -H$BASEPATH \
-DKDRIVE_THEME_DIR="$BASEPATH/infomaniak" \
-DKDRIVE_VERSION_BUILD="$(date +%Y%m%d)" \
-DBUILD_UNIT_TESTS=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
"${CMAKE_PARAMS[@]}" \

make -j$(nproc)
Expand Down
1 change: 1 addition & 0 deletions infomaniak-build-tools/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ else
done
echo -e "${NC}"
fi

exit $errors
Loading