Skip to content

Commit

Permalink
Try to get info on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Aug 26, 2024
1 parent 9cabbfd commit 63d06ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,23 @@ jobs:
run: dotnet run --project build/Build.csproj -- --target=Default
if: runner.os == 'Windows'

- name: Build Tests
run: dotnet build Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj -c Release

- name: Test
run: ${{github.workspace}}/dotnet64/dotnet test artifacts/Tests/Tools/Release/MonoGame.Tools.Tests.dll --blame-hang-timeout 1m
run: ${{github.workspace}}/dotnet64/dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release
env:
DOTNET_ROOT: ${{github.workspace}}/dotnet64
MGFXC_WINE_PATH: /home/runner/.winemonogame
if: runner.os == 'Linux'

#Not working yet they time out
- name: Test
run: ${{github.workspace}}/dotnet64/dotnet test artifacts/Tests/Tools/Release/MonoGame.Tools.Tests.dll --blame-hang-timeout 1m
run: ${{github.workspace}}/dotnet64/dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release
env:
DOTNET_ROOT: ${{github.workspace}}/dotnet64
MGFXC_WINE_PATH: /Users/runner/.winemonogame
if: runner.os == 'macOS'

- name: Test
run: dotnet test test artifacts/Tests/Tools/Release/MonoGame.Tools.Tests.dll --blame-hang-timeout 1m
run: dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release
if: runner.os == 'Windows'

- name: Expose GitHub Runtime
Expand Down
13 changes: 8 additions & 5 deletions Tools/MonoGame.Tools.Tests/BuilderTargetsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ string FindTool (string toolName)
TestContext.WriteLine ("returning:" + toolName);
return toolName;
}
bool RunBuild(string buildTool, string projectFile, params string[] parameters)
bool RunBuild(string buildTool, string projectFile, out string output, params string[] parameters)
{
var root = Path.GetDirectoryName(typeof(BuilderTargetsTest).Assembly.Location);
var psi = new ProcessStartInfo(FindTool(buildTool))
{
Arguments = "build " + projectFile + " -t:IncludeContent " + string.Join(" ", parameters) + " -bl",
Arguments = "build " + projectFile + " -t:IncludeContent " + string.Join(" ", parameters) + " -v:diag -tl:off -bl",
WorkingDirectory = root,
UseShellExecute = true,
UseShellExecute = false,
RedirectStandardOutput = true,
};
TestContext.WriteLine (psi.FileName + " " + psi.Arguments);
using (var process = Process.Start(psi))
{
output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return process.ExitCode == 0;
}
TestContext.WriteLine (output);
}

[Test]
Expand All @@ -50,10 +53,10 @@ public void BuildSimpleProject()
if (Directory.Exists(outputPath))
Directory.Delete(outputPath, recursive: true);

var result = RunBuild("dotnet", Path.Combine(root, "Assets", "Projects", "BuildSimpleProject.csproj"), new string[] {
var result = RunBuild("dotnet", Path.Combine(root, "Assets", "Projects", "BuildSimpleProject.csproj"), out string output, new string[] {
"-p:MGCBCommand=" + Path.Combine(root, "mgcb.dll")
});
Assert.AreEqual(true, result, "Content Build should have succeeded.");
Assert.AreEqual(true, result, $"Content Build should have succeeded.\n{output}");
var contentFont = Path.Combine(outputPath, "DesktopGL", "Content", "ContentFont.xnb");
Assert.IsTrue(File.Exists(contentFont), "'" + contentFont + "' should exist.");
}
Expand Down

0 comments on commit 63d06ac

Please sign in to comment.