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-1223] Let the Windows CI runner manage the Sonar Cloud analysis, including code coverage #309

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0425e62
Let cmake generate the compile commands json file
luc-guyot-infomaniak Sep 19, 2024
19b9127
Let the Windows CI runner launch the Sonar Cloud analysis, including …
luc-guyot-infomaniak Sep 20, 2024
f0aaac3
Fixes Cmd and PowerShell commands for BullseyeCoverage activation
luc-guyot-infomaniak Sep 20, 2024
702ce4c
Fixes the definition of the COVFILE environment variable
luc-guyot-infomaniak Sep 20, 2024
3ce3e5c
Removes quotes from environment variable as it causes a BullseyeCover…
luc-guyot-infomaniak Sep 20, 2024
9210b4d
Sets the COVFILE environment variable before running unit tests
luc-guyot-infomaniak Sep 20, 2024
f2f6451
Runs sonar-scanner as a PowerShell command
luc-guyot-infomaniak Sep 20, 2024
189b815
Changes the sonar scanner installation action to v3
luc-guyot-infomaniak Sep 20, 2024
cf099e5
Changes the sonar scanner installation action to v2
luc-guyot-infomaniak Sep 20, 2024
66cf4b9
Fixes the name of the github action for Sonar Source installation
luc-guyot-infomaniak Sep 20, 2024
ed8189c
Loads the system Path into Github environment
luc-guyot-infomaniak Oct 4, 2024
0c605c1
Install Sonar Scanner sooner to speed up testing
luc-guyot-infomaniak Oct 4, 2024
0c6c73c
Split the arguments of the sonnar-scanner command arguments
luc-guyot-infomaniak Oct 4, 2024
1388527
Removes extra double-quote causing the Sonar scanner to fail
luc-guyot-infomaniak Oct 4, 2024
803271e
Adds sonar host url to the arguments of Sonar scanner
luc-guyot-infomaniak Oct 7, 2024
d7d1f6d
Fixes the name of the Sonar token (github secrets) for our Gihub Wind…
luc-guyot-infomaniak Oct 7, 2024
de3cc17
Merge branch 'develop' into kdesktop-1233-let-the-windows-ci-runner-l…
ClementKunz Oct 8, 2024
2276324
Merge branch 'develop' into kdesktop-1233-let-the-windows-ci-runner-l…
ClementKunz Oct 8, 2024
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
43 changes: 41 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
runs-on: [ self-hosted, Windows, desktop-kdrive ]

steps:
- name: Load system Path into Github environment
run : echo Path=%Path%>> %GITHUB_ENV%
shell: cmd

- name: Checkout the PR
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
submodules: recursive

- name: Clean the log directory
run : rm -r -force C:/Windows/Temp/kDrive-logdir/*

Expand All @@ -48,11 +52,46 @@ jobs:
- name: Build kDrive desktop
run: |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"
set COVFILE=%cd%\src\test.cov
call "cov01.exe" -1

powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci
shell: cmd

- name: Execute tests
run: ./infomaniak-build-tools/run-tests.ps1
run: |
$env:COVFILE="$pwd\src\test.cov"
& "cov01.exe" "-1" # coverage on
./infomaniak-build-tools/run-tests.ps1

- name: Compute code coverage
run : |
rm -Force -ErrorAction SilentlyContinue BullseyeCoverageExclusions
echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
$env:COVFILE="$pwd\src\test.cov"
& "cov01.exe" "-0" # coverage off
& "covselect.exe" "--import" "BullseyeCoverageExclusions"
& "covxml.exe" "-f" "$env:COVFILE" "-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.SONAR_DESKTOP_KDRIVE_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
run: >
sonar-scanner
--define sonar.projectKey="Infomaniak_desktop-kDrive"
--define sonar.organization="infomaniak"
--define sonar.host.url="https://sonarcloud.io"
--define sonar.sources="src"
--define sonar.exclusions="src/3rdparty/**"
--define sonar.cfamily.compile-commands="build-windows/build/compile_commands.json"
--define sonar.cfamily.bullseye.reportPaths="coverage.xml"

- name: Upload tests logs artifacts
uses: actions/upload-artifact@v4
Expand Down
8 changes: 6 additions & 2 deletions infomaniak-build-tools/windows/build-drive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,20 @@ if (!(Test-Path "$vfsDir\vfs.dll") -or $ext)
# #
#################################################################################################

$msvc_bin_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin"
$compiler_path = "$msvc_bin_path/Hostx64/x64/cl.exe"

$args = @("'-GNinja'")
$args += ("'-DCMAKE_BUILD_TYPE=$buildType'")
$args += ("'-DCMAKE_INSTALL_PREFIX=$installPath'")
$args += ("'-DCMAKE_PREFIX_PATH=$installPath'")

$flags = @(
"'-DCMAKE_EXPORT_COMPILE_COMMANDS=1'",
"'-DCMAKE_MAKE_PROGRAM=C:\Qt\Tools\Ninja\ninja.exe'",
"'-DQT_QMAKE_EXECUTABLE:STRING=C:\Qt\Tools\CMake_64\bin\cmake.exe'",
"'-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe'",
"'-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe'",
"'-DCMAKE_C_COMPILER:STRING=$compiler_path'",
"'-DCMAKE_CXX_COMPILER:STRING=$compiler_path'",
"'-DAPPLICATION_UPDATE_URL:STRING=https://www.infomaniak.com/drive/update/desktopclient'",
"'-DAPPLICATION_VIRTUALFILE_SUFFIX:STRING=kdrive'",
"'-DBIN_INSTALL_DIR:PATH=$path'",
Expand Down
Loading