Skip to content

Commit

Permalink
Build the Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Sep 15, 2024
1 parent 6b49cc2 commit a7a1c54
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 74 deletions.
68 changes: 15 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ jobs:
run: dotnet run --project build/Build.csproj -- --target=Default

- name: Test
run: dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release
run: dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release --filter="TestCategory!=Audio & TestCategory!=Effect"
env:
DOTNET_ROOT: ${{github.workspace}}/dotnet64
MGFXC_WINE_PATH: /home/runner/.winemonogame
CI: true
if: runner.os == 'Linux'

- name: Test
run: dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release
run: dotnet test Tools/MonoGame.Tools.Tests/MonoGame.Tools.Tests.csproj --blame-hang-timeout 1m -c Release --filter="TestCategory!=Audio & TestCategory!=Effect"
env:
DOTNET_ROOT: ${{github.workspace}}/dotnet64
MGFXC_WINE_PATH: /Users/runner/.winemonogame
Expand Down Expand Up @@ -160,67 +160,29 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Download the release artifact
- name: Download tools tests
uses: actions/download-artifact@v3
with:
name: tests-tools-${{ matrix.os }}
path: tests-tools

# - name: Disable annotations
# run: echo "::remove-matcher owner=csc::"

# - name: install wine64 on linux
# run: |
# sudo apt install p7zip-full curl
# sudo dpkg --add-architecture i386
# sudo mkdir -pm755 /etc/apt/keyrings
# sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
# sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
# sudo apt update && sudo apt install --install-recommends winehq-stable
# if: runner.os == 'Linux'

# - name: Install Arial Font
# run: |
# echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | sudo debconf-set-selections
# sudo apt install -y ttf-mscorefonts-installer
# sudo fc-cache
# fc-match Arial
# if: runner.os == 'Linux'

# - name: install wine64 on macos
# run: |
# brew install wine-stable p7zip freeimage freetype
# sudo mkdir -p /usr/local/lib
# sudo ln -s /opt/homebrew/lib/libfreetype.dylib /usr/local/lib/libfreetype6.dylib
# sudo ln -s /opt/homebrew/lib/libfreeimage.dylib /usr/local/lib/libfreeimage.dylib
# if: runner.os == 'macOS'

# - name: Setup Wine
# run: wget -qO- https://monogame.net/downloads/net9_mgfxc_wine_setup.sh | bash
# if: runner.os != 'Windows'

# #Not working yet they crash
# - name: Test Wine
# run: wine64 dotnet --info
# env:
# WINEPREFIX: /home/runner/.winemonogame
# if: runner.os == 'Linux'

# #Not working yet they crash
# - name: Test Wine
# run: wine64 dotnet --info
# env:
# WINEPREFIX: /Users/runner/.winemonogame
# if: runner.os == 'macOS'

# - name: Download Tests
# run: dotnet run --project build/Build.csproj -- --target=Test
- name: Download the tests
uses: actions/download-artifact@v3
with:
name: tests-desktopgl-${{ matrix.os }}
path: tests

- name: Install Tools
run: |
dotnet tool install --create-manifest-if-needed mgcb-basisu
dotnet tool install --create-manifest-if-needed mgcb-crunch
- name: Run Tests
- name: Run Tools Tests
run: dotnet test tests-tools/MonoGame.Tools.Tests.dll --blame-hang-timeout 1m
env:
CI: true

- name: Run Tests
run: dotnet test tests/MonoGame.Tests.dll --blame-hang-timeout 1m
env:
CI: true
1 change: 1 addition & 0 deletions Tests/Framework/Audio/DynamicSoundEffectInstanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace MonoGame.Tests.Audio
{
[Category("Audio")]
class DynamicSoundEffectInstanceTest
{
[SetUp]
Expand Down
1 change: 1 addition & 0 deletions Tests/Framework/Audio/SoundEffectInstanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace MonoGame.Tests.Audio
{
[Category("Audio")]
class SoundEffectInstanceTest
{
[SetUp]
Expand Down
1 change: 1 addition & 0 deletions Tests/Framework/Audio/SoundEffectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace MonoGame.Tests.Audio
{
[Category("Audio")]
public class SoundEffectTests
{
[SetUp]
Expand Down
2 changes: 2 additions & 0 deletions Tests/Framework/Audio/XactTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

namespace MonoGame.Tests.Audio
{

[TestFixture]
[Category("Audio")]
public class XactTests
{
private AudioEngine _audioEngine;
Expand Down
3 changes: 3 additions & 0 deletions Tests/MonoGame.Tests.DesktopGL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<DefineConstants>DESKTOPGL</DefineConstants>
<DefineConstants Condition=" $([MSBuild]::IsOsPlatform('osx')) " >$(DefineConstants);MACOS</DefineConstants>
<DefineConstants Condition=" $([MSBuild]::IsOsPlatform('windows')) " >$(DefineConstants);WINDOWS</DefineConstants>
<DefineConstants Condition=" $([MSBuild]::IsOsPlatform('linux')) " >$(DefineConstants);LINUX</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/AudioContentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS && CI
[Ignore("Hanging on Mac in CI?")]
#endif
[Category("Audio")]
class AudioContentTests
{
[Test]
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/EffectProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS || LINUX
[Ignore("Does not work on CI yet. need to get wine working.")]
#endif
[Category("Effects")]
class EffectProcessorTests
{
class ImporterContext : ContentImporterContext
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/Mp3ImporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS && CI
[Ignore("Hanging on Mac in CI?")]
#endif
[Category("Audio")]
class Mp3ImporterTests
{
[Test]
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/OggImporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS && CI
[Ignore("Hanging on Mac in CI?")]
#endif
[Category("Audio")]
class OggImporterTests
{
[Test]
Expand Down
2 changes: 1 addition & 1 deletion Tools/MonoGame.Tools.Tests/TextureImporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void ImportTif( )
/// </summary>
[Test]
#if MACOS || LINUX
[Ignore("Does not work on Unix based systems. We need to get wine working on CI.")]
[Ignore("Does not work on Unix based systems. Its odd the test passes?")]
#endif
public void ImportImageWithBadContent( )
{
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/WavImporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS && CI
[Ignore("Hanging on Mac in CI")]
#endif
[Category("Audio")]
class WavImporterTests
{
[Test]
Expand Down
4 changes: 1 addition & 3 deletions Tools/MonoGame.Tools.Tests/WmaImporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace MonoGame.Tests.ContentPipeline
{
#if MACOS && CI
[Ignore("Hanging on Mac in CI?")]
#endif
[Category("Audio")]
class WmaImporterTests
{
[Test]
Expand Down
2 changes: 2 additions & 0 deletions build/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum ProjectType
Framework,
Tools,
Templates,
Tests,
ContentPipeline,
MGCBEditor,
MGCBEditorLauncher
Expand Down Expand Up @@ -150,6 +151,7 @@ public BuildContext(ICakeContext context) : base(context)
ProjectType.Framework => $"MonoGame.Framework/MonoGame.Framework.{id}.csproj",
ProjectType.Tools => $"Tools/{id}/{id}.csproj",
ProjectType.Templates => $"Templates/{id}/{id}.csproj",
ProjectType.Tests => $"Tests/{id}.DesktopGL.csproj",
ProjectType.ContentPipeline => "MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj",
ProjectType.MGCBEditor => $"Tools/MonoGame.Content.Builder.Editor/MonoGame.Content.Builder.Editor.{id}.csproj",
ProjectType.MGCBEditorLauncher => $"Tools/MonoGame.Content.Builder.Editor.Launcher/MonoGame.Content.Builder.Editor.Launcher.{id}.csproj",
Expand Down
2 changes: 1 addition & 1 deletion build/BuildToolsTasks/BuildToolTestsTask.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace BuildScripts;

[TaskName("Build ToolTests")]
[TaskName("Build Tool Tests")]
[IsDependentOn(typeof(BuildContentPipelineTask))]
public sealed class BuildToolTestsTask : FrostingTask<BuildContext>
{
Expand Down
1 change: 1 addition & 0 deletions build/DeployTasks/UploadArtifactsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public override async Task RunAsync(BuildContext context)

await context.GitHubActions().Commands.UploadArtifact(new DirectoryPath(context.NuGetsDirectory.FullPath), $"nuget-{os}");
await context.GitHubActions().Commands.UploadArtifact(new DirectoryPath(System.IO.Path.Combine(context.BuildOutput, "Tests", "Tools", "Release")), $"tests-tools-{os}");
await context.GitHubActions().Commands.UploadArtifact(new DirectoryPath(System.IO.Path.Combine(context.BuildOutput, "Tests", "DesktopGL", "Release")), $"tests-desktopgl-{os}");
}
}
2 changes: 1 addition & 1 deletion build/TestTasks/DownloadTestArtifactsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public override async Task RunAsync(BuildContext context)
var os = context.Environment.Platform.Family switch
{
PlatformFamily.Windows => "windows",
PlatformFamily.OSX => "mac",
PlatformFamily.OSX => "macos",
_ => "linux"
};
context.CreateDirectory("tests-tools");
Expand Down

0 comments on commit a7a1c54

Please sign in to comment.