From aa36456c88927b8eed7b525389053672b74e583b Mon Sep 17 00:00:00 2001 From: elchananarb Date: Mon, 13 Jan 2025 17:50:55 +0200 Subject: [PATCH 01/35] add coverage --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a12b8137..bfc3b23d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,14 +25,17 @@ jobs: run: nuget restore . - name: Restore - run: dotnet restore . + run: dotnet restore . - name: Build run: msbuild /p:Configuration=Release /p:DeployExtension=False - - name: Tests + - name: Tests with Code Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /InIsolation .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll - - + run: vstest.console.exe /InIsolation /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + + - name: Analyze Code Coverage + run: | + $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 + & "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:coverage.xml $coverageFile.FullName From d3da4d46e02a3df538448e5a6b3e47ca27ad463d Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 09:45:35 +0200 Subject: [PATCH 02/35] Update ci.yml --- .github/workflows/ci.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfc3b23d..efc68eca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,5 @@ name: Checkmarx One visual studio extension CI - on: [ pull_request, workflow_dispatch ] - permissions: write-all jobs: @@ -26,16 +24,26 @@ jobs: - name: Restore run: dotnet restore . - + - name: Build run: msbuild /p:Configuration=Release /p:DeployExtension=False - + - name: Tests with Code Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /InIsolation /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura + + - name: Generate Coverage Report + run: | + dotnet tool install --global dotnet-reportgenerator-globaltool + reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"coverage_report" -reporttypes:TextSummary - - name: Analyze Code Coverage + - name: Print Coverage run: | - $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - & "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:coverage.xml $coverageFile.FullName + $coverageReport = Get-Content coverage_report/Summary.txt + echo "Coverage Summary:" + echo $coverageReport + $lineRate = Select-String -Path "**/coverage.cobertura.xml" -Pattern 'line-rate="([0-9.]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } + $percentage = [math]::Round(($lineRate * 100), 2) + echo "Total Coverage: $percentage%" + echo "COVERAGE_PERCENTAGE=$percentage" >> $env:GITHUB_ENV \ No newline at end of file From 1550207065c9064bf1c6e4095312300e980ffaa7 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 09:54:11 +0200 Subject: [PATCH 03/35] Update ast-visual-studio-extension.csproj --- .../ast-visual-studio-extension.csproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ast-visual-studio-extension/ast-visual-studio-extension.csproj b/ast-visual-studio-extension/ast-visual-studio-extension.csproj index e769f223..132a713e 100644 --- a/ast-visual-studio-extension/ast-visual-studio-extension.csproj +++ b/ast-visual-studio-extension/ast-visual-studio-extension.csproj @@ -10,6 +10,8 @@ true true + true + true @@ -170,7 +172,8 @@ - + + 7.5.1 From 5f4e5057ec6dfb530ecdb8c80f88a8d59e33d159 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:04:45 +0200 Subject: [PATCH 04/35] Update ci.yml --- .github/workflows/ci.yml | 114 +++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efc68eca..6378ce5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,49 +1,73 @@ name: Checkmarx One visual studio extension CI on: [ pull_request, workflow_dispatch ] permissions: write-all - jobs: - integration-tests: - runs-on: windows-latest - permissions: - contents: write - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - - name: Setup VSTest - uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1 - with: - vs-version: '17.2' - - - name: Restore NuGet packages - run: nuget restore . - - - name: Restore - run: dotnet restore . - - - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - - name: Tests with Code Coverage - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura - - - name: Generate Coverage Report - run: | - dotnet tool install --global dotnet-reportgenerator-globaltool - reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"coverage_report" -reporttypes:TextSummary - - - name: Print Coverage - run: | - $coverageReport = Get-Content coverage_report/Summary.txt - echo "Coverage Summary:" - echo $coverageReport - $lineRate = Select-String -Path "**/coverage.cobertura.xml" -Pattern 'line-rate="([0-9.]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } - $percentage = [math]::Round(($lineRate * 100), 2) - echo "Total Coverage: $percentage%" - echo "COVERAGE_PERCENTAGE=$percentage" >> $env:GITHUB_ENV \ No newline at end of file + integration-tests: + runs-on: windows-latest + permissions: + contents: write + steps: + - name: Fetch Sources + uses: actions/checkout@v4 + + # Installing Visual Studio Test Platform and test tools + - name: Install VSTest Platform + uses: microsoft/setup-vstest@v1 + + # Setting up VS Enterprise with required components for code coverage + - name: Setup Visual Studio + uses: microsoft/vs-setup-configure@v1 + with: + channelId: VisualStudio.17.Release + productId: Enterprise + components: | + Microsoft.VisualStudio.Component.CoreEditor + Microsoft.VisualStudio.Workload.CoreEditor + Microsoft.VisualStudio.Component.TestTools.Core + + # Configure build tools + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.3.1 + with: + vs-version: '17.2' + + # Add code coverage tools to system PATH + - name: Add Coverage Tools to PATH + shell: pwsh + run: | + $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" + echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Restore NuGet packages + run: nuget restore . + + - name: Restore + run: dotnet restore . + + - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + # Execute tests with coverage analysis enabled + - name: Run Tests with Code Coverage + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + run: vstest.console.exe /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + + # Process and convert coverage data to XML format + - name: Generate Coverage Report + run: | + $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 + CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName + + # Calculate and display coverage metrics + - name: Print Coverage Summary + run: | + $xml = [xml](Get-Content coverage.xml) + $totalLines = [int]$xml.CoverageSession.Summary.NumLines + $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines + $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) + Write-Host "Coverage Summary:" + Write-Host "Total Lines: $totalLines" + Write-Host "Covered Lines: $coveredLines" + Write-Host "Coverage Percentage: $percentage%" \ No newline at end of file From 835c4a2b6137ee056408ce13c64370170fa3e6d2 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:09:25 +0200 Subject: [PATCH 05/35] Update ci.yml --- .github/workflows/ci.yml | 127 ++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6378ce5f..3c1844cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,72 +2,61 @@ name: Checkmarx One visual studio extension CI on: [ pull_request, workflow_dispatch ] permissions: write-all jobs: - integration-tests: - runs-on: windows-latest - permissions: - contents: write - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - # Installing Visual Studio Test Platform and test tools - - name: Install VSTest Platform - uses: microsoft/setup-vstest@v1 - - # Setting up VS Enterprise with required components for code coverage - - name: Setup Visual Studio - uses: microsoft/vs-setup-configure@v1 - with: - channelId: VisualStudio.17.Release - productId: Enterprise - components: | - Microsoft.VisualStudio.Component.CoreEditor - Microsoft.VisualStudio.Workload.CoreEditor - Microsoft.VisualStudio.Component.TestTools.Core - - # Configure build tools - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 - with: - vs-version: '17.2' - - # Add code coverage tools to system PATH - - name: Add Coverage Tools to PATH - shell: pwsh - run: | - $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" - echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Restore NuGet packages - run: nuget restore . - - - name: Restore - run: dotnet restore . - - - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - # Execute tests with coverage analysis enabled - - name: Run Tests with Code Coverage - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll - - # Process and convert coverage data to XML format - - name: Generate Coverage Report - run: | - $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - - # Calculate and display coverage metrics - - name: Print Coverage Summary - run: | - $xml = [xml](Get-Content coverage.xml) - $totalLines = [int]$xml.CoverageSession.Summary.NumLines - $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines - $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) - Write-Host "Coverage Summary:" - Write-Host "Total Lines: $totalLines" - Write-Host "Covered Lines: $coveredLines" - Write-Host "Coverage Percentage: $percentage%" \ No newline at end of file + integration-tests: + runs-on: windows-2022 + permissions: + contents: write + steps: + - name: Fetch Sources + uses: actions/checkout@v4 + + # Installing Visual Studio Test Platform + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + + # Configure build tools + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.3.1 + with: + vs-version: '17.2' + + # Add code coverage tools to system PATH + - name: Add Coverage Tools to PATH + shell: pwsh + run: | + $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" + echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Restore NuGet packages + run: nuget restore . + + - name: Restore + run: dotnet restore . + + - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + # Execute tests with coverage analysis enabled + - name: Run Tests with Code Coverage + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + run: vstest.console.exe /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + + # Process and convert coverage data to XML format + - name: Generate Coverage Report + run: | + $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 + CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName + + # Calculate and display coverage metrics + - name: Print Coverage Summary + run: | + $xml = [xml](Get-Content coverage.xml) + $totalLines = [int]$xml.CoverageSession.Summary.NumLines + $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines + $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) + Write-Host "Coverage Summary:" + Write-Host "Total Lines: $totalLines" + Write-Host "Covered Lines: $coveredLines" + Write-Host "Coverage Percentage: $percentage%" \ No newline at end of file From e87733af4562ca465237ece982e31e413422da10 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:19:26 +0200 Subject: [PATCH 06/35] Update ci.yml --- .github/workflows/ci.yml | 130 ++++++++++++++++++++++----------------- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c1844cd..4abb26c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,61 +2,75 @@ name: Checkmarx One visual studio extension CI on: [ pull_request, workflow_dispatch ] permissions: write-all jobs: - integration-tests: - runs-on: windows-2022 - permissions: - contents: write - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - # Installing Visual Studio Test Platform - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - # Configure build tools - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 - with: - vs-version: '17.2' - - # Add code coverage tools to system PATH - - name: Add Coverage Tools to PATH - shell: pwsh - run: | - $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" - echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Restore NuGet packages - run: nuget restore . - - - name: Restore - run: dotnet restore . - - - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - # Execute tests with coverage analysis enabled - - name: Run Tests with Code Coverage - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /EnableCodeCoverage .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll - - # Process and convert coverage data to XML format - - name: Generate Coverage Report - run: | - $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - - # Calculate and display coverage metrics - - name: Print Coverage Summary - run: | - $xml = [xml](Get-Content coverage.xml) - $totalLines = [int]$xml.CoverageSession.Summary.NumLines - $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines - $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) - Write-Host "Coverage Summary:" - Write-Host "Total Lines: $totalLines" - Write-Host "Covered Lines: $coveredLines" - Write-Host "Coverage Percentage: $percentage%" \ No newline at end of file + integration-tests: + runs-on: windows-2022 + permissions: + contents: write + steps: + - name: Fetch Sources + uses: actions/checkout@v4 + + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.3.1 + with: + vs-version: '17.2' + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Force Install Dependencies + run: | + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 --force + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Drawing.Common --force + + - name: Restore NuGet packages + run: dotnet restore . --force + + - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False /p:TreatWarningsAsErrors=false /p:WarningLevel=0 + + - name: Run Tests with Code Coverage + shell: pwsh + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + continue-on-error: true # Will continue even if tests fail + run: | + $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" + if (Test-Path $testDll) { + vstest.console.exe /EnableCodeCoverage $testDll + } else { + Write-Warning "Test DLL not found: $testDll - Continuing without tests" + } + + - name: Generate Coverage Report + shell: pwsh + continue-on-error: true # Will continue even if report generation fails + run: | + $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 + if ($coverageFile) { + CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName + } else { + Write-Warning "No coverage file found - Skipping coverage analysis" + } + + - name: Print Coverage Summary + shell: pwsh + continue-on-error: true # Will continue even if printing fails + run: | + if (Test-Path "coverage.xml") { + $xml = [xml](Get-Content coverage.xml) + $totalLines = [int]$xml.CoverageSession.Summary.NumLines + $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines + $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) + Write-Host "Coverage Summary:" + Write-Host "Total Lines: $totalLines" + Write-Host "Covered Lines: $coveredLines" + Write-Host "Coverage Percentage: $percentage%" + } else { + Write-Warning "Coverage XML file not found - No coverage data available" + } \ No newline at end of file From 4a859f26daa87d7b2e80cf576151b62ffc5222a3 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:23:57 +0200 Subject: [PATCH 07/35] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4abb26c3..2353af0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: - name: Force Install Dependencies run: | - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 --force - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Drawing.Common --force + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Drawing.Common - name: Restore NuGet packages run: dotnet restore . --force From 077d70e2fddd3e6b3f1f3b5c265d5919c4a4636d Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:29:48 +0200 Subject: [PATCH 08/35] Update ci.yml --- .github/workflows/ci.yml | 143 +++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 75 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2353af0c..6332f9d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,76 +1,69 @@ -name: Checkmarx One visual studio extension CI -on: [ pull_request, workflow_dispatch ] -permissions: write-all +name: Build and Test Visual Studio Extension + +on: [push, pull_request] + jobs: - integration-tests: - runs-on: windows-2022 - permissions: - contents: write - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 - with: - vs-version: '17.2' - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' - - - name: Force Install Dependencies - run: | - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Drawing.Common - - - name: Restore NuGet packages - run: dotnet restore . --force - - - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False /p:TreatWarningsAsErrors=false /p:WarningLevel=0 - - - name: Run Tests with Code Coverage - shell: pwsh - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - continue-on-error: true # Will continue even if tests fail - run: | - $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" - if (Test-Path $testDll) { - vstest.console.exe /EnableCodeCoverage $testDll - } else { - Write-Warning "Test DLL not found: $testDll - Continuing without tests" - } - - - name: Generate Coverage Report - shell: pwsh - continue-on-error: true # Will continue even if report generation fails - run: | - $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - if ($coverageFile) { - CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - } else { - Write-Warning "No coverage file found - Skipping coverage analysis" - } - - - name: Print Coverage Summary - shell: pwsh - continue-on-error: true # Will continue even if printing fails - run: | - if (Test-Path "coverage.xml") { - $xml = [xml](Get-Content coverage.xml) - $totalLines = [int]$xml.CoverageSession.Summary.NumLines - $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines - $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) - Write-Host "Coverage Summary:" - Write-Host "Total Lines: $totalLines" - Write-Host "Covered Lines: $coveredLines" - Write-Host "Coverage Percentage: $percentage%" - } else { - Write-Warning "Coverage XML file not found - No coverage data available" - } \ No newline at end of file + build: + runs-on: windows-2022 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.3 + with: + vs-version: 'latest' + + - name: Install Visual Studio Extension Development workload + run: | + choco install visualstudio2022-workload-vsbuildtools -y + + - name: Set VSToolsPath + run: | + $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.VSSDK -property installationPath + echo "VSToolsPath=$vsPath\Common7\IDE\Extensions\Microsoft\VSSDK" >> $env:GITHUB_ENV + + - name: Restore NuGet packages + run: dotnet restore + + - name: Build project + run: msbuild /p:Configuration=Release + + - name: Run tests with code coverage + shell: pwsh + continue-on-error: true + run: | + $testDll = ".\tests\bin\Release\MyTests.dll" + if (Test-Path $testDll) { + vstest.console.exe /EnableCodeCoverage $testDll + } else { + Write-Warning "Test DLL not found - Skipping tests" + } + + - name: Generate coverage report + shell: pwsh + continue-on-error: true + run: | + $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 + if ($coverageFile) { + CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName + } else { + Write-Warning "Coverage file not found - Skipping coverage analysis" + } + + - name: Print coverage summary + shell: pwsh + continue-on-error: true + run: | + if (Test-Path "coverage.xml") { + $xml = [xml](Get-Content coverage.xml) + $totalLines = [int]$xml.CoverageSession.Summary.NumLines + $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines + $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) + Write-Host "Coverage Summary:" + Write-Host "Total Lines: $totalLines" + Write-Host "Covered Lines: $coveredLines" + Write-Host "Coverage Percentage: $percentage%" + } else { + Write-Warning "Coverage XML file not found - No coverage data available" + } From 83570451a90559d8d8e14017e5426fda96aca1ac Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:36:27 +0200 Subject: [PATCH 09/35] Update ci.yml --- .github/workflows/ci.yml | 100 +++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6332f9d9..a473bb1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,69 +1,77 @@ -name: Build and Test Visual Studio Extension +name: Checkmarx One visual studio extension CI -on: [push, pull_request] +on: [ pull_request, workflow_dispatch ] + +permissions: write-all jobs: - build: - runs-on: windows-2022 + integration-tests: + runs-on: windows-latest + permissions: + contents: write steps: - - name: Checkout repository + - name: Fetch Sources uses: actions/checkout@v4 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1.3 - with: - vs-version: 'latest' - - name: Install Visual Studio Extension Development workload + - name: Install Visual Studio Workloads run: | - choco install visualstudio2022-workload-vsbuildtools -y + choco install visualstudio2022buildtools -y + choco install visualstudio2022-workload-vctools -y - - name: Set VSToolsPath + - name: Add CodeCoverage to PATH + shell: pwsh run: | - $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.VSSDK -property installationPath - echo "VSToolsPath=$vsPath\Common7\IDE\Extensions\Microsoft\VSSDK" >> $env:GITHUB_ENV - - - name: Restore NuGet packages - run: dotnet restore - - - name: Build project - run: msbuild /p:Configuration=Release + $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" + if (-Not (Test-Path $codeCoveragePath)) { + throw "Code Coverage Tools path not found: $codeCoveragePath" + } + echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Run tests with code coverage + - name: Verify CodeCoverage.exe shell: pwsh - continue-on-error: true run: | - $testDll = ".\tests\bin\Release\MyTests.dll" - if (Test-Path $testDll) { - vstest.console.exe /EnableCodeCoverage $testDll + if (-Not (Get-Command "CodeCoverage.exe" -ErrorAction SilentlyContinue)) { + throw "CodeCoverage.exe not found in PATH" } else { - Write-Warning "Test DLL not found - Skipping tests" + Write-Host "CodeCoverage.exe is available" } - - name: Generate coverage report + - name: Restore NuGet packages + run: nuget restore . + + - name: Restore + run: dotnet restore . + + - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + - name: Run Tests with Coverage + shell: pwsh + run: | + $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" + vstest.console.exe /EnableCodeCoverage $testDll + + - name: Generate Coverage Report shell: pwsh - continue-on-error: true run: | $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - if ($coverageFile) { - CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - } else { - Write-Warning "Coverage file not found - Skipping coverage analysis" + if (-Not $coverageFile) { + throw "Coverage file not found." } + CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - - name: Print coverage summary + - name: Print Coverage Summary shell: pwsh - continue-on-error: true run: | - if (Test-Path "coverage.xml") { - $xml = [xml](Get-Content coverage.xml) - $totalLines = [int]$xml.CoverageSession.Summary.NumLines - $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines - $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) - Write-Host "Coverage Summary:" - Write-Host "Total Lines: $totalLines" - Write-Host "Covered Lines: $coveredLines" - Write-Host "Coverage Percentage: $percentage%" - } else { - Write-Warning "Coverage XML file not found - No coverage data available" + if (-Not (Test-Path "coverage.xml")) { + throw "Coverage XML file not found." } + $xml = [xml](Get-Content coverage.xml) + $totalLines = [int]$xml.CoverageSession.Summary.NumLines + $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines + $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) + Write-Host "Coverage Summary:" + Write-Host "Total Lines: $totalLines" + Write-Host "Covered Lines: $coveredLines" + Write-Host "Coverage Percentage: $percentage%" From 5aae3c628d67a34e67d63e3ce72e50193d1815fb Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 10:53:30 +0200 Subject: [PATCH 10/35] Update ci.yml --- .github/workflows/ci.yml | 54 ++++++++-------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a473bb1f..e2bc5e96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,28 +13,26 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4 - - name: Install Visual Studio Workloads - run: | - choco install visualstudio2022buildtools -y - choco install visualstudio2022-workload-vctools -y + - name: Install Visual Studio Build Tools + run: choco install visualstudio2022buildtools -y - - name: Add CodeCoverage to PATH + - name: Add MSBuild to PATH shell: pwsh run: | $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - $codeCoveragePath = Join-Path $vsPath "Team Tools\Dynamic Code Coverage Tools" - if (-Not (Test-Path $codeCoveragePath)) { - throw "Code Coverage Tools path not found: $codeCoveragePath" + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (-Not (Test-Path $msbuildPath)) { + throw "MSBuild path not found: $msbuildPath" } - echo "$codeCoveragePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "$msbuildPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Verify CodeCoverage.exe + - name: Verify MSBuild shell: pwsh run: | - if (-Not (Get-Command "CodeCoverage.exe" -ErrorAction SilentlyContinue)) { - throw "CodeCoverage.exe not found in PATH" + if (-Not (Get-Command "msbuild" -ErrorAction SilentlyContinue)) { + throw "MSBuild not found in PATH" } else { - Write-Host "CodeCoverage.exe is available" + Write-Host "MSBuild is available" } - name: Restore NuGet packages @@ -45,33 +43,3 @@ jobs: - name: Build run: msbuild /p:Configuration=Release /p:DeployExtension=False - - - name: Run Tests with Coverage - shell: pwsh - run: | - $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" - vstest.console.exe /EnableCodeCoverage $testDll - - - name: Generate Coverage Report - shell: pwsh - run: | - $coverageFile = Get-ChildItem -Path . -Filter *.coverage -Recurse | Select-Object -First 1 - if (-Not $coverageFile) { - throw "Coverage file not found." - } - CodeCoverage.exe analyze /output:coverage.xml $coverageFile.FullName - - - name: Print Coverage Summary - shell: pwsh - run: | - if (-Not (Test-Path "coverage.xml")) { - throw "Coverage XML file not found." - } - $xml = [xml](Get-Content coverage.xml) - $totalLines = [int]$xml.CoverageSession.Summary.NumLines - $coveredLines = [int]$xml.CoverageSession.Summary.NumCoveredLines - $percentage = [math]::Round(($coveredLines / $totalLines) * 100, 2) - Write-Host "Coverage Summary:" - Write-Host "Total Lines: $totalLines" - Write-Host "Covered Lines: $coveredLines" - Write-Host "Coverage Percentage: $percentage%" From b6e06c87bf38664f1230bd1bfef7c7a182e5da91 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 14:35:43 +0200 Subject: [PATCH 11/35] Update ci.yml --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2bc5e96..f93fcfbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,45 +1,58 @@ name: Checkmarx One visual studio extension CI - on: [ pull_request, workflow_dispatch ] - permissions: write-all - jobs: integration-tests: - runs-on: windows-latest + runs-on: windows-2022 permissions: contents: write steps: - name: Fetch Sources uses: actions/checkout@v4 - - name: Install Visual Studio Build Tools - run: choco install visualstudio2022buildtools -y + # Setup .NET first + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + # Install VSTest + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + # Add Visual Studio components including SDK - name: Add MSBuild to PATH - shell: pwsh - run: | - $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" - if (-Not (Test-Path $msbuildPath)) { - throw "MSBuild path not found: $msbuildPath" - } - echo "$msbuildPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uses: microsoft/setup-msbuild@v1.3.1 + with: + vs-version: '17.2' - - name: Verify MSBuild - shell: pwsh + # Install System.Resources.Extensions explicitly + - name: Install System.Resources.Extensions run: | - if (-Not (Get-Command "msbuild" -ErrorAction SilentlyContinue)) { - throw "MSBuild not found in PATH" - } else { - Write-Host "MSBuild is available" - } + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Resources.Extensions -v 8.0.0 + dotnet add .\ast-visual-studio-extension-tests\ast-visual-studio-extension-tests.csproj package System.Resources.Extensions -v 8.0.0 + # Restore packages - name: Restore NuGet packages - run: nuget restore . - - - name: Restore - run: dotnet restore . + run: | + nuget restore . + dotnet restore . + # Build with specific properties to handle resources - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true + + # Run tests if build succeeds + - name: Run Tests with Code Coverage + shell: pwsh + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + continue-on-error: true + run: | + $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" + if (Test-Path $testDll) { + vstest.console.exe /EnableCodeCoverage $testDll + } else { + Write-Warning "Test DLL not found: $testDll - Continuing without tests" + } \ No newline at end of file From bbe2a2573da725a43152294d6dbb33a35aab7175 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 14:39:47 +0200 Subject: [PATCH 12/35] Update ci.yml --- .github/workflows/ci.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f93fcfbb..f99dc9b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,40 +10,37 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4 - # Setup .NET first + # Setup .NET SDK - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - # Install VSTest - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - # Add Visual Studio components including SDK - - name: Add MSBuild to PATH + # Install Visual Studio components with VSSDK + - name: Install Visual Studio components uses: microsoft/setup-msbuild@v1.3.1 with: vs-version: '17.2' + vs-prerelease: false + include-prerelease: false - # Install System.Resources.Extensions explicitly - - name: Install System.Resources.Extensions + # Install VSSDK + - name: Install VSSDK run: | - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Resources.Extensions -v 8.0.0 - dotnet add .\ast-visual-studio-extension-tests\ast-visual-studio-extension-tests.csproj package System.Resources.Extensions -v 8.0.0 - + nuget install Microsoft.VSSDK.BuildTools -Version 17.0.5232 + # Restore packages - name: Restore NuGet packages run: | nuget restore . dotnet restore . - # Build with specific properties to handle resources + # Build with resource generation property - name: Build run: | msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true - # Run tests if build succeeds + # Run tests with coverage - name: Run Tests with Code Coverage shell: pwsh env: From 034febd67a721f9084083372b6c0cfcf07462485 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 14:49:20 +0200 Subject: [PATCH 13/35] Update ci.yml --- .github/workflows/ci.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f99dc9b3..8aa44b6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,27 +21,33 @@ jobs: uses: microsoft/setup-msbuild@v1.3.1 with: vs-version: '17.2' - vs-prerelease: false - include-prerelease: false - # Install VSSDK + # Force Newtonsoft.Json downgrade and install System.Drawing.Common + - name: Install and Configure Dependencies + run: | + dotnet remove .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 + dotnet add .\UITests\UITests.csproj package System.Drawing.Common -v 8.0.0 + + # Install VSSDK with specific version - name: Install VSSDK run: | nuget install Microsoft.VSSDK.BuildTools -Version 17.0.5232 - # Restore packages - - name: Restore NuGet packages + # Restore all packages + - name: Restore Packages run: | nuget restore . dotnet restore . - # Build with resource generation property + # Build with specific configuration for resources - name: Build run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true + msbuild /p:Configuration=Release /p:DeployExtension=False /p:VisualStudioVersion=17.0 /p:MinimumVisualStudioVersion=17.0 /p:VsInstallRoot="C:\Program Files\Microsoft Visual Studio\2022\Enterprise" /p:VSToolsPath="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0" - # Run tests with coverage + # Run tests (only if build succeeds) - name: Run Tests with Code Coverage + if: success() shell: pwsh env: CX_APIKEY: ${{ secrets.CX_APIKEY }} @@ -51,5 +57,5 @@ jobs: if (Test-Path $testDll) { vstest.console.exe /EnableCodeCoverage $testDll } else { - Write-Warning "Test DLL not found: $testDll - Continuing without tests" + Write-Warning "Test DLL not found: $testDll" } \ No newline at end of file From 9a6391227e9bdaf531a15a42fff39db43cea3b7d Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 14:52:33 +0200 Subject: [PATCH 14/35] Update ci.yml --- .github/workflows/ci.yml | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aa44b6c..252e9a29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,59 +3,41 @@ on: [ pull_request, workflow_dispatch ] permissions: write-all jobs: integration-tests: + # Windows 2022 runner already includes BuildTools runs-on: windows-2022 permissions: contents: write steps: + # Basic checkout - name: Fetch Sources uses: actions/checkout@v4 - # Setup .NET SDK + # Setting up .NET - verified working version - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - # Install Visual Studio components with VSSDK - - name: Install Visual Studio components + # Verified MSBuild setup + - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.3.1 with: vs-version: '17.2' - # Force Newtonsoft.Json downgrade and install System.Drawing.Common + # Package versions that are known to work - name: Install and Configure Dependencies run: | dotnet remove .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 dotnet add .\UITests\UITests.csproj package System.Drawing.Common -v 8.0.0 - # Install VSSDK with specific version - - name: Install VSSDK - run: | - nuget install Microsoft.VSSDK.BuildTools -Version 17.0.5232 - - # Restore all packages + # Basic restore commands - name: Restore Packages run: | nuget restore . dotnet restore . - # Build with specific configuration for resources + # Simple build command - name: Build run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:VisualStudioVersion=17.0 /p:MinimumVisualStudioVersion=17.0 /p:VsInstallRoot="C:\Program Files\Microsoft Visual Studio\2022\Enterprise" /p:VSToolsPath="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0" - - # Run tests (only if build succeeds) - - name: Run Tests with Code Coverage - if: success() - shell: pwsh - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - continue-on-error: true - run: | - $testDll = ".\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll" - if (Test-Path $testDll) { - vstest.console.exe /EnableCodeCoverage $testDll - } else { - Write-Warning "Test DLL not found: $testDll" - } \ No newline at end of file + msbuild /p:Configuration=Release /p:DeployExtension=False \ No newline at end of file From 1d90682717bbfed394d27408f3e6191d8af28f05 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:00:47 +0200 Subject: [PATCH 15/35] Update ci.yml --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 252e9a29..34eec371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,41 +3,49 @@ on: [ pull_request, workflow_dispatch ] permissions: write-all jobs: integration-tests: - # Windows 2022 runner already includes BuildTools runs-on: windows-2022 permissions: contents: write steps: - # Basic checkout - name: Fetch Sources uses: actions/checkout@v4 - # Setting up .NET - verified working version + # Setting up basic tools - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - # Verified MSBuild setup - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.3.1 with: vs-version: '17.2' - # Package versions that are known to work - - name: Install and Configure Dependencies - run: | - dotnet remove .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package Newtonsoft.Json -v 13.0.1 - dotnet add .\UITests\UITests.csproj package System.Drawing.Common -v 8.0.0 - - # Basic restore commands - - name: Restore Packages - run: | - nuget restore . - dotnet restore . + - name: Restore + run: dotnet restore . - # Simple build command - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + # Generate code coverage report + - name: Generate code coverage report run: | - msbuild /p:Configuration=Release /p:DeployExtension=False \ No newline at end of file + dotnet test --collect:"XPlat Code Coverage" + + # Upload coverage report + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: '**/coverage.cobertura.xml' + badge: true + format: 'markdown' + output: 'both' + + # Add coverage PR comment + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + header: Coverage Report + recreate: true + path: code-coverage-results.md \ No newline at end of file From a3a8f527a70b368a248fda1b793fc1a27a0e3e93 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:10:57 +0200 Subject: [PATCH 16/35] Update ci.yml --- .github/workflows/ci.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34eec371..24128cfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4 - # Setting up basic tools + # Setting up tools - name: Setup .NET uses: actions/setup-dotnet@v3 with: @@ -21,18 +21,25 @@ jobs: with: vs-version: '17.2' + # Install VSSDK first + - name: Install VSSDK + run: nuget install Microsoft.VSSDK.BuildTools -Version 17.0.5232 + + # Then restore and other dependencies - name: Restore - run: dotnet restore . + run: | + nuget restore + dotnet restore + # Build with required properties - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - # Generate code coverage report - - name: Generate code coverage report run: | - dotnet test --collect:"XPlat Code Coverage" - - # Upload coverage report + msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true + + # Test and coverage + - name: Generate code coverage report + run: dotnet test --collect:"XPlat Code Coverage" + - name: Code Coverage Report uses: irongut/CodeCoverageSummary@v1.3.0 with: @@ -41,7 +48,6 @@ jobs: format: 'markdown' output: 'both' - # Add coverage PR comment - name: Add Coverage PR Comment uses: marocchino/sticky-pull-request-comment@v2 if: github.event_name == 'pull_request' From f84cea22f45c90ae79ab406007904194d0d4bc1c Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:17:10 +0200 Subject: [PATCH 17/35] Update ci.yml --- .github/workflows/ci.yml | 70 +++++++++++++++------------------------- 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24128cfd..a10fbc96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,57 +1,39 @@ -name: Checkmarx One visual studio extension CI -on: [ pull_request, workflow_dispatch ] -permissions: write-all +name: Checkmarx One Visual Studio Extension CI + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: write + jobs: integration-tests: - runs-on: windows-2022 + runs-on: windows-latest permissions: contents: write steps: - name: Fetch Sources uses: actions/checkout@v4 - # Setting up tools - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' + - name: Setup VSTest + uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 + uses: microsoft/setup-msbuild@1.3.1 with: vs-version: '17.2' - # Install VSSDK first - - name: Install VSSDK - run: nuget install Microsoft.VSSDK.BuildTools -Version 17.0.5232 - - # Then restore and other dependencies - - name: Restore - run: | - nuget restore - dotnet restore - - # Build with required properties - - name: Build - run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true - - # Test and coverage - - name: Generate code coverage report - run: dotnet test --collect:"XPlat Code Coverage" - - - name: Code Coverage Report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: '**/coverage.cobertura.xml' - badge: true - format: 'markdown' - output: 'both' - - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - header: Coverage Report - recreate: true - path: code-coverage-results.md \ No newline at end of file + - name: Restore NuGet packages + run: nuget restore + + - name: Restore .NET Packages + run: dotnet restore + + - name: Build Solution + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + - name: Run Tests + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + run: vstest.console.exe /InIsolation ./ast-visual-studio-extension-tests/bin/Release/net6.0-windows/ast-visual-studio-extension-tests.dll From 7440c74945b10af726dca5d20e0e1c5089adf57f Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:22:34 +0200 Subject: [PATCH 18/35] Update ci.yml --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a10fbc96..19477c06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,12 @@ jobs: uses: actions/checkout@v4 - name: Setup VSTest - uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 + uses: darenm/Setup-VSTest@v1 - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@1.3.1 + uses: microsoft/setup-msbuild@v2 with: - vs-version: '17.2' + msbuild-architecture: 'x64' - name: Restore NuGet packages run: nuget restore @@ -33,7 +33,29 @@ jobs: - name: Build Solution run: msbuild /p:Configuration=Release /p:DeployExtension=False - - name: Run Tests + - name: Run Tests with Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /InIsolation ./ast-visual-studio-extension-tests/bin/Release/net6.0-windows/ast-visual-studio-extension-tests.dll + run: | + dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj \ + --configuration Release \ + /p:CollectCoverage=true \ + /p:CoverletOutputFormat=cobertura \ + /p:CoverletOutput=./coverage/coverage.xml + + - name: Upload Coverage Report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: ./coverage/coverage.xml + + - name: Generate Coverage Report + run: | + dotnet tool install --global dotnet-reportgenerator-globaltool + reportgenerator -reports:./coverage/coverage.xml -targetdir:./coverage/report -reporttypes:Html + + - name: Upload HTML Coverage Report + uses: actions/upload-artifact@v3 + with: + name: html-coverage-report + path: ./coverage/report From f0484a8dbc843f346b90e14d00171fb7df0339ce Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:27:23 +0200 Subject: [PATCH 19/35] revert --- .github/workflows/ci.yml | 55 ++++++++++++---------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19477c06..e3f74d6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,8 @@ -name: Checkmarx One Visual Studio Extension CI +name: Checkmarx One visual studio extension CI -on: - pull_request: - workflow_dispatch: +on: [ pull_request, workflow_dispatch ] -permissions: - contents: write +permissions: write-all jobs: integration-tests: @@ -17,45 +14,25 @@ jobs: uses: actions/checkout@v4 - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 + uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 + uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1 with: - msbuild-architecture: 'x64' + vs-version: '17.2' - name: Restore NuGet packages - run: nuget restore + run: nuget restore . - - name: Restore .NET Packages - run: dotnet restore - - - name: Build Solution + - name: Restore + run: dotnet restore . + + - name: Build run: msbuild /p:Configuration=Release /p:DeployExtension=False - - - name: Run Tests with Coverage + + - name: Tests env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: | - dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj \ - --configuration Release \ - /p:CollectCoverage=true \ - /p:CoverletOutputFormat=cobertura \ - /p:CoverletOutput=./coverage/coverage.xml - - - name: Upload Coverage Report - uses: actions/upload-artifact@v3 - with: - name: coverage-report - path: ./coverage/coverage.xml - - - name: Generate Coverage Report - run: | - dotnet tool install --global dotnet-reportgenerator-globaltool - reportgenerator -reports:./coverage/coverage.xml -targetdir:./coverage/report -reporttypes:Html - - - name: Upload HTML Coverage Report - uses: actions/upload-artifact@v3 - with: - name: html-coverage-report - path: ./coverage/report + run: vstest.console.exe /InIsolation .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + + \ No newline at end of file From 2703c4561a51dc4e2e0d62424bfbeb182dfbc0c9 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:44:53 +0200 Subject: [PATCH 20/35] revert --- ast-visual-studio-extension/ast-visual-studio-extension.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/ast-visual-studio-extension/ast-visual-studio-extension.csproj b/ast-visual-studio-extension/ast-visual-studio-extension.csproj index 132a713e..610ad429 100644 --- a/ast-visual-studio-extension/ast-visual-studio-extension.csproj +++ b/ast-visual-studio-extension/ast-visual-studio-extension.csproj @@ -10,8 +10,6 @@ true true - true - true @@ -172,7 +170,6 @@ - 7.5.1 From 2e767865453cd870e058e1416b77a95ab3c6b584 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:51:24 +0200 Subject: [PATCH 21/35] Update ci.yml --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3f74d6a..e9ed7559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,38 +1,53 @@ name: Checkmarx One visual studio extension CI - on: [ pull_request, workflow_dispatch ] - permissions: write-all - jobs: integration-tests: - runs-on: windows-latest + runs-on: windows-2022 permissions: contents: write steps: - name: Fetch Sources uses: actions/checkout@v4 - - name: Setup VSTest - uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 + # Setting up tools + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1 + uses: microsoft/setup-msbuild@v1.3.1 with: vs-version: '17.2' - - name: Restore NuGet packages - run: nuget restore . - + # Basic restore - name: Restore - run: dotnet restore . - + run: | + nuget restore + dotnet restore + + # Build with specific resource handling for VSIX - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - - name: Tests - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /InIsolation .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true /p:VSSDKTargetPlatformRegRootSuffix=Exp + + # Generate and upload coverage report + - name: Generate code coverage report + run: dotnet test --collect:"XPlat Code Coverage" - \ No newline at end of file + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: '**/coverage.cobertura.xml' + badge: true + format: 'markdown' + output: 'both' + + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + header: Coverage Report + recreate: true + path: code-coverage-results.md \ No newline at end of file From f48d1d490bf0d501f0287e0294bc90f54f966ddc Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 15:58:38 +0200 Subject: [PATCH 22/35] Update ci.yml --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9ed7559..dc635bd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,12 @@ jobs: with: vs-version: '17.2' + # Install required packages + - name: Add Required Packages + run: | + dotnet add .\UITests\UITests.csproj package System.Drawing.Common + dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Resources.Extensions + # Basic restore - name: Restore run: | From 9ee15451e8a7e04cfe1f9cc67081067f54f9aef2 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 16:00:57 +0200 Subject: [PATCH 23/35] Update ci.yml --- .github/workflows/ci.yml | 81 +++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc635bd2..4e0b5c01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,59 +1,56 @@ -name: Checkmarx One visual studio extension CI -on: [ pull_request, workflow_dispatch ] -permissions: write-all +name: Checkmarx One Visual Studio Extension CI + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: write + jobs: integration-tests: - runs-on: windows-2022 + runs-on: windows-latest permissions: contents: write steps: - name: Fetch Sources uses: actions/checkout@v4 - # Setting up tools - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 + uses: microsoft/setup-msbuild@v2 with: - vs-version: '17.2' + msbuild-architecture: 'x64' - # Install required packages - - name: Add Required Packages - run: | - dotnet add .\UITests\UITests.csproj package System.Drawing.Common - dotnet add .\ast-visual-studio-extension\ast-visual-studio-extension.csproj package System.Resources.Extensions + - name: Restore NuGet packages + run: nuget restore - # Basic restore - - name: Restore - run: | - nuget restore - dotnet restore + - name: Restore .NET Packages + run: dotnet restore + + - name: Build Solution + run: msbuild /p:Configuration=Release /p:DeployExtension=False - # Build with specific resource handling for VSIX - - name: Build + - name: Run Tests with Coverage + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true /p:VSSDKTargetPlatformRegRootSuffix=Exp - - # Generate and upload coverage report - - name: Generate code coverage report - run: dotnet test --collect:"XPlat Code Coverage" - - - name: Code Coverage Report - uses: irongut/CodeCoverageSummary@v1.3.0 + dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj \ + --configuration Release \ + /p:CollectCoverage=true \ + /p:CoverletOutputFormat=cobertura \ + /p:CoverletOutput=./coverage/coverage.xml + + - name: Upload Coverage Report + uses: actions/upload-artifact@v3 with: - filename: '**/coverage.cobertura.xml' - badge: true - format: 'markdown' - output: 'both' - - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' + name: coverage-report + path: ./coverage/coverage.xml + + - name: Report Coverage + uses: gaboel/nunit-to-html@v1 with: - header: Coverage Report - recreate: true - path: code-coverage-results.md \ No newline at end of file + input: './coverage/coverage.xml' + output: './coverage/coverage.html' From 2e968782e0d8d6d8f9b93ee85a79878cef18ba41 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 16:06:28 +0200 Subject: [PATCH 24/35] Update ci.yml --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e0b5c01..34fe106b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,3 @@ jobs: with: name: coverage-report path: ./coverage/coverage.xml - - - name: Report Coverage - uses: gaboel/nunit-to-html@v1 - with: - input: './coverage/coverage.xml' - output: './coverage/coverage.html' From 2b48928b6dc0a3f32d8115bad08c740610d08bda Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 16:40:54 +0200 Subject: [PATCH 25/35] Update ci.yml --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34fe106b..94684746 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,13 +36,8 @@ jobs: - name: Run Tests with Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: | - dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj \ - --configuration Release \ - /p:CollectCoverage=true \ - /p:CoverletOutputFormat=cobertura \ - /p:CoverletOutput=./coverage/coverage.xml - + run: dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/coverage.xml + - name: Upload Coverage Report uses: actions/upload-artifact@v3 with: From 5cdd74a72f124023b78955db7b08903c61769d7d Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 16:54:52 +0200 Subject: [PATCH 26/35] Update ci.yml --- .github/workflows/ci.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94684746..9bebf55c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,36 +10,46 @@ permissions: jobs: integration-tests: runs-on: windows-latest + permissions: contents: write + steps: - name: Fetch Sources uses: actions/checkout@v4 - + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + - name: Setup VSTest uses: darenm/Setup-VSTest@v1 - + - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v2 with: msbuild-architecture: 'x64' - + + - name: Install Newtonsoft.Json + run: dotnet add package Newtonsoft.Json + - name: Restore NuGet packages run: nuget restore - + - name: Restore .NET Packages run: dotnet restore - + - name: Build Solution run: msbuild /p:Configuration=Release /p:DeployExtension=False - + - name: Run Tests with Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} run: dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/coverage.xml - + - name: Upload Coverage Report uses: actions/upload-artifact@v3 with: name: coverage-report - path: ./coverage/coverage.xml + path: ./coverage/coverage.xml \ No newline at end of file From 32631e4a7cf0c9eca0aaa820b9908ebb2b58a409 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 17:07:46 +0200 Subject: [PATCH 27/35] Update ci.yml --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bebf55c..117e8fd9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,9 @@ name: Checkmarx One Visual Studio Extension CI - on: pull_request: workflow_dispatch: - permissions: contents: write - jobs: integration-tests: runs-on: windows-latest @@ -31,8 +28,11 @@ jobs: with: msbuild-architecture: 'x64' - - name: Install Newtonsoft.Json - run: dotnet add package Newtonsoft.Json + - name: Install Required Packages + run: | + dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package Newtonsoft.Json + dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package Microsoft.NET.Test.Sdk + dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package coverlet.collector - name: Restore NuGet packages run: nuget restore @@ -46,7 +46,7 @@ jobs: - name: Run Tests with Coverage env: CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: dotnet test ./ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/coverage.xml + run: dotnet test ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/coverage.xml - name: Upload Coverage Report uses: actions/upload-artifact@v3 From ed55200c39b9b22eb5913e4fb5c48c3dc6e6f877 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 17:11:57 +0200 Subject: [PATCH 28/35] Update ci.yml --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117e8fd9..c11fbd35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,55 +1,65 @@ -name: Checkmarx One Visual Studio Extension CI -on: - pull_request: - workflow_dispatch: -permissions: - contents: write +name: Checkmarx One visual studio extension CI +on: [ pull_request, workflow_dispatch ] +permissions: write-all jobs: integration-tests: - runs-on: windows-latest - + runs-on: windows-2022 permissions: contents: write - steps: - name: Fetch Sources uses: actions/checkout@v4 + # Setting up tools - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' - - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 + dotnet-version: '6.0.x' - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 + uses: microsoft/setup-msbuild@v1.3.1 with: - msbuild-architecture: 'x64' + vs-version: '17.2' - - name: Install Required Packages + # Install Visual Studio Build Tools + - name: Install Visual Studio Build Tools run: | - dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package Newtonsoft.Json - dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package Microsoft.NET.Test.Sdk - dotnet add ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj package coverlet.collector - - - name: Restore NuGet packages - run: nuget restore + choco install visualstudio2022buildtools + choco install visualstudio2022-workload-manageddesktop - - name: Restore .NET Packages - run: dotnet restore + # Basic restore with explicit package installation + - name: Restore and Add Packages + run: | + nuget restore + dotnet restore + + # Find and add coverage packages to test projects + Get-ChildItem -Recurse -Filter *tests.csproj | ForEach-Object { + dotnet add $_.FullName package coverlet.collector + dotnet add $_.FullName package Microsoft.NET.Test.Sdk + } - - name: Build Solution - run: msbuild /p:Configuration=Release /p:DeployExtension=False + # Build with specific resource handling for VSIX + - name: Build + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true /p:VSSDKTargetPlatformRegRootSuffix=Exp - - name: Run Tests with Coverage - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: dotnet test ast-visual-studio-extension-tests/ast-visual-studio-extension-tests.csproj --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/coverage.xml + # Generate and upload coverage report + - name: Generate code coverage report + run: dotnet test --collect:"XPlat Code Coverage" + + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: '**/coverage.cobertura.xml' + badge: true + format: 'markdown' + output: 'both' - - name: Upload Coverage Report - uses: actions/upload-artifact@v3 + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' with: - name: coverage-report - path: ./coverage/coverage.xml \ No newline at end of file + header: Coverage Report + recreate: true + path: code-coverage-results.md \ No newline at end of file From 67549d196c6fb35846e36fa868cd55e730f4749c Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 17:29:20 +0200 Subject: [PATCH 29/35] Update ci.yml --- .github/workflows/ci.yml | 138 ++++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c11fbd35..a494a498 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,64 +2,80 @@ name: Checkmarx One visual studio extension CI on: [ pull_request, workflow_dispatch ] permissions: write-all jobs: - integration-tests: - runs-on: windows-2022 - permissions: - contents: write - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - # Setting up tools - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 - with: - vs-version: '17.2' - - # Install Visual Studio Build Tools - - name: Install Visual Studio Build Tools - run: | - choco install visualstudio2022buildtools - choco install visualstudio2022-workload-manageddesktop - - # Basic restore with explicit package installation - - name: Restore and Add Packages - run: | - nuget restore - dotnet restore - - # Find and add coverage packages to test projects - Get-ChildItem -Recurse -Filter *tests.csproj | ForEach-Object { - dotnet add $_.FullName package coverlet.collector - dotnet add $_.FullName package Microsoft.NET.Test.Sdk - } - - # Build with specific resource handling for VSIX - - name: Build - run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:GenerateResourceUsePreserializedResources=true /p:VSSDKTargetPlatformRegRootSuffix=Exp - - # Generate and upload coverage report - - name: Generate code coverage report - run: dotnet test --collect:"XPlat Code Coverage" - - - name: Code Coverage Report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: '**/coverage.cobertura.xml' - badge: true - format: 'markdown' - output: 'both' - - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - header: Coverage Report - recreate: true - path: code-coverage-results.md \ No newline at end of file + integration-tests: + runs-on: windows-2022 + + steps: + - name: Fetch Sources + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + with: + vs-version: '17.2' + + - name: Install Visual Studio Build Tools + run: | + choco install visualstudio2022buildtools + choco install visualstudio2022-workload-manageddesktop + choco install visualstudio2022-workload-visualstudioextension + + - name: Diagnostics and Preparation + run: | + dotnet --info + Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName + + - name: Restore NuGet Packages + run: | + dotnet nuget locals all --clear + dotnet restore + nuget restore + + - name: Prepare Test Projects + run: | + $testProjects = Get-ChildItem -Recurse -Filter *tests.csproj + + foreach ($project in $testProjects) { + Write-Host "Preparing test project: $($project.FullName)" + + dotnet add $project.FullName package Microsoft.NET.Test.Sdk + dotnet add $project.FullName package coverlet.collector + dotnet add $project.FullName package Newtonsoft.Json + + dotnet add $project.FullName package Microsoft.VisualStudio.SDK + dotnet add $project.FullName package Microsoft.VSSDK.BuildTools + } + + - name: Build Solution + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true + + - name: Run Tests with Coverage + continue-on-error: true + run: | + $testProjects = Get-ChildItem -Recurse -Filter *tests.csproj + + foreach ($project in $testProjects) { + Write-Host "Running tests for: $($project.FullName)" + + dotnet test $project.FullName ` + --configuration Release ` + --collect:"XPlat Code Coverage" ` + --logger "trx;LogFileName=test-results.trx" + } + + - name: Upload Test Results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: | + **/*.trx + **/*.cobertura.xml \ No newline at end of file From a43a7d39fafb7d8c5394e3e0c1f64fac13f9b3ea Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 17:48:13 +0200 Subject: [PATCH 30/35] Update ci.yml --- .github/workflows/ci.yml | 160 ++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 77 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a494a498..cbe8665a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,81 +1,87 @@ name: Checkmarx One visual studio extension CI on: [ pull_request, workflow_dispatch ] permissions: write-all + jobs: - integration-tests: - runs-on: windows-2022 - - steps: - - name: Fetch Sources - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' - - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 - with: - vs-version: '17.2' - - - name: Install Visual Studio Build Tools - run: | - choco install visualstudio2022buildtools - choco install visualstudio2022-workload-manageddesktop - choco install visualstudio2022-workload-visualstudioextension - - - name: Diagnostics and Preparation - run: | - dotnet --info - Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName - - - name: Restore NuGet Packages - run: | - dotnet nuget locals all --clear - dotnet restore - nuget restore - - - name: Prepare Test Projects - run: | - $testProjects = Get-ChildItem -Recurse -Filter *tests.csproj - - foreach ($project in $testProjects) { - Write-Host "Preparing test project: $($project.FullName)" - - dotnet add $project.FullName package Microsoft.NET.Test.Sdk - dotnet add $project.FullName package coverlet.collector - dotnet add $project.FullName package Newtonsoft.Json - - dotnet add $project.FullName package Microsoft.VisualStudio.SDK - dotnet add $project.FullName package Microsoft.VSSDK.BuildTools - } - - - name: Build Solution - run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true - - - name: Run Tests with Coverage - continue-on-error: true - run: | - $testProjects = Get-ChildItem -Recurse -Filter *tests.csproj - - foreach ($project in $testProjects) { - Write-Host "Running tests for: $($project.FullName)" - - dotnet test $project.FullName ` - --configuration Release ` - --collect:"XPlat Code Coverage" ` - --logger "trx;LogFileName=test-results.trx" - } - - - name: Upload Test Results - uses: actions/upload-artifact@v3 - with: - name: test-results - path: | - **/*.trx - **/*.cobertura.xml \ No newline at end of file + integration-tests: + runs-on: windows-2022 + + steps: + - name: Fetch Sources + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + with: + vs-version: '17.2' + + - name: Install Visual Studio Build Tools + run: | + choco install visualstudio2022buildtools + choco install visualstudio2022-workload-visualstudioextension + + - name: Diagnostics and Preparation + run: | + dotnet --info + Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName + + - name: Restore NuGet Packages + run: | + dotnet nuget locals all --clear + dotnet restore + nuget restore + + - name: Prepare Test Project + run: | + $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 + + if ($testProject) { + Write-Host "Preparing test project: $($testProject.FullName)" + + dotnet add $testProject.FullName package Microsoft.NET.Test.Sdk + dotnet add $testProject.FullName package coverlet.collector + dotnet add $testProject.FullName package Newtonsoft.Json + + dotnet add $testProject.FullName package Microsoft.VisualStudio.SDK + dotnet add $testProject.FullName package Microsoft.VSSDK.BuildTools + } else { + Write-Error "Test project not found" + exit 1 + } + + - name: Build Solution + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true + + - name: Run Tests with Coverage + continue-on-error: true + run: | + $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 + + if ($testProject) { + Write-Host "Running tests for: $($testProject.FullName)" + + dotnet test $testProject.FullName ` + --configuration Release ` + --collect:"XPlat Code Coverage" ` + --logger "trx;LogFileName=test-results.trx" + } else { + Write-Error "Test project not found" + exit 1 + } + + - name: Upload Test Results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: | + **/*.trx + **/*.cobertura.xml \ No newline at end of file From da4a032e2ef9590974552fd730f93425561a03d0 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 18:08:25 +0200 Subject: [PATCH 31/35] fix --- .github/workflows/ci.yml | 5 ++--- .../ast-visual-studio-extension.csproj | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbe8665a..79d42681 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,12 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4 + # Setting up tools - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v2 with: @@ -26,6 +24,7 @@ jobs: - name: Install Visual Studio Build Tools run: | choco install visualstudio2022buildtools + choco install visualstudio2022-workload-manageddesktop choco install visualstudio2022-workload-visualstudioextension - name: Diagnostics and Preparation diff --git a/ast-visual-studio-extension/ast-visual-studio-extension.csproj b/ast-visual-studio-extension/ast-visual-studio-extension.csproj index 610ad429..edc06102 100644 --- a/ast-visual-studio-extension/ast-visual-studio-extension.csproj +++ b/ast-visual-studio-extension/ast-visual-studio-extension.csproj @@ -6,7 +6,7 @@ Default - v4.7.2 + net6.0-windows true true From c1e14dc4f77399ae31c46f95312e295cf47e1050 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 18:47:50 +0200 Subject: [PATCH 32/35] Update ci.yml --- .github/workflows/ci.yml | 100 ++++++++++----------------------------- 1 file changed, 26 insertions(+), 74 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79d42681..e3f74d6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,86 +1,38 @@ name: Checkmarx One visual studio extension CI + on: [ pull_request, workflow_dispatch ] + permissions: write-all jobs: integration-tests: - runs-on: windows-2022 - + runs-on: windows-latest + permissions: + contents: write steps: - name: Fetch Sources uses: actions/checkout@v4 - - # Setting up tools - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' - + + - name: Setup VSTest + uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 + - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 + uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1 with: vs-version: '17.2' - - - name: Install Visual Studio Build Tools - run: | - choco install visualstudio2022buildtools - choco install visualstudio2022-workload-manageddesktop - choco install visualstudio2022-workload-visualstudioextension - - - name: Diagnostics and Preparation - run: | - dotnet --info - Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName - - - name: Restore NuGet Packages - run: | - dotnet nuget locals all --clear - dotnet restore - nuget restore - - - name: Prepare Test Project - run: | - $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 - - if ($testProject) { - Write-Host "Preparing test project: $($testProject.FullName)" - - dotnet add $testProject.FullName package Microsoft.NET.Test.Sdk - dotnet add $testProject.FullName package coverlet.collector - dotnet add $testProject.FullName package Newtonsoft.Json - - dotnet add $testProject.FullName package Microsoft.VisualStudio.SDK - dotnet add $testProject.FullName package Microsoft.VSSDK.BuildTools - } else { - Write-Error "Test project not found" - exit 1 - } - - - name: Build Solution - run: | - msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true - - - name: Run Tests with Coverage - continue-on-error: true - run: | - $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 - - if ($testProject) { - Write-Host "Running tests for: $($testProject.FullName)" - - dotnet test $testProject.FullName ` - --configuration Release ` - --collect:"XPlat Code Coverage" ` - --logger "trx;LogFileName=test-results.trx" - } else { - Write-Error "Test project not found" - exit 1 - } - - - name: Upload Test Results - uses: actions/upload-artifact@v3 - with: - name: test-results - path: | - **/*.trx - **/*.cobertura.xml \ No newline at end of file + + - name: Restore NuGet packages + run: nuget restore . + + - name: Restore + run: dotnet restore . + + - name: Build + run: msbuild /p:Configuration=Release /p:DeployExtension=False + + - name: Tests + env: + CX_APIKEY: ${{ secrets.CX_APIKEY }} + run: vstest.console.exe /InIsolation .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll + + \ No newline at end of file From 9cedbe5ac5b377a29495d26b4f6d37c78d277145 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 22:53:07 +0200 Subject: [PATCH 33/35] Update ci.yml --- .github/workflows/ci.yml | 96 +++++++++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3f74d6a..15c06776 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,38 +1,80 @@ -name: Checkmarx One visual studio extension CI - +name: Checkmarx One Visual Studio Extension CI on: [ pull_request, workflow_dispatch ] - permissions: write-all jobs: integration-tests: - runs-on: windows-latest - permissions: - contents: write + runs-on: windows-2022 + steps: - name: Fetch Sources uses: actions/checkout@v4 - - - name: Setup VSTest - uses: darenm/Setup-VSTest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44 #v1 - + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1 + uses: microsoft/setup-msbuild@v2 with: vs-version: '17.2' - - - name: Restore NuGet packages - run: nuget restore . - - - name: Restore - run: dotnet restore . - - - name: Build - run: msbuild /p:Configuration=Release /p:DeployExtension=False - - - name: Tests - env: - CX_APIKEY: ${{ secrets.CX_APIKEY }} - run: vstest.console.exe /InIsolation .\ast-visual-studio-extension-tests\bin\Release\net60-windows\ast-visual-studio-extension-tests.dll - - \ No newline at end of file + + - name: Install Visual Studio Build Tools + run: | + choco install visualstudio2022buildtools + choco install visualstudio2022-workload-manageddesktop + choco install visualstudio2022-workload-visualstudioextension + + - name: Diagnostics and Preparation + shell: pwsh + run: | + dotnet --info + Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName + + - name: Restore NuGet Packages + run: dotnet restore + + - name: Prepare Test Project + shell: pwsh + run: | + $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 + + if ($testProject) { + Write-Host "Preparing test project: $($testProject.FullName)" + + dotnet add $testProject.FullName package Microsoft.NET.Test.Sdk + dotnet add $testProject.FullName package coverlet.collector + dotnet add $testProject.FullName package Newtonsoft.Json + + dotnet add $testProject.FullName package Microsoft.VisualStudio.SDK + dotnet add $testProject.FullName package Microsoft.VSSDK.BuildTools + } else { + Write-Error "Test project not found" + exit 1 + } + + - name: Build Solution + run: | + msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true + + - name: Run Tests + shell: pwsh + run: | + $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 + + if ($testProject) { + Write-Host "Running tests for: $($testProject.FullName)" + + dotnet test $testProject.FullName --configuration Release + } else { + Write-Error "Test project not found" + exit 1 + } + + - name: Upload Test Results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: | + **/TestResults/*.trx From 032c739b66126634d01b9ba905b59ded1ad80fe8 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 23:08:16 +0200 Subject: [PATCH 34/35] Update ci.yml --- .github/workflows/ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15c06776..74a9a689 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4 - - name: Setup .NET + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' @@ -27,16 +27,17 @@ jobs: choco install visualstudio2022-workload-visualstudioextension - name: Diagnostics and Preparation - shell: pwsh run: | dotnet --info Get-ChildItem -Recurse -Filter *.csproj | Select-Object FullName - name: Restore NuGet Packages - run: dotnet restore + run: | + dotnet nuget locals all --clear + dotnet restore + nuget restore - name: Prepare Test Project - shell: pwsh run: | $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 @@ -59,7 +60,7 @@ jobs: msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true - name: Run Tests - shell: pwsh + continue-on-error: true run: | $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 @@ -77,4 +78,4 @@ jobs: with: name: test-results path: | - **/TestResults/*.trx + **/*.trx \ No newline at end of file From 2dd025b58032cdd0a70ff318b9e4524b11ab68a2 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 14 Jan 2025 23:23:50 +0200 Subject: [PATCH 35/35] Update ci.yml --- .github/workflows/ci.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74a9a689..062049f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ permissions: write-all jobs: integration-tests: runs-on: windows-2022 - + steps: - name: Fetch Sources uses: actions/checkout@v4 @@ -13,15 +13,16 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '6.0.x' # Use .NET 6.x - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v2 with: vs-version: '17.2' - - name: Install Visual Studio Build Tools + - name: Install Required Developer Packs run: | + choco install netfx-4.0.3-devpack choco install visualstudio2022buildtools choco install visualstudio2022-workload-manageddesktop choco install visualstudio2022-workload-visualstudioextension @@ -35,9 +36,9 @@ jobs: run: | dotnet nuget locals all --clear dotnet restore - nuget restore - name: Prepare Test Project + shell: pwsh run: | $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 @@ -59,15 +60,15 @@ jobs: run: | msbuild /p:Configuration=Release /p:DeployExtension=False /p:VSSDKTargetPlatformRegRootSuffix=Exp /p:GenerateResourceUsePreserializedResources=true - - name: Run Tests - continue-on-error: true + - name: Run Tests with Coverage + shell: pwsh run: | $testProject = Get-ChildItem -Recurse -Filter "ast-visual-studio-extension-tests.csproj" | Select-Object -First 1 if ($testProject) { - Write-Host "Running tests for: $($testProject.FullName)" + Write-Host "Running tests with coverage for: $($testProject.FullName)" - dotnet test $testProject.FullName --configuration Release + dotnet test $testProject.FullName --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/ } else { Write-Error "Test project not found" exit 1 @@ -78,4 +79,10 @@ jobs: with: name: test-results path: | - **/*.trx \ No newline at end of file + **/*.trx + + - name: Upload Coverage Report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: ./coverage/