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
2 changes: 1 addition & 1 deletion .github/workflows/new-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
run: dotnet format ./new-cli --exclude ~/.nuget/packages --verify-no-changes
-
name: Test 'new-cli' solution
run: dotnet test ./new-cli --no-build --verbosity normal
run: dotnet test --solution ./new-cli/GitVersion.slnx --no-build --verbosity normal
30 changes: 17 additions & 13 deletions build/build/Tasks/Test/UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,29 @@ private static void TestProjectForTarget(BuildContext context, FilePath project,
var projectName = $"{project.GetFilenameWithoutExtension()}.net{framework}";
var settings = new DotNetTestSettings
{
PathType = DotNetTestPathType.Project,
Framework = $"net{framework}",
NoBuild = true,
NoRestore = true,
Configuration = context.MsBuildConfiguration,
TestAdapterPath = new(".")
MSBuildSettings = new()
};
settings.MSBuildSettings.SetContinuousIntegrationBuild(false);

var resultsPath = context.MakeAbsolute(testResultsPath.CombineWithFilePath($"{projectName}.results.xml"));
settings.Loggers = [$"junit;LogFilePath={resultsPath}"];
settings.WithArgumentCustomization(args => args
.Append("--report-spekt-junit")
.Append("--report-spekt-junit-filename").AppendQuoted(resultsPath.FullPath)
);

var coverletSettings = new CoverletSettings
{
CollectCoverage = true,
CoverletOutputFormat = CoverletOutputFormat.cobertura,
CoverletOutputDirectory = testResultsPath,
CoverletOutputName = $"{projectName}.coverage.xml",
Exclude = ["[GitVersion*.Tests]*", "[GitTools.Testing]*"]
};
context.DotNetTest(project.FullPath, settings);
// var coverletSettings = new CoverletSettings
// {
// CollectCoverage = true,
// CoverletOutputFormat = CoverletOutputFormat.cobertura,
// CoverletOutputDirectory = testResultsPath,
// CoverletOutputName = $"{projectName}.coverage.xml",
// Exclude = ["[GitVersion*.Tests]*", "[GitTools.Testing]*"]
// };

context.DotNetTest(project.FullPath, settings, coverletSettings);
// context.DotNetTest(project.FullPath, settings, coverletSettings);
}
}
19 changes: 11 additions & 8 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"projects": [
"build",
"new-cli",
"src"
],
"sdk": {
"version": "10.0.102"
}
"projects": [
"build",
"new-cli",
"src"
],
"sdk": {
"version": "10.0.102"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
2 changes: 1 addition & 1 deletion new-cli/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageVersion Include="Polly" Version="8.6.5" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.15.0" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.15.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Enable the NUnit runner, this is an opt-in feature -->
<EnableNUnitRunner>true</EnableNUnitRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>

<!--
Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
For more information, visit https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-integration-dotnet-test#show-failure-per-test
-->
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>

<OutputType>Exe</OutputType>
<RootNamespace>GitVersion.Cli.Generator.Tests</RootNamespace>
<IsPackable>false</IsPackable>

<EnableNUnitRunner>true</EnableNUnitRunner>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 10 additions & 6 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>

<IsUnitTestProject>false</IsUnitTestProject>
<IsUnitTestProject Condition="$(MSBuildProjectName.EndsWith('.Tests')) or $(MSBuildProjectName.EndsWith('.Testing'))">true</IsUnitTestProject>
<IsUnitTestProject Condition="$(MSBuildProjectName.EndsWith('.Tests'))">true</IsUnitTestProject>

<DisableAnalyzers>false</DisableAnalyzers>
<DisableApiAnalyzers>false</DisableApiAnalyzers>
<DisableApiAnalyzers Condition=" '$(IsUnitTestProject)' == 'true' ">true</DisableApiAnalyzers>
<DisableApiAnalyzers Condition="$(MSBuildProjectName.EndsWith('.Schema')) == 'true'">true</DisableApiAnalyzers>
<DisableApiAnalyzers Condition="$(MSBuildProjectName.EndsWith('.Testing')) == 'true'">true</DisableApiAnalyzers>
</PropertyGroup>

<PropertyGroup Condition=" '$(IsUnitTestProject)' == 'true' ">
<OutputType>Exe</OutputType>
<EnableNUnitRunner>true</EnableNUnitRunner>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand All @@ -61,11 +67,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' ">
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' or $(MSBuildProjectName.EndsWith('.Testing')) ">
<PackageReference Include="Microsoft.NET.Test.Sdk" />

<PackageReference Include="NSubstitute" />

<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="JunitXml.TestLogger" />
Expand All @@ -81,13 +85,13 @@
</PackageReference>

</ItemGroup>
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' and $(MSBuildProjectName.EndsWith('.Tests'))">
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' ">
<ProjectReference Include="..\GitVersion.Testing\GitVersion.Testing.csproj" />

<Using Include="GitVersion.Testing" />
<Using Include="NSubstitute" />
<Using Include="NUnit.Framework" />
<Using Include="Shouldly" />
<Using Include="GitVersion.Testing" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- common packages -->
<PackageVersion Include="JsonSchema.Net" Version="7.3.4" />
<PackageVersion Include="LibGit2Sharp" Version="0.31.0" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="18.0.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
Expand All @@ -20,10 +20,10 @@
<PackageVersion Include="Roslynator.Analyzers" Version="4.15.0" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.15.0" />
<!-- specific packages -->
<PackageVersion Include="Buildalyzer" Version="7.1.0" />
<PackageVersion Include="Buildalyzer" Version="8.0.0" />
<PackageVersion Include="JsonSchema.Net.Generation" Version="6.0.0" />
<PackageVersion Include="JunitXml.TestLogger" Version="8.0.0" />
<PackageVersion Include="MSBuild.ProjectCreation" Version="16.1.0" />
<PackageVersion Include="MSBuild.ProjectCreation" Version="17.0.1" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.0" />
<PackageVersion Include="Microsoft.Build" Version="18.0.2" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="18.0.2" />
Expand All @@ -36,7 +36,7 @@
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.1" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.0" />
Expand Down
1 change: 1 addition & 0 deletions src/GitVersion.Testing/GitVersion.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
Loading