diff --git a/.gitignore b/.gitignore index 5d538ca26c..04f07c74a2 100644 --- a/.gitignore +++ b/.gitignore @@ -91,4 +91,7 @@ pingme.txt docs/_build # it's 2015, no need to keep this around when migrating projects -Backup/ \ No newline at end of file +Backup/ + +# .NET Core +project.lock.json \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 1244d3ebeb..811de032f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,26 @@ language: csharp -mono: - - 4.2.3 -sudo: false # use the new container-based Travis infrastructure -os: - - osx - - linux +matrix: + include: + - os: linux + dist: trusty + sudo: required + mono: 4.2.3 + dotnet: 1.0.0-preview2-003121 + - os: osx + osx_image: xcode8 + mono: 4.2.3 + dotnet: 1.0.0-preview2-003121 + +before_install: + - if test "$TRAVIS_OS_NAME" == "osx"; then ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi + install: - - nuget restore Octokit-Mono.sln -script: + - nuget restore Octokit-Mono.sln + +script: - mono tools/nuget/NuGet.exe restore Octokit-Mono.sln - - ./build.sh BuildMono - - ./build.sh + - ./build.sh BuildMono + - ./build.sh + - dotnet --info + - ./build.sh UnitTestsDotNetCore diff --git a/Octokit.Core.sln b/Octokit.Core.sln new file mode 100644 index 0000000000..ed6aab0995 --- /dev/null +++ b/Octokit.Core.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Octokit.Next", "Octokit.Next\Octokit.Next.xproj", "{4052AF53-4C1B-48D1-B873-BFD0351481C3}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Octokit.Next.Tests", "Octokit.Next.Tests\Octokit.Next.Tests.xproj", "{2740AF44-CB2E-4FD8-A221-248693978A0C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4052AF53-4C1B-48D1-B873-BFD0351481C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4052AF53-4C1B-48D1-B873-BFD0351481C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4052AF53-4C1B-48D1-B873-BFD0351481C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4052AF53-4C1B-48D1-B873-BFD0351481C3}.Release|Any CPU.Build.0 = Release|Any CPU + {2740AF44-CB2E-4FD8-A221-248693978A0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2740AF44-CB2E-4FD8-A221-248693978A0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2740AF44-CB2E-4FD8-A221-248693978A0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2740AF44-CB2E-4FD8-A221-248693978A0C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Octokit.Next.Tests/CalculatorTests.cs b/Octokit.Next.Tests/CalculatorTests.cs new file mode 100644 index 0000000000..7060e73723 --- /dev/null +++ b/Octokit.Next.Tests/CalculatorTests.cs @@ -0,0 +1,24 @@ +namespace Octokit.Next.Tests +{ + using Xunit; + + public class CalculatorTests + { + private readonly Calculator _sut; + + public CalculatorTests() + { + _sut = new Calculator(); + } + + [Theory] + [InlineData(1, 1, 2)] + [InlineData(1, 2, 3)] + [InlineData(2, 1, 3)] + [InlineData(-1, 1, 0)] + public void AddingTwoIntegers_ShouldReturnExpectedResult(int x, int y, int expected) + { + Assert.Equal(expected, _sut.Add(x, y)); + } + } +} diff --git a/Octokit.Next.Tests/Octokit.Next.Tests.xproj b/Octokit.Next.Tests/Octokit.Next.Tests.xproj new file mode 100644 index 0000000000..17d797e1c4 --- /dev/null +++ b/Octokit.Next.Tests/Octokit.Next.Tests.xproj @@ -0,0 +1,22 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 2740af44-cb2e-4fd8-a221-248693978a0c + Octokit.Next.Tests + .\obj + .\bin\ + v4.5 + + + 2.0 + + + + + + \ No newline at end of file diff --git a/Octokit.Next.Tests/Properties/AssemblyInfo.cs b/Octokit.Next.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..cc74232ec0 --- /dev/null +++ b/Octokit.Next.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Octokit.Next.Tests")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2740af44-cb2e-4fd8-a221-248693978a0c")] diff --git a/Octokit.Next.Tests/project.json b/Octokit.Next.Tests/project.json new file mode 100644 index 0000000000..ca49aeeff0 --- /dev/null +++ b/Octokit.Next.Tests/project.json @@ -0,0 +1,16 @@ +{ + "version": "1.0.0-*", + "testRunner": "xunit", + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + }, + "Octokit.Next": "*", + "dotnet-test-xunit": "2.2.0-preview2-build1029", + "xunit": "2.2.0-beta2-build3300" + }, + "frameworks": { + "netcoreapp1.0": {} + } +} diff --git a/Octokit.Next/Calculator.cs b/Octokit.Next/Calculator.cs new file mode 100644 index 0000000000..588dd52355 --- /dev/null +++ b/Octokit.Next/Calculator.cs @@ -0,0 +1,10 @@ +namespace Octokit.Next +{ + public class Calculator + { + public int Add(int x, int y) + { + return x + y; + } + } +} diff --git a/Octokit.Next/Octokit.Next.xproj b/Octokit.Next/Octokit.Next.xproj new file mode 100644 index 0000000000..4f649fe3e8 --- /dev/null +++ b/Octokit.Next/Octokit.Next.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 4052af53-4c1b-48d1-b873-bfd0351481c3 + Octokit.Next + .\obj + .\bin\ + v4.5 + + + + 2.0 + + + diff --git a/Octokit.Next/Properties/AssemblyInfo.cs b/Octokit.Next/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..22c1c95109 --- /dev/null +++ b/Octokit.Next/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Octokit.Next")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4052af53-4c1b-48d1-b873-bfd0351481c3")] diff --git a/Octokit.Next/project.json b/Octokit.Next/project.json new file mode 100644 index 0000000000..ae9aa1c119 --- /dev/null +++ b/Octokit.Next/project.json @@ -0,0 +1,11 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0" + }, + + "frameworks": { + "netstandard1.1": {} + } +} diff --git a/appveyor.yml b/appveyor.yml index b9395c2624..9b4320e34d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,7 @@ build_script: - cmd: build.cmd UnitTests - cmd: build.cmd ConventionTests - cmd: build.cmd CreatePackages + - cmd: build.cmd UnitTestsDotNetCore test: off nuget: account_feed: true diff --git a/build.cmd b/build.cmd index dfefcfd4a7..789b8463e7 100644 --- a/build.cmd +++ b/build.cmd @@ -1,7 +1,7 @@ @echo off "tools\nuget\nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.1.0" -verbosity quiet -"tools\nuget\nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.28.0" -verbosity quiet +"tools\nuget\nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.39.1" -verbosity quiet "tools\nuget\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet "tools\nuget\nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet "tools\nuget\nuget.exe" "install" "FSharp.Data" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.3.2" -verbosity quiet diff --git a/build.fsx b/build.fsx index 7a755e5ec7..3a9a5067d5 100644 --- a/build.fsx +++ b/build.fsx @@ -111,8 +111,28 @@ Target "BuildMono" (fun _ -> // xbuild does not support msbuild tools version 14.0 and that is the reason // for using the xbuild command directly instead of using msbuild Exec "xbuild" "./Octokit-Mono.sln /t:Build /tv:12.0 /v:m /p:RestorePackages='False' /p:Configuration='Release' /logger:Fake.MsBuildLogger+ErrorLogger,'../octokit.net/tools/FAKE.Core/tools/FakeLib.dll'" +) + +Target "RestoreDotNetCore" (fun _ -> + [ "./Octokit.Next" + "./Octokit.Next.Tests" ] + |> Seq.iter (fun d -> + Fake.DotNetCli.Restore (fun p -> + { p with + WorkingDir = d }) + ) +) +Target "BuildDotNetCore" (fun _ -> + !! "./**/project.json" + |> Fake.DotNetCli.Build id ) + +Target "UnitTestsDotNetCore" (fun _ -> + !! "./Octokit.Next.Tests" + |> Fake.DotNetCli.Test id +) + Target "ConventionTests" (fun _ -> !! (sprintf "./Octokit.Tests.Conventions/bin/%s/**/Octokit.Tests.Conventions.dll" buildMode) |> xUnit2 (fun p -> @@ -289,6 +309,10 @@ Target "CreatePackages" DoNothing ==> "CheckProjects" ==> "BuildMono" +"RestoreDotNetCore" + ==> "BuildDotNetCore" + ==> "UnitTestsDotNetCore" + "UnitTests" ==> "Default" diff --git a/build.sh b/build.sh index 9468c1689e..f4f849df23 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ then # use .Net "./tools/nuget/nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0" -verbosity quiet -"./tools/nuget/nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.22.2" -verbosity quiet +"./tools/nuget/nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.39.1" -verbosity quiet "./tools/nuget/nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet "./tools/nuget/nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet "./tools/nuget/nuget.exe" "install" "FSharp.Data" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.3.2" -verbosity quiet @@ -12,7 +12,7 @@ packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx else # use mono mono "./tools/nuget/NuGet.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0" -verbosity quiet -mono "./tools/nuget/NuGet.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.22.2" -verbosity quiet +mono "./tools/nuget/NuGet.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.39.1" -verbosity quiet mono "./tools/nuget/NuGet.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet mono "./tools/nuget/NuGet.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet mono "./tools/nuget/NuGet.exe" "install" "FSharp.Data" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.3.2" -verbosity quiet