Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 77 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,88 @@
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' # Use .NET 6.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



- 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

- 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

- 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 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 with coverage for: $($testProject.FullName)"

dotnet test $testProject.FullName --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/
} else {
Write-Error "Test project not found"
exit 1
}

- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
**/*.trx

- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: ./coverage/
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<InstallRoot>Default</InstallRoot>
<VSIXSubPath>
</VSIXSubPath>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>net6.0-windows</TargetFrameworkVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<TargetFrameworkProfile />
Expand Down Expand Up @@ -170,7 +170,7 @@
<ItemGroup>
<PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.507" />
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens">
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens">
<Version>7.5.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.TeamFoundationServer.Client">
Expand Down
Loading