Files
octokit.net/build/Tasks/TestSourceLink.cs
Ryan Gribble 96df1a7d6c Add sourcelink support (#1574)
* add sourcelink support

* Update sourcelink (2.0.2 -> 2.1.0)

* Add parameter to enable source linking

* tidy up the arguments with an extension method allowing an argument to be conditionally appended

* Add an explicit "test sourcelink" build task and remove the MSBuild one, so we can get some build script output without needing the whole build to be in verbose logging

* run sourcelink test against the NuGet packages
2017-04-03 10:49:57 +10:00

36 lines
1.0 KiB
C#

using System;
using Cake.Common;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Core;
using Cake.Core.IO;
using Cake.Frosting;
[Dependency(typeof(Package))]
public class TestSourceLink : FrostingTask<Context>
{
public override void Run(Context context)
{
var nugetPackages = context.GetFiles($"./{context.Artifacts}/*.nupkg");
foreach (var nugetPackage in nugetPackages)
{
context.Information("Testing sourcelink info in {0}", context.Environment.WorkingDirectory.GetRelativePath(nugetPackage));
var exitCode = context.StartProcess("dotnet", new ProcessSettings
{
WorkingDirectory = "Octokit",
Arguments = $"sourcelink test {nugetPackage.FullPath}"
});
if (exitCode != 0)
{
throw new Exception("Sourcelink test failed!");
}
}
}
public override bool ShouldRun(Context context)
{
return context.LinkSources;
}
}