Files
octokit.net/build/Tasks/IntegrationTests.cs
Ryan Gribble 7114bcb41e General updates (#1653)
* Update README and shipping-releases as they are a bit out of date

* Update year/copyright info

* Update cake.frosting to latest for newest dotnet tooling support, and adjust builds for new configuration parameters

* update xunit packages so codelens works for nested test classes (VS2017 15.3 update is also required)

* Fixup VS version and remove win debugging tools
2017-08-16 21:33:03 +10:00

32 lines
1.3 KiB
C#

using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Test;
using Cake.Frosting;
[Dependency(typeof(Build))]
public sealed class IntegrationTests : FrostingTask<Context>
{
public override void Run(Context context)
{
foreach (var project in context.Projects.Where(x => x.IntegrationTests))
{
context.Information("Executing Integration Tests Project {0}...", project.Name);
context.DotNetCoreTest(project.Path.FullPath, context.GetTestSettings());
}
}
public override bool ShouldRun(Context context)
{
var environmentVariablesNames = new[] { "OCTOKIT_GITHUBUSERNAME", "OCTOKIT_GITHUBPASSWORD" };
var areEnvironmentVariablesSet = environmentVariablesNames.All(x => !string.IsNullOrEmpty(context.Environment.GetEnvironmentVariable(x)));
if (!areEnvironmentVariablesSet)
{
context.Warning($"The integration tests were skipped because the following environment variables are not set: {string.Join(", ", environmentVariablesNames)}.");
context.Warning("Please configure these environment variables for a GitHub test account (DO NOT USE A \"REAL\" ACCOUNT).");
}
return areEnvironmentVariablesSet;
}
}