Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeuchler committed Dec 2, 2021
2 parents 39069e5 + 26ba89c commit 1aad526
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 29 deletions.
22 changes: 17 additions & 5 deletions .build/BuildToolkit.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Tool Versions
$NunitVersion = "3.12.0";
$OpenCoverVersion = "4.7.922";
$DocFxVersion = "2.56.2";
$ReportGeneratorVersion = "4.8.7";
$OpenCoverVersion = "4.7.1221";
$DocFxVersion = "2.58.4";
$ReportGeneratorVersion = "4.8.13";
$OpenCoverToCoberturaVersion = "0.3.4";

# Folder Pathes
$RootPath = $MyInvocation.PSScriptRoot;
Expand All @@ -18,6 +19,7 @@ $DocumentationArtifcacts = "$ArtifactsDir\Documentation";
# Tests
$NunitReportsDir = "$ArtifactsDir\Tests";
$OpenCoverReportsDir = "$ArtifactsDir\Tests"
$CoberturaReportsDir = "$ArtifactsDir\Tests"

# Nuget
$NugetConfig = "$RootPath\NuGet.Config";
Expand All @@ -34,6 +36,7 @@ $global:OpenCoverCli = "$BuildTools\OpenCover.$OpenCoverVersion\tools\OpenCover.
$global:NunitCli = "$BuildTools\NUnit.ConsoleRunner.$NunitVersion\tools\nunit3-console.exe";
$global:ReportGeneratorCli = "$BuildTools\ReportGenerator.$ReportGeneratorVersion\tools\net47\ReportGenerator.exe";
$global:DocFxCli = "$BuildTools\docfx.console.$DocFxVersion\tools\docfx.exe";
$global:OpenCoverToCoberturaCli = "$BuildTools\OpenCoverToCoberturaConverter.$OpenCoverToCoberturaVersion\tools\OpenCoverToCoberturaConverter.exe";

# Git
$global:GitCommitHash = "";
Expand Down Expand Up @@ -132,6 +135,7 @@ function Invoke-Initialize([string]$Version = "1.0.0", [bool]$Cleanup = $False)
Write-Variable "NUnitCli" $global:NUnitCli;
Write-Variable "ReportGeneratorCli" $global:ReportGeneratorCli;
Write-Variable "DocFxCli" $global:DocFxCli;
Write-Variable "OpenCoverToCoberturaCli" $global:OpenCoverToCoberturaCli;
Write-Variable "GitCli" $global:GitCli;
Write-Variable "GitCommitHash" $global:GitCommitHash;

Expand Down Expand Up @@ -269,6 +273,10 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",
Install-Tool "OpenCover" $OpenCoverVersion $global:OpenCoverCli;
}

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

CreateFolderIfNotExists $OpenCoverReportsDir;
CreateFolderIfNotExists $NunitReportsDir;

Expand Down Expand Up @@ -308,6 +316,7 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",

$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 + '"';
Expand Down Expand Up @@ -346,6 +355,9 @@ function Invoke-CoverTests($SearchPath = $RootPath, $SearchFilter = "*.csproj",
Write-Host-Error "Nunit exited with $errorText for $projectName";
Invoke-ExitCodeCheck $exitCode;
}

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

Expand Down Expand Up @@ -655,7 +667,7 @@ function CreateFolderIfNotExists([string]$Folder) {
}

function CopyAndReplaceFolder($SourceDir, $TargetDir) {
Write-Host-Info "Copy $TargetDir to $SourceDir!"
Write-Host-Info "Copy $SourceDir to $TargetDir!"
# Remove old folder if exists
if (Test-Path $TargetDir) {
Write-Host "Target path already exists, removing ..." -ForegroundColor Yellow
Expand All @@ -665,4 +677,4 @@ function CopyAndReplaceFolder($SourceDir, $TargetDir) {
# Copy to target path
Write-Host "Copy from $SourceDir to $TargetDir ..." -ForegroundColor Green
Copy-Item -Path $SourceDir -Recurse -Destination $TargetDir -Container
}
}
12 changes: 0 additions & 12 deletions .build/Global.DotSettings

This file was deleted.

23 changes: 17 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
on:
push:
branches:
branches:
- dev
- future
tags:
- v[0-9]+.[0-9]+.[0-9]+ # Matches all semantic versioning tags with major, minor, patch
pull_request:
branches:
branches:
- dev
- future

env:
MORYX_OPTIMIZE_CODE: "false"
MORYX_BUILD_CONFIG: "Release"
MORYX_BUILDNUMBER: ${{github.run_number}}
dotnet_sdk_version: '5.0.100'
dotnet_sdk_version: '5.0.403'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

jobs:
Expand Down Expand Up @@ -122,7 +124,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -134,15 +136,24 @@ jobs:
name: packages
path: artifacts/Packages/

- name: Publish on MyGet
if: ${{ startsWith(github.ref, 'refs/heads/') }} # Normal branches are published to myget
- name: Publish on MyGet-CI
if: ${{ github.ref == 'refs/heads/dev' }} # dev branche is published to myget moryx
shell: pwsh
env:
MORYX_NUGET_APIKEY: ${{secrets.MYGET_TOKEN}}
MORYX_PACKAGE_TARGET: "https://www.myget.org/F/moryx/api/v2/package"
MORYX_PACKAGE_TARGET_V3: "https://www.myget.org/F/moryx/api/v3/index.json"
run: ./Build.ps1 -Publish

- name: Publish on MyGet-Future
if: ${{ github.ref == 'refs/heads/future' }} # Future branch is published to myget moryx-future
shell: pwsh
env:
MORYX_NUGET_APIKEY: ${{secrets.MYGET_TOKEN}}
MORYX_PACKAGE_TARGET: "https://www.myget.org/F/moryx-future/api/v2/package"
MORYX_PACKAGE_TARGET_V3: "https://www.myget.org/F/moryx-future/api/v3/index.json"
run: ./Build.ps1 -Publish

- name: Publish on NuGet
if: ${{ startsWith(github.ref, 'refs/tags/v') }} # Version Tags are published to nuget
shell: pwsh
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<ItemGroup>
<!--3rd party dependencies-->
<PackageReference Update="Caliburn.Micro" Version="3.2.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Update="Moq" Version="4.16.1" />
<PackageReference Update="NUnit" Version="3.13.1" />
<PackageReference Update="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Update="NUnit" Version="3.13.2" />
<PackageReference Update="NUnit3TestAdapter" Version="4.1.0" />

<!--Platform dependencies-->
<PackageReference Update="Moryx" Version="$(MoryxCoreVersion)" />
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.9.0
5.10.0
5 changes: 5 additions & 0 deletions src/Moryx.AbstractionLayer/Activities/Tracing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class Tracing : IActivityTracing
/// </summary>
public int Progress { get; set; }

/// <summary>
/// Resource that executed the activity
/// </summary>
public long ResourceId { get; set; }

///
// ReSharper disable once InconsistentNaming <-- too cool to rename :P
public Sparta Transform<Sparta>() where Sparta
Expand Down
5 changes: 3 additions & 2 deletions src/Moryx.AbstractionLayer/Resources/Resource.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020, Phoenix Contact GmbH & Co. KG
// Copyright (c) 2020, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0

using System;
Expand Down Expand Up @@ -61,7 +61,8 @@ public abstract class Resource : ILoggingComponent, IResource, IInitializablePlu
/// <inheritdoc />
void IInitializable.Initialize()
{
Logger = Logger?.GetChild(Name, GetType());
var loggerName = Name.Replace(".", "_"); // replace . with _ because of logger child structure
Logger = Logger?.GetChild(loggerName, GetType());
OnInitialize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ private ProductInstance[] TransformInstances(IUnitOfWork uow, ICollection<Produc
private void TransformInstance(IUnitOfWork uow, ProductInstanceEntity entity, ProductInstance productInstance)
{
productInstance.Id = entity.Id;
productInstance.State = (ProductInstanceState)entity.State;

// Transform the instance if it has a dedicated storage
var productType = productInstance.Type;
Expand Down Expand Up @@ -816,6 +817,7 @@ private ProductInstanceEntity SaveInstance(IUnitOfWork uow, ProductInstance prod

// Save to entity
var archived = uow.GetEntity<ProductInstanceEntity>(productInstance);
archived.State = (int)productInstance.State;
archived.ProductId = productInstance.Type.Id;
strategy.SaveInstance(productInstance, archived);

Expand Down

0 comments on commit 1aad526

Please sign in to comment.