Skip to content
Closed
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
72 changes: 15 additions & 57 deletions .build/BuildToolkit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -265,20 +265,7 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",
return;
}

if (-not (Test-Path $global:NUnitCli)) {
Install-Tool "NUnit.Console" $NunitVersion $global:NunitCli;
}

if (-not (Test-Path $global:OpenCoverCli)) {
Install-Tool "OpenCover" $OpenCoverVersion $global:OpenCoverCli;
}

if (-not (Test-Path $global:OpenCoverToCoberturaCli)) {
Install-Tool "OpenCoverToCoberturaConverter" $OpenCoverToCoberturaVersion $global:OpenCoverToCoberturaCli;
}

CreateFolderIfNotExists $OpenCoverReportsDir;
CreateFolderIfNotExists $NunitReportsDir;
CreateFolderIfNotExists $CoberturaReportsDir;

$includeFilter = "+[Moryx*]*";
$excludeFilter = "-[*nunit*]* -[*Tests]* -[*Model*]*";
Expand Down Expand Up @@ -309,55 +296,26 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",

ForEach($testProject in $testProjects ) {
$projectName = ([System.IO.Path]::GetFileNameWithoutExtension($testProject.Name));
$testAssembly = [System.IO.Path]::Combine($testProject.DirectoryName, "bin", $env:MORYX_BUILD_CONFIG, "$projectName.dll");
$isNetCore = Get-CsprojIsNetCore($testProject);

Write-Host "OpenCover Test: ${projectName}:";

$nunitXml = ($NunitReportsDir + "\$projectName.TestResult.xml");
$openCoverXml = ($OpenCoverReportsDir + "\$projectName.OpenCover.xml");
$coberturaXml = ($CoberturaReportsDir + "\$projectName.Cobertura.xml");

if ($isNetCore) {
$targetArgs = '"test -v ' + $env:MORYX_TEST_VERBOSITY + ' -c ' + $env:MORYX_BUILD_CONFIG + ' ' + $testProject + '"';
$openCoverAgs = "-target:$global:DotNetCli", "-targetargs:$targetArgs"
}
else {
# If assembly does not exists, the project will be build
if (-not (Test-Path $testAssembly)) {
Invoke-Build $testProject
}
Write-Host "Testing ${projectName}...";

dotnet test ${testProject} --collect:"XPlat Code Coverage" `
/p:CoverletOutputFormat="cobertura" `
/p:Include="$includeFilter" `
/p:Exclude="$excludeFilter"

$openCoverAgs = "-target:$global:NunitCli", "-targetargs:/config:$env:MORYX_BUILD_CONFIG /result:$nunitXml $testAssembly"
}
Invoke-ExitCodeCheck $LastExitCode;

$openCoverAgs += "-log:Debug", "-register:administrator", "-output:$openCoverXml", "-hideskipped:all", "-skipautoprops";
$openCoverAgs += "-returntargetcode" # We need the nunit return code
$openCoverAgs += "-filter:$includeFilter $excludeFilter"
$testsDir = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($testProject), "TestResults");

& $global:OpenCoverCli $openCoverAgs

$exitCode = [int]::Parse($LastExitCode);
if ($exitCode -ne 0) {
$errorText = "";
switch ($exitCode) {
-1 { $errorText = "INVALID_ARG"; }
-2 { $errorText = "INVALID_ASSEMBLY"; }
-4 { $errorText = "INVALID_TEST_FIXTURE"; }
-5 { $errorText = "UNLOAD_ERROR"; }
Default { $errorText = "UNEXPECTED_ERROR"; }
}
$testResults = Get-ChildItem -Path $testsDir -Recurse -File
foreach ($resultFile in $testResults) {
$destinationFile = $resultFile.FullName.Replace($testsDir, $CoberturaReportsDir);
$destinationPath = [System.IO.Path]::GetDirectoryName($destinationFile);

if ($exitCode -gt 0) {
$errorText = "FAILED_TESTS ($exitCode)";
}
CreateFolderIfNotExists $destinationPath;

Write-Host-Error "Nunit exited with $errorText for $projectName";
Invoke-ExitCodeCheck $exitCode;
Move-Item -Path $resultFile -Destination $destinationFile
}

& $global:OpenCoverToCoberturaCli -input:$openCoverXml -output:$coberturaXml -sources:$rootPath
Invoke-ExitCodeCheck $LastExitCode;
}
}

Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
branches:
- dev
- future
- release/3

env:
MORYX_OPTIMIZE_CODE: "false"
Expand All @@ -22,7 +23,7 @@ env:

jobs:
Build:
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v2

Expand All @@ -38,6 +39,11 @@ jobs:
with:
dotnet-version: '6'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 14.21.x

- name: Build
shell: pwsh
run: ./Build.ps1 -Build -Pack
Expand All @@ -51,7 +57,7 @@ jobs:

UnitTests:
needs: [Build]
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v2

Expand All @@ -76,11 +82,12 @@ jobs:
with:
name: test-results
path: artifacts/Tests/
if-no-files-found: error
retention-days: 1

IntegrationTests:
needs: [Build]
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v2

Expand All @@ -103,28 +110,35 @@ jobs:
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results
name: integration-test-results
path: artifacts/Tests/
if-no-files-found: error
retention-days: 1

Codecov:
needs: [UnitTests, IntegrationTests]
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: artifacts/Tests/

- name: Download test results
uses: actions/download-artifact@v4
with:
name: integration-test-results
path: artifacts/Tests/

- name: Codecov
uses: codecov/codecov-action@v1
with:
files: '*.OpenCover.xml'
files: '*coverage.cobertura.xml'

Documentation:
needs: [Build]
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v2

Expand All @@ -142,7 +156,7 @@ jobs:
Publish:
needs: [Build, UnitTests, IntegrationTests]
if: ${{ github.event_name == 'push' }}
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v2

Expand Down
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Update="Moq" Version="4.16.1" />
<PackageReference Update="NUnit" Version="3.13.2" />
<PackageReference Update="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Update="coverlet.collector" Version="5.8.0" />

<PackageReference Update="CommandLineParser" Version="2.8.0" />
<PackageReference Update="System.ComponentModel.Annotations" Version="4.7.0" />
Expand Down
1 change: 1 addition & 0 deletions src/Moryx.Maintenance.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/react-redux": "^7.0.5",
"@types/reactstrap": "^7.1.3",
"@types/uuid": "^3.4.4",
"@types/minimatch": "^5.1.2",
"bootstrap": "4.3.1",
"bootstrap-toggle": "^2.2.2",
"chart.js": "^2.8.0",
Expand Down
80 changes: 79 additions & 1 deletion src/Moryx.Runtime.Wcf/BindingFactories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class BindingFactory
/// <summary>
/// Creates a new basic http binding with our default configuration.
/// Most parts are set to nearly int max, timeouts are set to 5 min.
/// Encoding is Text and TransferMode is bufferd.
/// Encoding is Text and TransferMode is buffered.
/// </summary>
/// <param name="requiresAuthentication">Is authentication required?</param>
/// <returns>The new created binding.</returns>
Expand Down Expand Up @@ -115,5 +115,83 @@ public static Binding CreateNetTcpBinding(bool requiresAuthentication)

return binding;
}

/// <summary>
/// Creates a new Web Https Binding with our default configuration.
/// Most values are set to nearly int max, timeouts are set to 5 min.
/// </summary>
/// <returns>A new Web Https binding.</returns>
public static Binding CreateWebHttpsBinding()
{
var binding = new WebHttpBinding()
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
MaxBufferPoolSize = int.MaxValue,
CloseTimeout = TimeSpan.FromSeconds(30),
OpenTimeout = TimeSpan.FromSeconds(30),
ReceiveTimeout = TimeSpan.FromSeconds(30),
SendTimeout = TimeSpan.FromSeconds(30),
TransferMode = TransferMode.Buffered,
UseDefaultWebProxy = true,
ReaderQuotas =
{
MaxStringContentLength = int.MaxValue,
MaxArrayLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxNameTableCharCount = int.MaxValue
},
Security =
{
Mode = WebHttpSecurityMode.Transport
}
};
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
return binding;
}

/// <summary>
/// Creates a new basic https binding with our default configuration.
/// Most parts are set to nearly int max, timeouts are set to 5 min.
/// Encoding is Text and TransferMode is buffered.
/// </summary>
/// <param name="requiresAuthentication">Is authentication required?</param>
/// <returns>The new created binding.</returns>
public static Binding CreateBasicHttpsBinding(bool requiresAuthentication)
{
var basicHttpBinding = new BasicHttpBinding
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
MaxBufferPoolSize = int.MaxValue,
CloseTimeout = TimeSpan.FromSeconds(30),
OpenTimeout = TimeSpan.FromSeconds(30),
ReceiveTimeout = TimeSpan.FromSeconds(30),
SendTimeout = TimeSpan.FromSeconds(30),
MessageEncoding = WSMessageEncoding.Text,
TransferMode = TransferMode.Buffered,
UseDefaultWebProxy = true,
ReaderQuotas =
{
MaxStringContentLength = int.MaxValue,
MaxArrayLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxNameTableCharCount = int.MaxValue
}
};

if (requiresAuthentication)
{
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
}
else
{
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
}

return basicHttpBinding;
}
}
}
Loading
Loading