Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests in CI #530

Merged
merged 1 commit into from
Jan 29, 2024
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -39,9 +39,15 @@ jobs:
if: ${{ runner.os == 'Windows' }}

## Only difference here is not forcing cmd
- name: Build and test (!win)
- name: Build and test (ubuntu & macos)
run: ./build ci
if: ${{ runner.os != 'Windows' }}

- name: Test - Persistence
run: dotnet bin/Debug/Persistence.Tests/Persistence.Tests.dll

- name: Test - PAModel
run: dotnet bin/Debug/PAModelTests/PAModelTests.dll

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
16 changes: 14 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -40,19 +40,31 @@ jobs:
- task: CodeQL3000Init@0

- task: DotNetCoreCLI@2
displayName: 'Build and test '
displayName: 'Build'
inputs:
command: 'run'
projects: '$(Build.SourcesDirectory)/targets/targets.csproj'
arguments: '-- ci -c $(BuildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'Test Persistence'
inputs:
command: 'custom'
custom: '$(Build.SourcesDirectory)/bin/$(BuildConfiguration)/Persistence.Tests/Persistence.Tests.dll'

- task: DotNetCoreCLI@2
displayName: 'Test PAModel'
inputs:
command: 'custom'
custom: '$(Build.SourcesDirectory)/bin/$(BuildConfiguration)/PAModelTests/PAModelTests.dll'

- task: CodeQL3000Finalize@0

- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*-*.trx'
searchFolder: '$(Build.SourcesDirectory)/obj/'
searchFolder: '$(Build.SourcesDirectory)/'
mergeTestResults: true
failTaskOnFailedTests: true

7 changes: 4 additions & 3 deletions src/PAModelTests/PAModelTests.csproj
Original file line number Diff line number Diff line change
@@ -5,14 +5,15 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<PublicSign>true</PublicSign>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestTestAdapterVersion)" />
<PackageReference Include="MSTest" Version="$(MSTest)" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
<PackageReference Include="YamlDotNet" Version="$(YamlDotNetVersion)" />
</ItemGroup>
8 changes: 4 additions & 4 deletions src/Persistence.Tests/Persistence.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<SignAssembly>false</SignAssembly>
@@ -17,9 +18,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestTestAdapterVersion)" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestTestFrameworkVersion)" />
<PackageReference Include="MSTest" Version="$(MSTest)" />
<PackageReference Include="coverlet.collector" Version="$(CoverletCollectorVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>
5 changes: 3 additions & 2 deletions src/Versions.props
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@
<TargetFrameworkVersion>net7.0</TargetFrameworkVersion>
<YamlDotNetVersion>15.1.0</YamlDotNetVersion>
<MicrosoftNETTestSdkVersion>17.7.1</MicrosoftNETTestSdkVersion>
<MSTestTestAdapterVersion>2.2.10</MSTestTestAdapterVersion>
<MSTestTestFrameworkVersion>2.2.10</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>3.2.0</MSTestTestAdapterVersion>
<MSTestTestFrameworkVersion>3.2.0</MSTestTestFrameworkVersion>
<MSTest>3.2.0</MSTest>
<CoverletCollectorVersion>3.2.0</CoverletCollectorVersion>
<FluentAssertionsVersion>6.12.0</FluentAssertionsVersion>
<MinVerVersion>4.3.0</MinVerVersion>
6 changes: 1 addition & 5 deletions targets/Program.cs
Original file line number Diff line number Diff line change
@@ -52,7 +52,6 @@ static void Main(string[] args)
string SrcDir = Path.Combine(RootDir, "src");

string LogDir = Path.Combine(ObjDir, "logs");
string TestLogDir = Path.Combine(ObjDir, "testLogs");

string PAModelDir = Path.Combine(SrcDir, "PAModel");
var solution = Path.Combine(SrcDir, "PASopa.sln");
@@ -82,9 +81,6 @@ static void Main(string[] args)
RunDotnet("build", $"{EscapePath(solution)} --configuration {options.Configuration} --no-restore", gitExists, LogDir);
});

Target("test",
() => RunDotnet("test", $"{EscapePath(solution)} --configuration {options.Configuration} --no-build --logger trx --results-directory {EscapePath(TestLogDir)}", gitExists, LogDir));

Target("rebuild",
DependsOn("restore", "build"));

@@ -98,7 +94,7 @@ static void Main(string[] args)
});

Target("ci",
DependsOn("squeaky-clean", "rebuild", "test"));
DependsOn("squeaky-clean", "rebuild"));

Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(o =>