Skip to content

Commit

Permalink
Fixed test execution for new project style
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeuchler committed Oct 6, 2020
1 parent 164a959 commit 98a107a
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 285 deletions.
21 changes: 13 additions & 8 deletions .build/BuildToolkit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",
Write-Step "Starting cover tests from $SearchPath with filter $FilterFile."

if (-not (Test-Path $SearchPath)) {
Write-Host "$SearchPath does not exists, ignoring!";
Write-Host-Warning "$SearchPath does not exists, ignoring!";
return;
}

Expand Down Expand Up @@ -336,7 +336,7 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",
$errorText = "FAILED_TESTS ($exitCode)";
}

Write-Host "Nunit exited with $errorText for $projectName";
Write-Host-Error "Nunit exited with $errorText for $projectName";
Invoke-ExitCodeCheck $exitCode;
}
}
Expand Down Expand Up @@ -409,13 +409,16 @@ function Invoke-DocFx($Metadata = [System.IO.Path]::Combine($DocumentationDir, "
CopyAndReplaceFolder $docFxDest "$DocumentationArtifcacts\DocFx";
}

function Invoke-PackSdkProject($ProjectPath, [bool]$IsTool = $False, [bool]$IncludeSymbols = $False) {
function Invoke-PackSdkProject($CsprojFile, [bool]$IncludeSymbols = $False) {
Write-Host "Try to pack .NET SDK project: $($CsprojFile.Name) ...";

# Check if the project should be packed
$csprojFullName = $csprojFile.FullName;
$csprojFullName = $CsprojFile.FullName;
[xml]$csprojContent = Get-Content $csprojFullName
$createPackage = $csprojContent.Project.PropertyGroup.CreatePackage;
;
if ($null -eq $createPackage -or "false" -eq $createPackage) {
Write-Host-Warning "... csproj not flagged with <CreatePackage>true</CreatePackage>: $($CsprojFile.Name)";
return;
}

Expand All @@ -433,11 +436,13 @@ function Invoke-PackSdkProject($ProjectPath, [bool]$IsTool = $False, [bool]$Incl
Invoke-ExitCodeCheck $LastExitCode;
}

function Invoke-PackFrameworkProject($ProjectPath, [bool]$IsTool = $False, [bool]$IncludeSymbols = $False) {
function Invoke-PackFrameworkProject($CsprojFile, [bool]$IsTool = $False, [bool]$IncludeSymbols = $False) {
Write-Host "Try to pack .NET Framework project: $CsprojFile.Name ...";

# Check if there is a matching nuspec for the proj
$nuspecPath = [IO.Path]::ChangeExtension($ProjectPath, "nuspec")
$nuspecPath = [IO.Path]::ChangeExtension($CsprojFile.FullName, "nuspec")
if(-not (Test-Path $nuspecPath)) {
Write-Host-Warning "Nuspec for project not found: $CsprojFile.Name";
return;
}

Expand All @@ -464,7 +469,7 @@ function Invoke-Pack($ProjectPath, [bool]$IsTool = $False, [bool]$IncludeSymbols
CreateFolderIfNotExists $NugetPackageArtifacts;

if (Get-CsprojIsSdkProject($ProjectPath)) {
Invoke-PackSdkProject $ProjectPath $IsTool $IncludeSymbols;
Invoke-PackSdkProject $ProjectPath $IncludeSymbols;
}
else {
Invoke-PackFrameworkProject $ProjectPath $IsTool $IncludeSymbols;
Expand All @@ -483,7 +488,7 @@ function Invoke-Publish {
Write-Host "Pushing packages from $NugetPackageArtifacts to $env:MORYX_PACKAGE_TARGET"

if ([string]::IsNullOrEmpty($env:MORYX_PACKAGE_TARGET)) {
Write-Host "There is no package target given. Set the environment varialble MORYX_PACKAGE_TARGET to publish packages.";
Write-Host-Error "There is no package target given. Set the environment varialble MORYX_PACKAGE_TARGET to publish packages.";
Invoke-ExitCodeCheck 1;
}

Expand Down
1 change: 0 additions & 1 deletion .build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<RepositoryUrl>https://github.com/PHOENIXCONTACT/MORYX-Platform</RepositoryUrl>

<PackageIcon>moryx-logo.png</PackageIcon>
<PackageIconUrl>https://www.phoenixcontact.com/favicon.ico</PackageIconUrl>
<PackageProjectUrl>https://moryx-industry.net/</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
- name: Codecov
uses: codecov/codecov-action@v1
with:
files: './artifacts/Tests/*.OpenCover.xml'
files: ./artifacts/Tests/Moryx.Container.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Model.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Runtime.Kernel.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Runtime.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Tools.Wcf.Tests.OpenCover.xml,./artifacts/Tests/Moryx.Communication.Sockets.IntegrationTests.OpenCover

Publish:
needs: [Test]
if: ${{ github.event_name == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-Pack"],
"cwd": "${workspaceRoot}"
}
},
{
"type": "PowerShell",
"request": "launch",
Expand Down
14 changes: 0 additions & 14 deletions GlobalAssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.14.6" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
7 changes: 2 additions & 5 deletions src/Tests/Moryx.Container.Tests/Moryx.Container.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Moryx.Model.Tests/Moryx.Model.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.14.6" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<StartupObject />
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.14.6" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Moryx.Runtime.Tests/Moryx.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.14.6" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Moryx.Tests/Moryx.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 98a107a

Please sign in to comment.