Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ updates:
open-pull-requests-limit: 10

ignore:
- dependency-name: "Microsoft.Build"
- dependency-name: "Microsoft.Build.Tasks.Core"

# FluentAssertions equal to or higher than 8.0.0 are a different license, which requires payment
Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,25 @@ on:
workflow_dispatch:

jobs:
ubuntu-tests:
name: Run all tests on Ubuntu
runs-on: ubuntu-22.04 # Latest misses mono for .NET Framework
env:
DOWNLOAD_KEY: ${{ secrets.DOWNLOAD_KEY }}

steps:
- uses: actions/checkout@v4

- name: Test All
run: dotnet test -c Release

dotnet-test:
name: Run Integration Tests
runs-on: windows-latest
env:
DOWNLOAD_KEY: ${{ secrets.DOWNLOAD_KEY }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Integration Tests
run: dotnet test -c Release --filter TestCategory=IntegrationTest

CICD:
needs: [ubuntu-tests, dotnet-test]
uses: SkylineCommunications/_ReusableWorkflows/.github/workflows/NuGet Solution Master Workflow.yml@main
needs: [dotnet-test]
uses: SkylineCommunications/_ReusableWorkflows/.github/workflows/Master Workflow.yml@MasterWorkflow
with:
sonarCloudProjectName: SkylineCommunications_Skyline.DataMiner.Sdk
sonarcloud-project-name: SkylineCommunications_Skyline.DataMiner.Sdk
nuget-push-source: https://api.nuget.org/v3/index.json
runs-on: windows-latest
solution-filter-name: Skyline.DataMiner.Sdk.sln
secrets:
nugetApiKey: ${{ secrets.NUGETAPIKEY }}
NUGET_API_KEY: ${{ secrets.NUGETAPIKEY }}
15 changes: 15 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<ItemGroup>
<PackageReference Include="NuGet.Frameworks" ExcludeAssets="Runtime" PrivateAssets="all" />
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="Microsoft.Build.Tasks.Core" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
<PackageReference Include="Nito.AsyncEx.Tasks" />
<PackageReference Include="Skyline.DataMiner.CICD.Assemblers.Automation" />
<PackageReference Include="Skyline.DataMiner.CICD.DMApp.Common" />
<PackageReference Include="Skyline.DataMiner.Core.AppPackageCreator" />
<PackageReference Include="Skyline.DataMiner.Core.ArtifactDownloader" />
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions Directory.Packages.props
Comment thread
MichielOda marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
<PackageVersion Include="Microsoft.Build" Version="14.3.0" />
<PackageVersion Include="Microsoft.Build.Framework" Version="14.3.0" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.11.2" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="14.3.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.2" />
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.1.3" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageVersion Include="NuGet.Frameworks" Version="7.3.0" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="Skyline.DataMiner.CICD.Assemblers.Automation" Version="6.0.0" />
<PackageVersion Include="Skyline.DataMiner.CICD.DMApp.Common" Version="6.0.0" />
<PackageVersion Include="Skyline.DataMiner.Core.AppPackageCreator" Version="4.0.0" />
<PackageVersion Include="Skyline.DataMiner.Core.ArtifactDownloader" Version="4.0.0" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
2 changes: 1 addition & 1 deletion Sdk/Helpers/CatalogReferencesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using Skyline.ArtifactDownloader.Identifiers;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;

internal static class CatalogReferencesHelper
{
Expand Down
2 changes: 1 addition & 1 deletion Sdk/Helpers/DataMinerProjectTypeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Skyline.DataMiner.Sdk.Helpers
{
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;

internal static class DataMinerProjectTypeHelper
{
Expand Down
3 changes: 1 addition & 2 deletions Sdk/Helpers/ProjectReferencesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
using System.Text.Json;
using System.Xml;
using System.Xml.Linq;

using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;

internal static class ProjectReferencesHelper
{
Expand Down
2 changes: 1 addition & 1 deletion Sdk/Helpers/ProjectToItemConverter.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Skyline.DataMiner.Sdk.Helpers
{
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Parsers.Automation.Xml;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;

internal static class ProjectToItemConverter
{
Expand Down
26 changes: 9 additions & 17 deletions Sdk/Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,27 @@
<RepositoryUrl>https://github.com/SkylineCommunications/Skyline.DataMiner.Sdk</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<NoWarn>1701;1702;NU5100</NoWarn>
</PropertyGroup>

<PropertyGroup>
<PackageType>MSBuildSdk</PackageType>
<BuildOutputTargetFolder>Sdk</BuildOutputTargetFolder>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
<PackageVersion>0.0.800</PackageVersion>
<Version>0.0.800</Version>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
<None Include="LICENSE.txt" Pack="true" PackagePath="" />
<None Include="nuget\Icon.png" Pack="true" PackagePath="" />
<None Include="Sdk\Sdk.props" Pack="true" PackagePath="Sdk" />
<None Include="Sdk\Sdk.targets" Pack="true" PackagePath="Sdk" />
<None Include="Sdk\Sdk.props" Pack="true" PackagePath="Sdk\Sdk.props" />
<None Include="Sdk\Sdk.targets" Pack="true" PackagePath="Sdk\Sdk.targets" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Tasks.Core" VersionOverride="$(MicrosoftBuildMinimumPackageVersion)" ExcludeAssets="Runtime" IncludeAssets="compile; build; native; contentfiles; analyzers; buildtransitive" Version="14.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.2" />
<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.3" />
<PackageReference Include="Skyline.DataMiner.CICD.Assemblers.Automation" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.CICD.Assemblers.Common" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.CICD.DMApp.Common" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.Core.AppPackageCreator" Version="4.0.0" />
<PackageReference Include="Skyline.DataMiner.Core.ArtifactDownloader" Version="4.0.0" />
<PackageReference Include="Skyline.DataMiner.CICD.FileSystem" Version="1.4.1" />
<PackageReference Include="Skyline.DataMiner.CICD.Parsers.Common" Version="5.1.5" />
<PackageReference Include="PowerShellStandard.Library" />
<PackageReference Include="Microsoft.PowerShell.SDK" />
</ItemGroup>

<ItemGroup>
Expand All @@ -59,7 +51,7 @@

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<!-- The dependencies of your MSBuild task must be packaged inside the package, they cannot be expressed as normal PackageReferences -->
<!--The dependencies of your MSBuild task must be packaged inside the package, they cannot be expressed as normal PackageReferences-->
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths)" TargetPath="%(ReferenceCopyLocalPaths.DestinationSubPath)" />
</ItemGroup>
</Target>
Expand Down
2 changes: 1 addition & 1 deletion Sdk/SubTasks/DmappCreation_AutomationScriptStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Loggers;
using Skyline.DataMiner.CICD.Parsers.Automation.Xml;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.Sdk.Helpers;

using static Tasks.DmappCreation;
Expand Down
4 changes: 2 additions & 2 deletions Sdk/Tasks/DmappCreation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ namespace Skyline.DataMiner.Sdk.Tasks
using Skyline.ArtifactDownloader;
using Skyline.ArtifactDownloader.Identifiers;
using Skyline.ArtifactDownloader.Services;
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.Common;
using Skyline.DataMiner.CICD.DMApp.Common;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.FileSystem.DirectoryInfoWrapper;
using Skyline.DataMiner.CICD.Loggers;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.Sdk.Helpers;
using Skyline.DataMiner.Sdk.Shell;
using Skyline.DataMiner.Sdk.SubTasks;
Expand Down Expand Up @@ -104,7 +104,7 @@ public override bool Execute()

try
{
DataMinerProjectType dataMinerProjectType = DataMinerProjectTypeConverter.ToEnum(ProjectType);
DataMinerProjectType dataMinerProjectType = DataMinerProjectTypeConverter.ToEnum(ProjectType) ?? DataMinerProjectType.Unknown;

if (!TryCreateAppPackageBuilder(preparedData, dataMinerProjectType, out AppPackage.AppPackageBuilder appPackageBuilder))
{
Expand Down
4 changes: 2 additions & 2 deletions Sdk/Tasks/PublishToCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Skyline.DataMiner.Sdk.Tasks
using Nito.AsyncEx.Synchronous;

using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.Sdk.CatalogService;
using Skyline.DataMiner.Sdk.Helpers;

Expand Down Expand Up @@ -68,7 +68,7 @@ public override bool Execute()

var fs = FileSystem.Instance;

DataMinerProjectType dataMinerProjectType = DataMinerProjectTypeConverter.ToEnum(ProjectType);
DataMinerProjectType dataMinerProjectType = DataMinerProjectTypeConverter.ToEnum(ProjectType) ?? DataMinerProjectType.Unknown;

if (dataMinerProjectType == DataMinerProjectType.Unknown)
{
Expand Down
3 changes: 1 addition & 2 deletions SdkTests/Helpers/ProjectReferencesHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace SdkTests.Helpers
{
using FluentAssertions;

using Skyline.DataMiner.CICD.Assemblers.Common.VisualStudio.Projects;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects;
using Skyline.DataMiner.Sdk.Helpers;

[TestClass]
Expand Down
67 changes: 67 additions & 0 deletions SdkTests/ManualTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
namespace SdkTests
{
using FluentAssertions;
using Microsoft.Build.Framework;
using Microsoft.Build.Tasks;
using Moq;
using Skyline.DataMiner.CICD.FileSystem;
using Skyline.DataMiner.Sdk.Helpers;
using Skyline.DataMiner.Sdk.Tasks;

[TestClass]
[Ignore("This class is intended for manual tests for debugging.")]
public class ManualTests
{
private Mock<IBuildEngine> buildEngine = null!;
private List<string> errors = null!;

[TestInitialize]
public void Startup()
{
buildEngine = new Mock<IBuildEngine>();
errors = [];
buildEngine.Setup(engine => engine.LogErrorEvent(It.IsAny<BuildErrorEventArgs>())).Callback<BuildErrorEventArgs>(e => errors.Add(e.Message));
}

[TestMethod]
public void ExecuteTest_CustomPackage()
{
string projectFile = FileSystem.Instance.Path.Combine(TestHelper.GetTestFilesDirectory(), "Package 8", "My Package", "My Package.csproj");

string tempDirectory = FileSystem.Instance.Directory.CreateTemporaryDirectory();
try
{
// Arrange
DmappCreation task = new DmappCreation
{
ProjectFile = projectFile,
PackageId = "My Package",
Output = tempDirectory,
CatalogDefaultDownloadKeyName = "DOWNLOAD_KEY",
MinimumRequiredDmVersion = "",
MinimumRequiredDmWebVersion = "",
PackageVersion = "1.0.0",
ProjectType = "Package",
UserSecretsId = "6b92a156-fb34-4699-9fbb-0585b2489709",

BuildEngine = buildEngine.Object
};

string expectedDestinationFilePath = FileSystem.Instance.Path.Combine(tempDirectory, BuildOutputHandler.BuildDirectoryName, $"{task.PackageId}.{task.PackageVersion}.dmapp");

// Act
bool result = task.Execute();

// Assert
errors.Should().BeEmpty();
result.Should().BeTrue();
FileSystem.Instance.File.Exists(expectedDestinationFilePath).Should().BeTrue();
}
finally
{
FileSystem.Instance.Directory.DeleteDirectory(tempDirectory);
}
}

}
}
25 changes: 9 additions & 16 deletions SdkTests/SdkTests.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="MSTest.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.8;net8.0</TargetFrameworks>
<TargetFrameworks>net48;net10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>6b92a156-fb34-4699-9fbb-0585b2489709</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest" Version="3.11.1" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.2" />
<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageReference Include="Skyline.DataMiner.CICD.Assemblers.Common" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.CICD.DMApp.Common" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.CICD.Assemblers.Automation" Version="5.1.5" />
<PackageReference Include="Skyline.DataMiner.Core.AppPackageCreator" Version="4.0.0" />
<PackageReference Include="Skyline.DataMiner.Core.ArtifactDownloader" Version="4.0.0" />
<PackageReference Include="Skyline.DataMiner.CICD.FileSystem" Version="1.4.1" />
<PackageReference Include="Skyline.DataMiner.CICD.Parsers.Common" Version="5.1.5" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Moq" />
<PackageReference Include="Microsoft.Build.Locator" />
</ItemGroup>

<ItemGroup>
Expand All @@ -43,4 +32,8 @@
</Content>
</ItemGroup>

<ItemGroup>
<PackageDownload Include="Skyline.DataMiner.Sdk" Version="[2.4.7]" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions SdkTests/Tasks/DmappCreationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Skyline.DataMiner.Sdk.Tasks;

[TestClass]
[TestCategory("IntegrationTest")]
public class DmappCreationTests
{
private Mock<IBuildEngine> buildEngine = null!;
Expand Down Expand Up @@ -62,6 +61,7 @@ public void PrepareDataTest_Package1()

[TestMethod]
[Retry(3)] // NuGet (PackageReferenceProcessor from Assemblers) is flaky on Ubuntu
[TestCategory("IntegrationTest")]
public void ExecuteTest_Package6()
{
string tempDirectory = FileSystem.Instance.Directory.CreateTemporaryDirectory();
Expand Down Expand Up @@ -151,7 +151,6 @@ public void ExecuteCatalogInformation_NoNotice()
}
}


[TestMethod]
public void ExecuteCatalogInformation_WithNotice()
{
Expand Down
2 changes: 2 additions & 0 deletions SdkTests/Test Files/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
2 changes: 2 additions & 0 deletions SdkTests/Test Files/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
Loading