Skip to content

Commit

Permalink
Run tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
anpetroc committed Jan 29, 2024
1 parent 9816fb6 commit f7165c1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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'
arguments: '$(Build.SourcesDirectory)/bin/$(BuildConfiguration)/Persistence.Tests/Persistence.Tests.dll'

- task: DotNetCoreCLI@2
displayName: 'Test PAModel'
inputs:
command: 'custom'
arguments: '$(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

Expand Down
7 changes: 4 additions & 3 deletions src/PAModelTests/PAModelTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence.Tests/Yaml/DeserializerValidTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void Deserialize_ShouldParseBuiltInControlFromYamlCustomControl()
}

[TestMethod]
[DataRow(@"_TestData/ValidYaml/Screen-with-controls.fx.yaml", "Screen 1", 2, 2)]
[DataRow(@"_TestData/ValidYaml/Screen-with-controls.fx.yaml", "Screen 1", 2000, 2)]
[DataRow(@"_TestData/ValidYaml/Screen-with-name.fx.yaml", "My Power Apps Screen", 0, 0)]
[DataRow(@"_TestData/ValidYaml/Control-with-custom-template.yaml", "My Power Apps Custom Control", 0, 9)]
public void Deserialize_ShouldSucceed(string path, string expectedName, int controlCount, int propertiesCount)
Expand Down
5 changes: 3 additions & 2 deletions src/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 1 addition & 5 deletions targets/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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"));

Expand All @@ -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 =>
Expand Down

0 comments on commit f7165c1

Please sign in to comment.