Repository: Infomaniak/desktop-kDrive
Pull request #589: [KDESKTOP-1233] Reactivate CI analysis on the Windows runner
Author: login: luc-guyot-infomaniak
Created: 2025-03-07T10:07:31Z | Merged: 2025-03-10T14:08:52Z



Diff:
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 548507242b..c3f21dd80f 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -21,21 +21,22 @@ env:
   KDRIVE_TEST_CI_8MO_PARTITION_PATH: ${{ vars.KDRIVE_TEST_CI_8MO_PARTITION_PATH_WIN }}
   KDRIVE_TEST_CI_RUNNING_ON_CI: true
 
-
 jobs:
   build-kDrive:
     runs-on: [ self-hosted, Windows, desktop-kdrive ]
-
+    env:
+      COVFILE: ${{ github.workspace }}\\src\\test.cov
     steps:
       - name: Load system Path into Github environment
         run : echo Path=%Path%>> %GITHUB_ENV%
         shell: cmd
 
       - name: Checkout the PR
-        uses: actions/checkout@v4.1.1
+        uses: actions/checkout@v4
         with:
           ref: ${{ github.head_ref }}
           submodules: recursive
+          fetch-depth: 0
         
       - name: Clean the log directory
         run : rm -r -force C:/Windows/Temp/kDrive-logdir/*
@@ -57,49 +58,61 @@ 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
-
+          call "cov01.exe" -s
+          
+          set PATH=%ProgramFiles%\BullseyeCoverage\bin;%ProgramFiles%\Microsoft Visual Studio\VC\bin;%PATH%
           powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci
         shell: cmd
 
       - name: Execute tests
         run: |
-          $env:COVFILE="$pwd\src\test.cov"
           & "cov01.exe" "-1" # coverage on
+          & "cov01.exe" "-s" # show status
+
           ./infomaniak-build-tools/run-tests.ps1
 
       - name: Compute code coverage
-        if: false
-        run : |
-          rm -Force -ErrorAction SilentlyContinue BullseyeCoverageExclusions
-          echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
-          $env:COVFILE="$pwd\src\test.cov"
+        if: true
+        run : |          
+          & "covselect.exe" "--add" 'exclude folder c:/'
+          & "covselect.exe" "--add" 'exclude folder ../'
+          & "covselect.exe" "--add" 'exclude folder 3rdparty/'
+          & "covselect.exe" "--add" 'exclude folder gui/'
+          
           & "cov01.exe" "-0" # coverage off
-          & "covselect.exe" "--import" "BullseyeCoverageExclusions"
+          & "cov01.exe" "-s" # show status
+
           & "covxml.exe" "-f" "$env:COVFILE" "-o" "coverage.xml"
 
-      - name: Install sonar-scanner
-        if: false
-        uses: SonarSource/sonarcloud-github-c-cpp@v3
-        env:
-          SONAR_HOST_URL: https://sonarcloud.io
+          & "cov01.exe" "-1" # coverage on
+          & "cov01.exe" "-s" # show status
 
       - name: Run sonar-scanner
-        if: false
+        if: true
         env:
           GITHUB_TOKEN: ${{ github.token }}
           SONAR_TOKEN: ${{ secrets.SONAR_DESKTOP_KDRIVE_TOKEN }}
           SONAR_HOST_URL: https://sonarcloud.io
-        run: >
-            sonar-scanner 
+          INCLUDE: "C:\\"
+        uses: SonarSource/sonarqube-scan-action@v4
+        with:
+          args: >
             --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.sources="src,extensions"
+            --define sonar.tests="test"
+            --define sonar.exclusions="src/3rdparty/**,src/gui/**"
             --define sonar.cfamily.compile-commands="build-windows/build/compile_commands.json"
-            --define sonar.cfamily.bullseye.reportPaths="coverage.xml"
+            --define sonar.cfamily.bullseye.reportPath="coverage.xml"
+            --define sonar.scm.exclusions.disabled=true
+            --define sonar.verbose=true
+
+      - name: Deactivate BullseyeCoverage
+        run: |
+          & "cov01.exe" "-0" # coverage off
 
       - name: Upload tests logs artifacts
         uses: actions/upload-artifact@v4
diff --git a/infomaniak-build-tools/windows/build-drive.ps1 b/infomaniak-build-tools/windows/build-drive.ps1
index 5588cad4af..c81805b6f1 100755
--- a/infomaniak-build-tools/windows/build-drive.ps1
+++ b/infomaniak-build-tools/windows/build-drive.ps1
@@ -266,20 +266,25 @@ 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"
+
+$compiler = "cl.exe"
 
 $args = @("'-GNinja'")
 $args += ("'-DCMAKE_BUILD_TYPE=$buildType'")
 $args += ("'-DCMAKE_INSTALL_PREFIX=$installPath'")
 $args += ("'-DCMAKE_PREFIX_PATH=$installPath'")
 
+if ($ci)
+{
+$args += ("'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON'")
+}
+
 $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=$compiler_path'",
-"'-DCMAKE_CXX_COMPILER:STRING=$compiler_path'",
+"'-DCMAKE_C_COMPILER:STRING=$compiler'",
+"'-DCMAKE_CXX_COMPILER:STRING=$compiler'",
 "'-DAPPLICATION_VIRTUALFILE_SUFFIX:STRING=kdrive'",
 "'-DBIN_INSTALL_DIR:PATH=$path'",
 "'-DVFS_DIRECTORY:PATH=$vfsDir'",
@@ -356,12 +361,6 @@ Set-Content -Path "$buildPath/NSIS.template.nsi" -Value $scriptContent
 #                                                                                               #
 #################################################################################################
 
-$binaries = @(
-"${env:ProgramFiles(x86)}/Sentry-Native/bin/crashpad_handler.exe",
-"kDrive.exe",
-"kDrive_client.exe"
-)
-
 $dependencies = @(
 "${env:ProgramFiles(x86)}/zlib-1.2.11/bin/zlib1",
 "${env:ProgramFiles(x86)}/libzip/bin/zip",
@@ -404,6 +403,12 @@ if (Test-Path -Path $iconPath)
 	Copy-Item -Path "$iconPath" -Destination $archivePath
 }
 
+$binaries = @(
+"${env:ProgramFiles(x86)}/Sentry-Native/bin/crashpad_handler.exe",
+"kDrive.exe",
+"kDrive_client.exe"
+)
+
 # Move each executable to the bin folder and sign them
 foreach ($file in $binaries)
 {


Reviews:
user: login: herve-er
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-10T07:57:50Z
user: login: luc-guyot-infomaniak
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-10T08:29:37Z
user: login: luc-guyot-infomaniak
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-10T09:36:39Z
user: login: ChristopheLarchier
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-10T10:16:37Z

Review comments:
diff_hunk: @@ -57,49 +58,61 @@ 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
-
+          call "cov01.exe" -s
+          
+          set PATH=%ProgramFiles%\BullseyeCoverage\bin;%ProgramFiles%\Microsoft Visual Studio\VC\bin;%PATH%
           powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci
         shell: cmd
 
       - name: Execute tests
         run: |
-          $env:COVFILE="$pwd\src\test.cov"
           & "cov01.exe" "-1" # coverage on
+          & "cov01.exe" "-s" # show status
+
           ./infomaniak-build-tools/run-tests.ps1
 
       - name: Compute code coverage
-        if: false
-        run : |
-          rm -Force -ErrorAction SilentlyContinue BullseyeCoverageExclusions
-          echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
-          $env:COVFILE="$pwd\src\test.cov"
+        if: true
+        run : |          
+          & "covselect.exe" "--add" 'exclude folder c:/'
+          & "covselect.exe" "--add" 'exclude folder ../'
+          & "covselect.exe" "--add" 'exclude folder 3rdparty/'
+          & "covselect.exe" "--add" 'exclude folder gui/'
+          
           & "cov01.exe" "-0" # coverage off
-          & "covselect.exe" "--import" "BullseyeCoverageExclusions"
+          & "cov01.exe" "-s" # show status
+
           & "covxml.exe" "-f" "$env:COVFILE" "-o" "coverage.xml"
 
-      - name: Install sonar-scanner
-        if: false
-        uses: SonarSource/sonarcloud-github-c-cpp@v3
-        env:
-          SONAR_HOST_URL: https://sonarcloud.io
+          & "cov01.exe" "-1" # coverage on
path: .github/workflows/windows.yml
user: login: herve-er
body: Do we really need to turn on the coverage here?
created_at: 2025-03-10T07:57:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -57,49 +58,61 @@ 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
-
+          call "cov01.exe" -s
+          
+          set PATH=%ProgramFiles%\BullseyeCoverage\bin;%ProgramFiles%\Microsoft Visual Studio\VC\bin;%PATH%
           powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci
         shell: cmd
 
       - name: Execute tests
         run: |
-          $env:COVFILE="$pwd\src\test.cov"
           & "cov01.exe" "-1" # coverage on
+          & "cov01.exe" "-s" # show status
+
           ./infomaniak-build-tools/run-tests.ps1
 
       - name: Compute code coverage
-        if: false
-        run : |
-          rm -Force -ErrorAction SilentlyContinue BullseyeCoverageExclusions
-          echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
-          $env:COVFILE="$pwd\src\test.cov"
+        if: true
+        run : |          
+          & "covselect.exe" "--add" 'exclude folder c:/'
+          & "covselect.exe" "--add" 'exclude folder ../'
+          & "covselect.exe" "--add" 'exclude folder 3rdparty/'
+          & "covselect.exe" "--add" 'exclude folder gui/'
+          
           & "cov01.exe" "-0" # coverage off
-          & "covselect.exe" "--import" "BullseyeCoverageExclusions"
+          & "cov01.exe" "-s" # show status
+
           & "covxml.exe" "-f" "$env:COVFILE" "-o" "coverage.xml"
 
-      - name: Install sonar-scanner
-        if: false
-        uses: SonarSource/sonarcloud-github-c-cpp@v3
-        env:
-          SONAR_HOST_URL: https://sonarcloud.io
+          & "cov01.exe" "-1" # coverage on
path: .github/workflows/windows.yml
user: login: luc-guyot-infomaniak
body: Good question! This block was added after several trials and errors. 
As I read it now, it might be useful for the next step, but this is rather speculative by now. 

Let me try to remove it and check if the build is still successful. 
created_at: 2025-03-10T08:29:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -57,49 +58,61 @@ 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
-
+          call "cov01.exe" -s
+          
+          set PATH=%ProgramFiles%\BullseyeCoverage\bin;%ProgramFiles%\Microsoft Visual Studio\VC\bin;%PATH%
           powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci
         shell: cmd
 
       - name: Execute tests
         run: |
-          $env:COVFILE="$pwd\src\test.cov"
           & "cov01.exe" "-1" # coverage on
+          & "cov01.exe" "-s" # show status
+
           ./infomaniak-build-tools/run-tests.ps1
 
       - name: Compute code coverage
-        if: false
-        run : |
-          rm -Force -ErrorAction SilentlyContinue BullseyeCoverageExclusions
-          echo "exclude folder 3rdparty/\nexclude folder ../" >> BullseyeCoverageExclusions
-          $env:COVFILE="$pwd\src\test.cov"
+        if: true
+        run : |          
+          & "covselect.exe" "--add" 'exclude folder c:/'
+          & "covselect.exe" "--add" 'exclude folder ../'
+          & "covselect.exe" "--add" 'exclude folder 3rdparty/'
+          & "covselect.exe" "--add" 'exclude folder gui/'
+          
           & "cov01.exe" "-0" # coverage off
-          & "covselect.exe" "--import" "BullseyeCoverageExclusions"
+          & "cov01.exe" "-s" # show status
+
           & "covxml.exe" "-f" "$env:COVFILE" "-o" "coverage.xml"
 
-      - name: Install sonar-scanner
-        if: false
-        uses: SonarSource/sonarcloud-github-c-cpp@v3
-        env:
-          SONAR_HOST_URL: https://sonarcloud.io
+          & "cov01.exe" "-1" # coverage on
path: .github/workflows/windows.yml
user: login: luc-guyot-infomaniak
body: So, it's actually required! (It helps SonarCloud detecte the compiler used during the build).
created_at: 2025-03-10T09:36:39Z
author_association: CONTRIBUTOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-03-10T12:23:55Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=Infomaniak_desktop-kDrive&pullRequest=589) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=Infomaniak_desktop-kDrive&pullRequest=589&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=Infomaniak_desktop-kDrive&pullRequest=589&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=Infomaniak_desktop-kDrive&pullRequest=589&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=Infomaniak_desktop-kDrive&pullRequest=589&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=Infomaniak_desktop-kDrive&pullRequest=589&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Infomaniak_desktop-kDrive&pullRequest=589)


author_association: NONE