add coverage #680
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 | |
permissions: | |
contents: write | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# 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 | |
uses: microsoft/[email protected] | |
with: | |
vs-version: '17.2' | |
# Install System.Resources.Extensions explicitly | |
- name: Install System.Resources.Extensions | |
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 | |
# Restore packages | |
- name: Restore NuGet packages | |
run: | | |
nuget restore . | |
dotnet restore . | |
# Build with specific properties to handle resources | |
- name: Build | |
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" | |
} |