Skip to content

Commit

Permalink
Target netstandard2.0 for libraries, target net8 for tests, and switc…
Browse files Browse the repository at this point in the history
…h to github actions for CI (#147)
  • Loading branch information
mdabros authored Jan 20, 2024
1 parent 3f6063f commit 70ef474
Show file tree
Hide file tree
Showing 38 changed files with 156 additions and 176 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: dotnet

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
version:
description: 'Release version to tag and create'
required: false

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
build:
strategy:
matrix:
os: [windows-latest]
configuration: [Debug, Release]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c ${{ matrix.configuration }} --no-restore
- name: Test
run: dotnet test -c ${{ matrix.configuration }} --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.os }},${{ matrix.configuration }}
18 changes: 2 additions & 16 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
COPYRIGHT
MIT License

All contributions by Mads Dabros:
Copyright (c) 2014, Mads Dabros.
All rights reserved.

All other contributions:
Copyright (c) 2017, the respective contributors.
All rights reserved.

Each contributor holds copyright over their respective contributions.
The project versioning (Git) records all such contribution source information.

LICENSE

The MIT License (MIT)
Copyright (c) 2024 mdabros

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -32,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![Build Status](https://machinelearning.visualstudio.com/sharplearning-github-build/_apis/build/status/sharplearning-CI?branchName=master)](https://machinelearning.visualstudio.com/sharplearning-github-build/_build/latest?definitionId=28&branchName=master)
[![Build Status](https://github.com/mdabros/SharpLearning/actions/workflows/dotnet.yml/badge.svg?branch=master)](https://github.com/mdabros/SharpLearning/actions/workflows/dotnet.yml)
[![Nuget](https://img.shields.io/nuget/v/SharpLearning.Containers?color=purple)](https://www.nuget.org/packages/SharpLearning.Containers/)
[![downloads](https://img.shields.io/nuget/dt/SharpLearning.Containers)](https://www.nuget.org/packages/SharpLearning.Containers)
[![License](https://img.shields.io/github/license/mdabros/SharpLearning)](https://github.com/mdabros/SharpLearning/blob/master/LICENSE.md)

SharpLearning
=================
Expand Down
5 changes: 2 additions & 3 deletions SharpLearning.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpLearning.InputOutput.Test", "src\SharpLearning.InputOutput.Test\SharpLearning.InputOutput.Test.csproj", "{9B29211D-9211-4C36-872D-5747D6C51878}"
EndProject
Expand Down Expand Up @@ -55,7 +55,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpLearning.InputOutput",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{55C8F585-6918-4373-A349-EDF167D77FBB}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yaml = azure-pipelines.yaml
CONTRIBUTING.md = CONTRIBUTING.md
src\Directory.Build.props = src\Directory.Build.props
README.md = README.md
Expand Down
68 changes: 0 additions & 68 deletions azure-pipelines.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature",
"allowPrerelease": true
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net8</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -19,9 +19,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-release-23619-01" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0-preview.24069.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0-preview.24069.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SharpLearning.AdaBoost/SharpLearning.AdaBoost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>SharpLearning.AdaBoost</PackageId>
<Description>Provides learning algorithms and models for AdaBoost regression and classification.</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>SharpLearning.Common.Interfaces</PackageId>
<Description>Provides common interfaces for SharpLearning.</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net8</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -21,9 +21,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-release-23619-01" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0-preview.24069.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0-preview.24069.3" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>SharpLearning.Containers</PackageId>
<Description>Provides containers and base extension methods for SharpLearning.</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net8</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -19,9 +19,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-release-23619-01" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0-preview.24069.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0-preview.24069.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>SharpLearning.CrossValidation</PackageId>
<Description>Provides cross-validation, training/test set samplers and learning curves for SharpLearning.</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace SharpLearning.DecisionTrees.Test.suts
[TestClass]
public class ClassificationDecisionTreeModelTest
{
readonly string m_classificationDecisionTreeModelString = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ClassificationDecisionTreeModel xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" z:Id=\"1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns=\"http://schemas.datacontract.org/2004/07/SharpLearning.DecisionTrees.Models\">\r\n <Tree xmlns:d2p1=\"http://schemas.datacontract.org/2004/07/SharpLearning.DecisionTrees.Nodes\" z:Id=\"2\">\r\n <d2p1:Nodes z:Id=\"3\" z:Size=\"5\">\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>-1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>0</d2p1:NodeIndex>\r\n <d2p1:RightIndex>4</d2p1:RightIndex>\r\n <d2p1:Value>20</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>-1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>2</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>1</d2p1:NodeIndex>\r\n <d2p1:RightIndex>3</d2p1:RightIndex>\r\n <d2p1:Value>2.5</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>0</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>2</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>1</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>3</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>0</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>2</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>4</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>1</d2p1:Value>\r\n </d2p1:Node>\r\n </d2p1:Nodes>\r\n <d2p1:Probabilities xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"4\" z:Size=\"3\">\r\n <d3p1:ArrayOfdouble z:Id=\"5\" z:Size=\"2\">\r\n <d3p1:double>0.33333333333333331</d3p1:double>\r\n <d3p1:double>0.66666666666666663</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n <d3p1:ArrayOfdouble z:Id=\"6\" z:Size=\"2\">\r\n <d3p1:double>0.73913043478260865</d3p1:double>\r\n <d3p1:double>0.2608695652173913</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n <d3p1:ArrayOfdouble z:Id=\"7\" z:Size=\"2\">\r\n <d3p1:double>0.16666666666666666</d3p1:double>\r\n <d3p1:double>0.83333333333333326</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n </d2p1:Probabilities>\r\n <d2p1:TargetNames xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"8\" z:Size=\"2\">\r\n <d3p1:double>0</d3p1:double>\r\n <d3p1:double>1</d3p1:double>\r\n </d2p1:TargetNames>\r\n <d2p1:VariableImportance xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"9\" z:Size=\"2\">\r\n <d3p1:double>0</d3p1:double>\r\n <d3p1:double>0.18033248802479571</d3p1:double>\r\n </d2p1:VariableImportance>\r\n </Tree>\r\n <m_variableImportance xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Ref=\"9\" i:nil=\"true\" />\r\n</ClassificationDecisionTreeModel>";
readonly string m_classificationDecisionTreeModelString = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ClassificationDecisionTreeModel xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" z:Id=\"1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns=\"http://schemas.datacontract.org/2004/07/SharpLearning.DecisionTrees.Models\">\r\n <Tree xmlns:d2p1=\"http://schemas.datacontract.org/2004/07/SharpLearning.DecisionTrees.Nodes\" z:Id=\"2\">\r\n <d2p1:Nodes z:Id=\"3\" z:Size=\"5\">\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>-1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>0</d2p1:NodeIndex>\r\n <d2p1:RightIndex>4</d2p1:RightIndex>\r\n <d2p1:Value>20</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>-1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>2</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>1</d2p1:NodeIndex>\r\n <d2p1:RightIndex>3</d2p1:RightIndex>\r\n <d2p1:Value>2.5</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>0</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>2</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>1</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>1</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>3</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>0</d2p1:Value>\r\n </d2p1:Node>\r\n <d2p1:Node>\r\n <d2p1:FeatureIndex>-1</d2p1:FeatureIndex>\r\n <d2p1:LeafProbabilityIndex>2</d2p1:LeafProbabilityIndex>\r\n <d2p1:LeftIndex>-1</d2p1:LeftIndex>\r\n <d2p1:NodeIndex>4</d2p1:NodeIndex>\r\n <d2p1:RightIndex>-1</d2p1:RightIndex>\r\n <d2p1:Value>1</d2p1:Value>\r\n </d2p1:Node>\r\n </d2p1:Nodes>\r\n <d2p1:Probabilities xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"4\" z:Size=\"3\">\r\n <d3p1:ArrayOfdouble z:Id=\"5\" z:Size=\"2\">\r\n <d3p1:double>0.3333333333333333</d3p1:double>\r\n <d3p1:double>0.6666666666666666</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n <d3p1:ArrayOfdouble z:Id=\"6\" z:Size=\"2\">\r\n <d3p1:double>0.7391304347826086</d3p1:double>\r\n <d3p1:double>0.2608695652173913</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n <d3p1:ArrayOfdouble z:Id=\"7\" z:Size=\"2\">\r\n <d3p1:double>0.16666666666666666</d3p1:double>\r\n <d3p1:double>0.8333333333333333</d3p1:double>\r\n </d3p1:ArrayOfdouble>\r\n </d2p1:Probabilities>\r\n <d2p1:TargetNames xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"8\" z:Size=\"2\">\r\n <d3p1:double>0</d3p1:double>\r\n <d3p1:double>1</d3p1:double>\r\n </d2p1:TargetNames>\r\n <d2p1:VariableImportance xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Id=\"9\" z:Size=\"2\">\r\n <d3p1:double>0</d3p1:double>\r\n <d3p1:double>0.1803324880247957</d3p1:double>\r\n </d2p1:VariableImportance>\r\n </Tree>\r\n <m_variableImportance xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" z:Ref=\"9\" i:nil=\"true\" />\r\n</ClassificationDecisionTreeModel>";

[TestMethod]
public void ClassificationDecisionTreeModel_Predict_Single()
Expand Down Expand Up @@ -188,7 +188,8 @@ public void ClassificationDecisionTreeModel_Save()
var writer = new StringWriter();
sut.Save(() => writer);

Assert.AreEqual(m_classificationDecisionTreeModelString, writer.ToString());
var actual = writer.ToString();
Assert.AreEqual(m_classificationDecisionTreeModelString, actual);
}

[TestMethod]
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net8</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -19,9 +19,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-release-23619-01" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0-preview.24069.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0-preview.24069.3" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>SharpLearning.DecisionTrees</PackageId>
<Description>Provides learning algorithms and models for DecisionTree regression and classification.</Description>
Expand Down
Loading

0 comments on commit 70ef474

Please sign in to comment.