diff --git a/.travis.yml b/.travis.yml index 9f91d31..174054f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,16 @@ language: csharp +mono: latest +dotnet: 1.0.4 +dist: trusty + solution: src/GitTools.Testing.sln sudo: false install: - # - sudo nuget update -self - - nuget restore src/GitTools.Testing.sln - nuget install xunit.runner.console -Version 2.1.0 -OutputDirectory ./src/packages script: - - xbuild ./src/GitTools.Testing.sln /property:Configuration="Debug" /verbosity:detailed - - mono --debug --runtime=v4.0.30319 ./src/packages/xunit.runner.console.2.1.0/tools/xunit.console.exe ./src/GitTools.Testing.Tests/bin/Debug/GitTools.Testing.Tests.dll + - dotnet restore src/GitTools.Testing.sln + - msbuild ./src/GitTools.Testing.sln /property:Configuration=Debug + - dotnet test ./src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj --configuration Debug --no-build --framework netcoreapp1.0 +# Disable testing against .NET 4.5.2 through Mono because it tries to resolve +# the Windows libgit binary instead of the linux one. +# - mono --debug --runtime=v4.0.30319 ./src/packages/xunit.runner.console.2.1.0/tools/xunit.console.exe ./src/GitTools.Testing.Tests/bin/Debug/net452/GitTools.Testing.Tests.dll \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index f51d4f7..49df6fc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,9 @@ +image: + - Visual Studio 2017 + install: - choco install gitversion.portable -pre -y -platform: - - Any CPU - configuration: - Release @@ -11,14 +11,22 @@ assembly_info: patch: false before_build: - - nuget restore src\ + - dotnet restore src\GitTools.Testing.sln - ps: gitversion /l console /output buildserver /updateAssemblyInfo build: project: src\GitTools.Testing.sln after_build: - - cmd: nuget pack src\GitTools.Testing.nuspec -version "%GitVersion_NuGetVersion%" + - cmd: dotnet pack src\GitTools.Testing\GitTools.Testing.csproj /p:PackageVersion="%GitVersion_NuGetVersion%" /p:NoBuild=true /p:PackageOutputPath=%APPVEYOR_BUILD_FOLDER% - cmd: appveyor PushArtifact "GitTools.Testing.%GitVersion_NuGetVersion%.nupkg" + +# Setting this off until the auto-detection for dotnet test tooling in AppVeyor +# is integrated. https://github.com/appveyor/ci/issues/1404 +# The test_script is used as a workaround to fix this. +test: off +test_script: + - cmd: dotnet test src\GitTools.Testing.Tests\GitTools.Testing.Tests.csproj --configuration %Configuration% --no-build + cache: - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified diff --git a/src/GitTools.Testing.Tests/Example.cs b/src/GitTools.Testing.Tests/Example.cs index dbfb240..f69213e 100644 --- a/src/GitTools.Testing.Tests/Example.cs +++ b/src/GitTools.Testing.Tests/Example.cs @@ -4,7 +4,9 @@ namespace GitTools.Testing.Tests { using System; +#if NET452 using System.Runtime.Remoting.Messaging; +#endif using JetBrains.Annotations; using Logging; @@ -16,8 +18,10 @@ public class Example [Fact] public void TheReadmeSample() { +#if NET452 using (LogHelper.Capture(_outputHelper, LogProvider.SetCurrentLogProvider)) { +#endif using (var fixture = new EmptyRepositoryFixture()) { fixture.MakeACommit(); @@ -28,10 +32,13 @@ public void TheReadmeSample() fixture.Checkout("master"); fixture.MergeNoFF("develop"); } +#if NET452 } +#endif } } +#if NET452 public static class LogHelper { private static readonly XUnitProvider Provider; @@ -45,7 +52,7 @@ public static IDisposable Capture(ITestOutputHelper outputHelper, Action @@ -101,4 +108,5 @@ public IDisposable OpenMappedContext(string key, string value) throw new NotImplementedException(); } } +#endif } \ No newline at end of file diff --git a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj index 3e9b281..20ad377 100644 --- a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj +++ b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj @@ -1,92 +1,49 @@ - - - - + + - Debug - AnyCPU - {5CF365CF-85B2-4AA3-8A17-680EFDF617C5} - Library - Properties - GitTools.Testing.Tests - GitTools.Testing.Tests - v4.5 - 512 - - - + net452;netcoreapp1.0 + true + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + + + + GitTools.Testing + GitTools Contributors + Makes it easy to automate git for testing libraries which interact with git + git tools testing + Copyright GitTools 2015 + https://github.com/GitTools/GitTools.Core + https://github.com/GitTools/GitTools.Core/blob/master/LICENSE + https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png + - - - - - - - - - ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True - - - ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll - True - - - ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll - True - + + + + + + + - - - - + + + - - - Designer - + + + + + - + + - - {3DCA1530-7A7F-46E4-955F-B4358F1299FA} - GitTools.Testing - + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/GitTools.Testing.Tests/packages.config b/src/GitTools.Testing.Tests/packages.config deleted file mode 100644 index 0b39336..0000000 --- a/src/GitTools.Testing.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/GitTools.Testing.nuspec b/src/GitTools.Testing.nuspec deleted file mode 100644 index 25b1cbe..0000000 --- a/src/GitTools.Testing.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - GitTools.Testing - $version$ - GitTools.Testing - GitTools Contributors - GitTools Contributors - Makes it easy to automate git for testing libraries which interact with git - git tools testing - false - Copyright GitTools 2015 - en-US - https://github.com/GitTools/GitTools.Core - https://github.com/GitTools/GitTools.Core/blob/master/LICENSE - https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png - - - - - - - - - \ No newline at end of file diff --git a/src/GitTools.Testing.sln b/src/GitTools.Testing.sln index d376d76..164a639 100644 --- a/src/GitTools.Testing.sln +++ b/src/GitTools.Testing.sln @@ -12,9 +12,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".configs", ".configs", "{EB ..\README.md = ..\README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTools.Testing.Tests", "GitTools.Testing.Tests\GitTools.Testing.Tests.csproj", "{5CF365CF-85B2-4AA3-8A17-680EFDF617C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitTools.Testing.Tests", "GitTools.Testing.Tests\GitTools.Testing.Tests.csproj", "{5CF365CF-85B2-4AA3-8A17-680EFDF617C5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTools.Testing", "GitTools.Testing\GitTools.Testing.csproj", "{3DCA1530-7A7F-46E4-955F-B4358F1299FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitTools.Testing", "GitTools.Testing\GitTools.Testing.csproj", "{3DCA1530-7A7F-46E4-955F-B4358F1299FA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs b/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs index e90d30d..02ee597 100644 --- a/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs +++ b/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs @@ -12,17 +12,17 @@ public class BaseGitFlowRepositoryFixture : EmptyRepositoryFixture { /// /// Creates a repo with a develop branch off master which is a single commit ahead of master - /// + /// /// Master will be tagged with the initial version before branching develop /// - public BaseGitFlowRepositoryFixture(string initialVersion) : + public BaseGitFlowRepositoryFixture(string initialVersion) : this(r => r.MakeATaggedCommit(initialVersion)) { } /// /// Creates a repo with a develop branch off master which is a single commit ahead of master - /// + /// /// The initial setup actions will be performed before branching develop /// public BaseGitFlowRepositoryFixture(Action initialMasterAction) @@ -38,7 +38,7 @@ void SetupRepo(Action initialMasterAction) initialMasterAction(Repository); - Repository.Checkout(Repository.CreateBranch("develop")); + Commands.Checkout(Repository, Repository.CreateBranch("develop")); Repository.MakeACommit(); } } diff --git a/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs b/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs index 9bedc65..9c38132 100644 --- a/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs +++ b/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs @@ -65,7 +65,7 @@ public virtual void Dispose() public void Checkout(string branch) { - Repository.Checkout(branch); + Commands.Checkout(Repository, branch); } public void MakeATaggedCommit(string tag) @@ -83,13 +83,15 @@ public void ApplyTag(string tag) public void BranchTo(string branchName, string @as = null) { _sequenceDiagram.BranchTo(branchName, Repository.Head.FriendlyName, @as); - Repository.Checkout(Repository.CreateBranch(branchName)); + var branch = Repository.CreateBranch(branchName); + Commands.Checkout(Repository, branch); } public void BranchToFromTag(string branchName, string fromTag, string onBranch, string @as = null) { _sequenceDiagram.BranchToFromTag(branchName, fromTag, onBranch, @as); - Repository.Checkout(Repository.CreateBranch(branchName)); + var branch = Repository.CreateBranch(branchName); + Commands.Checkout(Repository, branch); } public void MakeACommit() diff --git a/src/GitTools.Testing/GitTestExtensions.cs b/src/GitTools.Testing/GitTestExtensions.cs index 33cd93c..c667577 100644 --- a/src/GitTools.Testing/GitTestExtensions.cs +++ b/src/GitTools.Testing/GitTestExtensions.cs @@ -63,7 +63,7 @@ public static Tag MakeATaggedCommit(this IRepository repository, string tag) public static Commit CreatePullRequestRef(this IRepository repository, string from, string to, int prNumber = 2, bool normalise = false, bool allowFastFowardMerge = false) { - repository.Checkout(repository.Branches[to].Tip); + Commands.Checkout(repository, repository.Branches[to].Tip); if (allowFastFowardMerge) { repository.Merge(repository.Branches[from], Generate.SignatureNow()); @@ -74,11 +74,11 @@ public static Commit CreatePullRequestRef(this IRepository repository, string fr } var commit = repository.Head.Tip; repository.Refs.Add("refs/pull/" + prNumber + "/merge", commit.Id); - repository.Checkout(to); + Commands.Checkout(repository, to); if (normalise) { // Turn the ref into a real branch - repository.Checkout(repository.Branches.Add("pull/" + prNumber + "/merge", commit)); + Commands.Checkout(repository, repository.Branches.Add("pull/" + prNumber + "/merge", commit)); } return commit; diff --git a/src/GitTools.Testing/GitTools.Testing.csproj b/src/GitTools.Testing/GitTools.Testing.csproj index 56136ec..23fe320 100644 --- a/src/GitTools.Testing/GitTools.Testing.csproj +++ b/src/GitTools.Testing/GitTools.Testing.csproj @@ -1,92 +1,34 @@ - - - - + + - Debug - AnyCPU - {3DCA1530-7A7F-46E4-955F-B4358F1299FA} - Library - Properties - GitTools.Testing - GitTools.Testing - v4.0 - 512 - 5 - - - + net452;netstandard1.3 + true + false + + + + $(DefineConstants);LIBLOG_PORTABLE + - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - bin\GitTools.Testing.xml 1591,414 - true - false - pdbonly - true - bin\ - TRACE - prompt - 4 - bin\GitTools.Testing.xml 1591 - true - false + - - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll - True - - - - - - - - + - - - - - - - - - - - - - - - - + + + - - + + + + + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/GitTools.Testing/packages.config b/src/GitTools.Testing/packages.config deleted file mode 100644 index 705055c..0000000 --- a/src/GitTools.Testing/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file