add coverage #711
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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 | |
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 |