public static async Task OnExecute(BuildContext context) { context.BuildStep("Creating NuGet packages"); var srcFolder = Path.Join(context.BaseFolder, "src"); var projectFolders = Directory.GetFiles(srcFolder, "xunit.v3.*.csproj", SearchOption.AllDirectories) .Where(x => !x.EndsWith(".tests.csproj")) .OrderBy(x => x) .Select(x => Path.GetDirectoryName(x).Substring(context.BaseFolder.Length + 1)); foreach (var projectFolder in projectFolders) { var packArgs = $"pack --nologo --no-build --configuration {context.ConfigurationText} --output {context.PackageOutputFolder} {projectFolder}"; // Pack the project await context.Exec("dotnet", packArgs); // Pack any .nuspec files that might be here as well var nuspecFiles = Directory.GetFiles(projectFolder, "*.nuspec") .OrderBy(x => x) .Select(x => Path.GetFileName(x)); foreach (var nuspecFile in nuspecFiles) { await context.Exec("dotnet", $"{packArgs} -p:NuspecFile={nuspecFile}"); } } }
public static Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests"); #if false var net472Subpath = Path.Combine("bin", context.ConfigurationText, "net472"); var testV1Dll = Path.Combine("test", "test.xunit1", "bin", context.ConfigurationText, "net45", "test.xunit1.dll"); var testDlls = Directory.GetFiles(context.BaseFolder, "test.xunit.*.dll", SearchOption.AllDirectories) .Where(x => x.Contains(net472Subpath)) .Select(x => x.Substring(context.BaseFolder.Length + 1)); var xunitConsoleExe = Path.Combine("src", "xunit.console", "bin", context.ConfigurationText, "net472", "xunit.console.exe"); await context.Exec(xunitConsoleExe, $"{testV1Dll} -xml artifacts/test/v1.xml -html artifacts/test/v1.html -appdomains denied {context.TestFlagsNonParallel}"); await context.Exec(xunitConsoleExe, $"{string.Join(" ", testDlls)} -xml artifacts/test/v2.xml -html artifacts/test/v2.html -appdomains denied -serialize {context.TestFlagsParallel}"); Console.WriteLine(); #else context.WriteLineColor(ConsoleColor.Yellow, ".NET Framework tests are not running yet."); Console.WriteLine(); return(Task.CompletedTask); #endif }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests (via MSBuild runner)"); try { await context.Exec("msbuild", $"tools/builder/msbuild/netfx.proj -target:TestV3 -property:Configuration={context.ConfigurationText} -verbosity:{context.Verbosity}"); // Mono is only supported for v3 if (context.NeedMono) { return; } if (context.V3Only) { return; } await context.Exec("msbuild", $"tools/builder/msbuild/netfx.proj -target:TestV2 -property:Configuration={context.ConfigurationText} -verbosity:{context.Verbosity}"); await context.Exec("msbuild", $"tools/builder/msbuild/netfx.proj -target:TestV1 -property:Configuration={context.ConfigurationText} -verbosity:{context.Verbosity}"); } catch (Win32Exception ex) { if (ex.NativeErrorCode != 2) { throw; } context.WriteLineColor(ConsoleColor.Red, "Could not find 'msbuild.exe' on the system PATH. Please run the build from a developer command prompt."); throw new ExitCodeException(-2); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Compiling binaries (AnyCPU)"); await context.Exec("dotnet", $"msbuild -maxCpuCount -verbosity:{context.Verbosity} -p:Configuration={context.ConfigurationText}"); context.BuildStep("Compiling binaries (32-bit)"); await context.Exec("dotnet", $"msbuild -maxCpuCount -verbosity:{context.Verbosity} -p:Configuration={context.ConfigurationText} -p:BuildX86=true"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Restoring NuGet packages"); await context.Exec("dotnet", $"restore --verbosity {context.Verbosity}"); context.BuildStep("Restoring .NET Core command-line tools"); await context.Exec("dotnet", $"tool restore --verbosity {context.Verbosity}"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Compiling binaries"); var assertFiles = Directory.GetFiles(Path.Combine(context.BaseFolder, "src", "xunit.assert", "Asserts")); if (assertFiles.Length == 0) { await context.Exec("git", "submodule update --init"); } await context.Exec("dotnet", $"msbuild -p:Configuration={context.ConfigurationText}"); await context.Exec("dotnet", $"msbuild src/xunit.console/xunit.console.csproj -p:Configuration={context.ConfigurationText} -p:Platform=x86"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Signing NuGet packages"); var signClientUser = Environment.GetEnvironmentVariable("SignClientUser"); var signClientSecret = Environment.GetEnvironmentVariable("SignClientSecret"); if (string.IsNullOrWhiteSpace(signClientUser) || string.IsNullOrWhiteSpace(signClientSecret)) { context.WriteLineColor(ConsoleColor.Yellow, $"Skipping packing signing because environment variables 'SignClientUser' and/or 'SignClientSecret' are not set.{Environment.NewLine}"); return; } var packageFiles = Directory.GetFiles(context.PackageOutputFolder, "*.nupkg", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); var signClientAppSettings = Path.Combine(context.BaseFolder, "tools", "SignClient", "appsettings.json"); foreach (var packageFile in packageFiles) { var args = $"SignClient sign -c \"{signClientAppSettings}\" -r \"{signClientUser}\" -s \"{signClientSecret}\" -n \"xUnit.net\" -d \"xUnit.net\" -u \"https://github.com/xunit/xunit\" -i \"{packageFile}\""; var redactedArgs = args.Replace(signClientUser, "[redacted]") .Replace(signClientSecret, "[redacted]"); await context.Exec("dotnet", args, redactedArgs); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Publishing NuGet packages"); Directory.CreateDirectory(context.PackageOutputFolder); var publishToken = Environment.GetEnvironmentVariable("PublishToken"); if (string.IsNullOrWhiteSpace(publishToken)) { context.WriteLineColor(ConsoleColor.Yellow, $"Skipping package publishing because environment variable 'PublishToken' is not set.{Environment.NewLine}"); return; } var packageFiles = Directory .GetFiles(context.PackageOutputFolder, "*.nupkg", SearchOption.AllDirectories) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var packageFile in packageFiles.OrderBy(x => x)) { var args = $"nuget push --source https://www.myget.org/F/xunit/api/v2/package --api-key {publishToken} {packageFile}"; var redactedArgs = args.Replace(publishToken, "[redacted]"); await context.Exec("dotnet", args, redactedArgs); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Creating NuGet packages"); Directory.CreateDirectory(context.PackageOutputFolder); // Clean up any existing packages to force re-packing var packageFiles = Directory.GetFiles(context.PackageOutputFolder, "*.nupkg"); foreach (var packageFile in packageFiles) { File.Delete(packageFile); } // Enumerate the project folders to find what to pack var srcFolder = Path.Join(context.BaseFolder, "src"); var projectFolders = Directory .GetFiles(srcFolder, "xunit.v3.*.csproj", SearchOption.AllDirectories) .Where(x => !x.EndsWith(".tests.csproj")) .Select(x => Path.GetDirectoryName(x)?.Substring(context.BaseFolder.Length + 1)) .WhereNotNull() .Where(x => !File.Exists(Path.Combine(x, ".no-package"))); foreach (var projectFolder in projectFolders.OrderBy(x => x)) { var packArgs = $"pack --nologo --no-build --configuration {context.ConfigurationText} --output {context.PackageOutputFolder} --verbosity {context.Verbosity} {projectFolder}"; var nuspecFiles = Directory .GetFiles(projectFolder, "*.nuspec") .Select(x => Path.GetFileName(x)); // Pack the .nuspec file(s) foreach (var nuspecFile in nuspecFiles.OrderBy(x => x)) { await context.Exec("dotnet", $"{packArgs} -p:NuspecFile={nuspecFile}"); } // Only pack the .csproj if there's not an exact matching .nuspec file if (!nuspecFiles.Any(f => File.Exists(Path.Combine(projectFolder, Path.GetFileNameWithoutExtension(f) + ".csproj")))) { await context.Exec("dotnet", packArgs); } } }
public static Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests"); var resultPath = Path.Combine(context.BaseFolder, "artifacts", "test"); File.Delete(Path.Combine(resultPath, "netfx.trx")); return(context.Exec("dotnet", $"test src/xunit.analyzers.tests --framework net472 --configuration {context.ConfigurationText} --no-build --logger trx;LogFileName=netfx.trx --results-directory \"{resultPath}\" --verbosity {context.Verbosity}")); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Cleaning build artifacts"); await context.Exec("dotnet", $"clean --verbosity {context.Verbosity} --nologo"); if (Directory.Exists(context.ArtifactsFolder)) { Directory.Delete(context.ArtifactsFolder, recursive: true); } }
public static async Task OnExecute(BuildContext context) { var assertFiles = Directory.GetFiles(Path.Combine(context.BaseFolder, "src", "xunit.v3.assert", "Asserts")); var mediaFiles = Directory.GetFiles(Path.Combine(context.BaseFolder, "tools", "media")); if (assertFiles.Length == 0 || mediaFiles.Length == 0) { context.BuildStep("Updating submodules"); await context.Exec("git", "submodule update --init"); } context.BuildStep("Restoring NuGet packages"); await context.Exec("dotnet", $"restore --verbosity {context.Verbosity}"); context.BuildStep("Restoring .NET Core command-line tools"); await context.Exec("dotnet", $"tool restore --verbosity {context.Verbosity}"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Creating NuGet packages"); var nuspecFiles = Directory.GetFiles(context.BaseFolder, "*.nuspec", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var nuspecFile in nuspecFiles) { await context.Exec(context.NuGetExe, $"pack {nuspecFile} -NonInteractive -NoPackageAnalysis -OutputDirectory {context.PackageOutputFolder} -Properties Configuration={context.ConfigurationText}"); } }
public static async Task OnExecute(BuildContext context) { var signClientUser = Environment.GetEnvironmentVariable("SignClientUser"); var signClientSecret = Environment.GetEnvironmentVariable("SignClientSecret"); if (signClientUser == null || signClientSecret == null) { context.WriteLineColor(ConsoleColor.Yellow, $"Skipping packing signing because environment variables 'SignClientUser' and/or 'SignClientSecret' are not set.{Environment.NewLine}"); return; } var signClientFolder = Path.Combine(context.BaseFolder, "packages", $"SignClient.{context.SignClientVersion}"); if (!Directory.Exists(signClientFolder)) { context.BuildStep($"Downloading SignClient {context.SignClientVersion}"); await context.Exec(context.NuGetExe, $"install SignClient -version {context.SignClientVersion} -SolutionDir \"{context.BaseFolder}\" -Verbosity quiet -NonInteractive"); } context.BuildStep("Signing NuGet packages"); var appPath = Path.Combine(signClientFolder, "tools", "netcoreapp2.0", "SignClient.dll"); var packageFiles = Directory.GetFiles(context.PackageOutputFolder, "*.nupkg", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); var signClientAppSettings = Path.Combine(context.BaseFolder, "tools", "SignClient", "appsettings.json"); foreach (var packageFile in packageFiles) { var args = $"\"{appPath}\" sign -c \"{signClientAppSettings}\" -r \"{signClientUser}\" -s \"{signClientSecret}\" -n \"xUnit.net\" -d \"xUnit.net\" -u \"https://github.com/xunit/xunit\" -i \"{packageFile}\""; var redactedArgs = args.Replace(signClientUser, "[redacted]") .Replace(signClientSecret, "[redacted]"); await context.Exec("dotnet", args, redactedArgs); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Creating NuGet packages"); var srcFolder = Path.Join(context.BaseFolder, "src"); var projectFolders = Directory.GetFiles(srcFolder, "xunit.v3.*.csproj", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => Path.GetDirectoryName(x).Substring(context.BaseFolder.Length + 1)); foreach (var projectFolder in projectFolders) { await context.Exec("dotnet", $"pack --nologo --no-build --configuration {context.ConfigurationText} --output {context.PackageOutputFolder} {projectFolder}"); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Core tests"); var netCoreSubpath = Path.Combine("bin", context.ConfigurationText, "netcoreapp"); var testDlls = Directory.GetFiles(context.BaseFolder, "xunit.v3.*.tests.dll", SearchOption.AllDirectories) .Where(x => x.Contains(netCoreSubpath)) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var testDll in testDlls) { var fileName = Path.GetFileName(testDll); var folder = Path.GetDirectoryName(testDll); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(testDll) + "-" + Path.GetFileName(folder)); await context.Exec("dotnet", $"exec {fileName} {context.TestFlagsParallel} -xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests (via Console runner)"); // v1 var v1Folder = Path.Combine(context.BaseFolder, "src", "xunit.v1.tests", "bin", context.ConfigurationText, "net45"); var v1OutputFileName = Path.Combine(context.TestOutputFolder, "xunit.v1.tests-net45"); await context.Exec(context.ConsoleRunnerExe, $"{v1Folder}/xunit.v1.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v1OutputFileName}.xml\" -html \"{v1OutputFileName}.html\"", workingDirectory : v1Folder); await context.Exec(context.ConsoleRunner32Exe, $"{v1Folder}/xunit.v1.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v1OutputFileName}-x86.xml\" -html \"{v1OutputFileName}-x86.html\"", workingDirectory : v1Folder); // v2 var v2Folder = Path.Combine(context.BaseFolder, "src", "xunit.v2.tests", "bin", context.ConfigurationText, "net452"); var v2OutputFileName = Path.Combine(context.TestOutputFolder, "xunit.v2.tests-net452"); await context.Exec(context.ConsoleRunnerExe, $"{v2Folder}/xunit.v2.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v2OutputFileName}.xml\" -html \"{v2OutputFileName}.html\"", workingDirectory : v2Folder); await context.Exec(context.ConsoleRunner32Exe, $"{v2Folder}/xunit.v2.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v2OutputFileName}-x86.xml\" -html \"{v2OutputFileName}-x86.html\"", workingDirectory : v2Folder); // v3 // TODO: Convert to console runner when it's available var netFxSubpath = Path.Combine("bin", context.ConfigurationText, "net4"); var v3NetFxTestExes = Directory.GetFiles(context.BaseFolder, "xunit.v3.*.tests.exe", SearchOption.AllDirectories) .Where(x => x.Contains(netFxSubpath)) .OrderBy(x => x); foreach (var v3NetFxTestExe in v3NetFxTestExes) { var folder = Path.GetDirectoryName(v3NetFxTestExe); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3NetFxTestExe) + "-" + Path.GetFileName(folder)); await context.Exec(v3NetFxTestExe, $"{context.TestFlagsParallel}-xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } // Can't run 32-bit binaries on Mono (no side-by-side 32- and 64-bit, unlike .NET Framework on Windows) if (!context.NeedMono) { var netFx32Subpath = Path.Combine("bin", context.ConfigurationText + "_x86", "net4"); var v3NetFx32TestExes = Directory.GetFiles(context.BaseFolder, "xunit.v3.*.tests.exe", SearchOption.AllDirectories) .Where(x => x.Contains(netFx32Subpath)) .OrderBy(x => x); foreach (var v3NetFx32TestExe in v3NetFx32TestExes) { var folder = Path.GetDirectoryName(v3NetFx32TestExe); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3NetFx32TestExe) + "-" + Path.GetFileName(folder) + "-x86"); await context.Exec(v3NetFx32TestExe, $"{context.TestFlagsParallel}-xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests"); var netFxSubpath = Path.Combine("bin", context.ConfigurationText, "net4"); // TODO: Need to re-enable v1 tests, and port over some v2 tests var testDlls = Directory.GetFiles(context.BaseFolder, "xunit.v3.*.tests.exe", SearchOption.AllDirectories) .Where(x => x.Contains(netFxSubpath)) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var testDll in testDlls) { var fileName = Path.GetFileName(testDll); var folder = Path.GetDirectoryName(testDll); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(testDll) + "-" + Path.GetFileName(folder)); await context.Exec(fileName, $"{context.TestFlagsParallel} -xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Creating NuGet packages"); var versionOverride = string.Format( "{0}.{1}+{2}", Environment.GetEnvironmentVariable("NBGV_CloudBuildNumber"), Environment.GetEnvironmentVariable("NBGV_VersionHeight"), Environment.GetEnvironmentVariable("NBGV_GitCommitIdShort")); var versionOption = versionOverride == ".+" ? string.Empty : $"-Version \"{versionOverride}\""; var nuspecFiles = Directory.GetFiles(context.BaseFolder, "*.nuspec", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var nuspecFile in nuspecFiles) { await context.Exec(context.NuGetExe, $"pack {nuspecFile} -NonInteractive -NoPackageAnalysis -OutputDirectory {context.PackageOutputFolder} -Properties Configuration={context.ConfigurationText} -Verbosity {context.VerbosityNuGet} {versionOption}"); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Signing NuGet packages"); Directory.CreateDirectory(context.PackageOutputFolder); var signClientUser = Environment.GetEnvironmentVariable("SignClientUser"); var signClientSecret = Environment.GetEnvironmentVariable("SignClientSecret"); if (string.IsNullOrWhiteSpace(signClientUser) || string.IsNullOrWhiteSpace(signClientSecret)) { context.WriteLineColor(ConsoleColor.Yellow, $"Skipping packing signing because environment variables 'SignClientUser' and/or 'SignClientSecret' are not set.{Environment.NewLine}"); return; } var signClientAppSettings = Path.Combine(context.BaseFolder, "tools", "SignClient", "appsettings.json"); var args = $"SignClient sign --config \"{signClientAppSettings}\" --user \"{signClientUser}\" --secret \"{signClientSecret}\" --name \"xUnit.net\" --description \"xUnit.net\" -u \"https://github.com/xunit/xunit\" --baseDirectory \"{context.PackageOutputFolder}\" --input **/*.nupkg"; var redactedArgs = args.Replace(signClientUser, "[redacted]") .Replace(signClientSecret, "[redacted]"); await context.Exec("dotnet", args, redactedArgs); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Pushing packages to MyGet"); var myGetApiKey = Environment.GetEnvironmentVariable("MyGetApiKey"); if (myGetApiKey == null) { context.WriteLineColor(ConsoleColor.Yellow, $"Skipping MyGet push because environment variable 'MyGetApiKey' is not set.{Environment.NewLine}"); return; } var packageFiles = Directory.GetFiles(context.PackageOutputFolder, "*.nupkg", SearchOption.AllDirectories) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var packageFile in packageFiles) { var args = $"push -source https://www.myget.org/F/xunit/api/v2/package -apiKey {myGetApiKey} {packageFile}"; var redactedArgs = args.Replace(myGetApiKey, "[redacted]"); await context.Exec(context.NuGetExe, args, redactedArgs); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Formatting source"); await context.Exec("dotnet", $"dotnet-format --folder --exclude src/xunit.v3.assert/Asserts"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Core tests (via Console runner)"); Directory.CreateDirectory(context.TestOutputFolder); // v3 (default bitness) // TODO: Convert to console runner when it's available var netCoreSubpath = Path.Combine("bin", context.ConfigurationText, "netcoreapp"); var v3TestDlls = Directory .GetFiles(context.BaseFolder, "xunit.v3.*.tests.dll", SearchOption.AllDirectories) .Where(x => x.Contains(netCoreSubpath)) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var v3TestDll in v3TestDlls) { var fileName = Path.GetFileName(v3TestDll); var folder = Path.GetDirectoryName(v3TestDll); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3TestDll) + "-" + Path.GetFileName(folder)); await context.Exec("dotnet", $"exec {fileName} {context.TestFlagsParallel}-preenumeratetheories -xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } // Only run 32-bit .NET Core tests on Windows if (context.NeedMono) { return; } // Only run 32-bit .NET Core tests if 32-bit .NET Core is installed var programFilesX86 = Environment.GetEnvironmentVariable("ProgramFiles(x86)"); if (programFilesX86 == null) { return; } var x86Dotnet = Path.Combine(programFilesX86, "dotnet", "dotnet.exe"); if (!File.Exists(x86Dotnet)) { return; } // v3 (forced 32-bit) var netCore32Subpath = Path.Combine("bin", context.ConfigurationText + "_x86", "netcoreapp"); var v3x86TestDlls = Directory .GetFiles(context.BaseFolder, "xunit.v3.*.tests.x86.dll", SearchOption.AllDirectories) .Where(x => x.Contains(netCore32Subpath)) .OrderBy(x => x) .Select(x => x.Substring(context.BaseFolder.Length + 1)); foreach (var v3x86TestDll in v3x86TestDlls) { var fileName = Path.GetFileName(v3x86TestDll); var folder = Path.GetDirectoryName(v3x86TestDll); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3x86TestDll) + "-" + Path.GetFileName(folder)); await context.Exec(x86Dotnet, $"exec {fileName} {context.TestFlagsParallel}-preenumeratetheories -xml \"{outputFileName}-x86.xml\" -html \"{outputFileName}-x86.html\"", workingDirectory : folder); } }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Running .NET Framework tests (via Console runner)"); Directory.CreateDirectory(context.TestOutputFolder); // v3 (default bitness) var netFxSubpath = Path.Combine("bin", context.ConfigurationText, "net4"); var v3OutputFileName = Path.Combine(context.TestOutputFolder, "xunit.v3.tests-netfx"); var v3TestExes = Directory .GetFiles(context.BaseFolder, "xunit.v3.*.tests.exe", SearchOption.AllDirectories) .Where(x => x.Contains(netFxSubpath)); #if false // TODO: When we officially move to console runner, combine x86 and AnyCPU binaries into a single run (and output file) await context.Exec(context.ConsoleRunnerExe, $"\"{string.Join("\" \"", v3TestExes)}\" {context.TestFlagsParallel}-preenumeratetheories -xml \"{v3OutputFileName}.xml\" -html \"{v3OutputFileName}.html\""); #else foreach (var v3TestExe in v3TestExes.OrderBy(x => x)) { var folder = Path.GetDirectoryName(v3TestExe); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3TestExe) + "-" + Path.GetFileName(folder)); await context.Exec(v3TestExe, $"{context.TestFlagsParallel}-preenumeratetheories -xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } #endif // Mono is only supported for v3, at whatever bitness the user installs for Mono if (context.NeedMono) { return; } // v3 (forced 32-bit) var netFx32Subpath = Path.Combine("bin", context.ConfigurationText + "_x86", "net4"); var v3x86TestExes = Directory .GetFiles(context.BaseFolder, "xunit.v3.*.tests.x86.exe", SearchOption.AllDirectories) .Where(x => x.Contains(netFx32Subpath)); if (context.V3Only) { return; } #if false await context.Exec(context.ConsoleRunnerExe, $"\"{string.Join("\" \"", v3x86TestExes)}\" {context.TestFlagsParallel}-preenumeratetheories -xml \"{v3OutputFileName}-x86.xml\" -html \"{v3OutputFileName}-x86.html\""); #else foreach (var v3x86TestExe in v3x86TestExes.OrderBy(x => x)) { var folder = Path.GetDirectoryName(v3x86TestExe); var outputFileName = Path.Combine(context.TestOutputFolder, Path.GetFileNameWithoutExtension(v3x86TestExe) + "-" + Path.GetFileName(folder) + "-x86"); await context.Exec(v3x86TestExe, $"{context.TestFlagsParallel}-preenumeratetheories -xml \"{outputFileName}.xml\" -html \"{outputFileName}.html\"", workingDirectory : folder); } #endif // v2 var v2Folder = Path.Combine(context.BaseFolder, "src", "xunit.v2.tests", "bin", context.ConfigurationText, "net452"); var v2OutputFileName = Path.Combine(context.TestOutputFolder, "xunit.v2.tests-netfx"); await context.Exec(context.ConsoleRunnerExe, $"{v2Folder}/xunit.v2.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v2OutputFileName}.xml\" -html \"{v2OutputFileName}.html\"", workingDirectory : v2Folder); await context.Exec(context.ConsoleRunner32Exe, $"{v2Folder}/xunit.v2.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v2OutputFileName}-x86.xml\" -html \"{v2OutputFileName}-x86.html\"", workingDirectory : v2Folder); // v1 var v1Folder = Path.Combine(context.BaseFolder, "src", "xunit.v1.tests", "bin", context.ConfigurationText, "net45"); var v1OutputFileName = Path.Combine(context.TestOutputFolder, "xunit.v1.tests-netfx"); await context.Exec(context.ConsoleRunnerExe, $"{v1Folder}/xunit.v1.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v1OutputFileName}.xml\" -html \"{v1OutputFileName}.html\"", workingDirectory : v1Folder); await context.Exec(context.ConsoleRunner32Exe, $"{v1Folder}/xunit.v1.tests.dll {context.TestFlagsParallel}-appdomains required -xml \"{v1OutputFileName}-x86.xml\" -html \"{v1OutputFileName}-x86.html\"", workingDirectory : v1Folder); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Compiling binaries"); await context.Exec("dotnet", $"build --no-restore --configuration {context.ConfigurationText} --verbosity {context.Verbosity}"); }
public static Task OnExecute(BuildContext context) { context.BuildStep("Restoring NuGet packages"); return(context.Exec("dotnet", "restore")); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Analyzing source"); await context.Exec("dotnet", $"format -f --check --exclude src/xunit.v3.assert/Asserts --verbosity {context.Verbosity}"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Analyzing source (if this fails, run './build FormatSource' to fix)"); await context.Exec("dotnet", $"dotnet-format --check --folder --verbosity {context.Verbosity} --exclude src/xunit.v3.assert/Asserts"); }
public static async Task OnExecute(BuildContext context) { context.BuildStep("Analyzing source"); await context.Exec("dotnet", $"format --check --verbosity {context.Verbosity}"); }