diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0624c7bdac0..7461d721376 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,7 @@ 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 @@ -83,7 +83,7 @@ jobs: 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 @@ -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 \ No newline at end of file diff --git a/Tests/Framework/Audio/DynamicSoundEffectInstanceTest.cs b/Tests/Framework/Audio/DynamicSoundEffectInstanceTest.cs index d065142a862..1f2f73f77d1 100644 --- a/Tests/Framework/Audio/DynamicSoundEffectInstanceTest.cs +++ b/Tests/Framework/Audio/DynamicSoundEffectInstanceTest.cs @@ -11,6 +11,7 @@ namespace MonoGame.Tests.Audio { + [Category("Audio")] class DynamicSoundEffectInstanceTest { [SetUp] diff --git a/Tests/Framework/Audio/SoundEffectInstanceTest.cs b/Tests/Framework/Audio/SoundEffectInstanceTest.cs index e8187200be6..fec843b523a 100644 --- a/Tests/Framework/Audio/SoundEffectInstanceTest.cs +++ b/Tests/Framework/Audio/SoundEffectInstanceTest.cs @@ -14,6 +14,7 @@ namespace MonoGame.Tests.Audio { + [Category("Audio")] class SoundEffectInstanceTest { [SetUp] diff --git a/Tests/Framework/Audio/SoundEffectTest.cs b/Tests/Framework/Audio/SoundEffectTest.cs index c2764110905..34535581bfb 100644 --- a/Tests/Framework/Audio/SoundEffectTest.cs +++ b/Tests/Framework/Audio/SoundEffectTest.cs @@ -12,6 +12,7 @@ namespace MonoGame.Tests.Audio { + [Category("Audio")] public class SoundEffectTests { [SetUp] diff --git a/Tests/Framework/Audio/XactTest.cs b/Tests/Framework/Audio/XactTest.cs index c46163e89ed..9e3fe11c2cd 100644 --- a/Tests/Framework/Audio/XactTest.cs +++ b/Tests/Framework/Audio/XactTest.cs @@ -12,7 +12,9 @@ namespace MonoGame.Tests.Audio { + [TestFixture] + [Category("Audio")] public class XactTests { private AudioEngine _audioEngine; diff --git a/Tests/MonoGame.Tests.DesktopGL.csproj b/Tests/MonoGame.Tests.DesktopGL.csproj index b3fb9d9f85c..7459107f627 100644 --- a/Tests/MonoGame.Tests.DesktopGL.csproj +++ b/Tests/MonoGame.Tests.DesktopGL.csproj @@ -8,6 +8,9 @@ false false DESKTOPGL + $(DefineConstants);MACOS + $(DefineConstants);WINDOWS + $(DefineConstants);LINUX diff --git a/Tools/MonoGame.Tools.Tests/AudioContentTests.cs b/Tools/MonoGame.Tools.Tests/AudioContentTests.cs index a43b279ca43..089eaf3ea46 100644 --- a/Tools/MonoGame.Tools.Tests/AudioContentTests.cs +++ b/Tools/MonoGame.Tools.Tests/AudioContentTests.cs @@ -11,9 +11,7 @@ namespace MonoGame.Tests.ContentPipeline { -#if MACOS && CI - [Ignore("Hanging on Mac in CI?")] -#endif + [Category("Audio")] class AudioContentTests { [Test] diff --git a/Tools/MonoGame.Tools.Tests/EffectProcessorTests.cs b/Tools/MonoGame.Tools.Tests/EffectProcessorTests.cs index bd4e4357caa..4f7a57841be 100644 --- a/Tools/MonoGame.Tools.Tests/EffectProcessorTests.cs +++ b/Tools/MonoGame.Tools.Tests/EffectProcessorTests.cs @@ -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 diff --git a/Tools/MonoGame.Tools.Tests/Mp3ImporterTests.cs b/Tools/MonoGame.Tools.Tests/Mp3ImporterTests.cs index 665988bf001..7e0b7d8331f 100644 --- a/Tools/MonoGame.Tools.Tests/Mp3ImporterTests.cs +++ b/Tools/MonoGame.Tools.Tests/Mp3ImporterTests.cs @@ -9,9 +9,7 @@ namespace MonoGame.Tests.ContentPipeline { -#if MACOS && CI - [Ignore("Hanging on Mac in CI?")] -#endif + [Category("Audio")] class Mp3ImporterTests { [Test] diff --git a/Tools/MonoGame.Tools.Tests/OggImporterTests.cs b/Tools/MonoGame.Tools.Tests/OggImporterTests.cs index eeecedf9b74..d48b5c999cd 100644 --- a/Tools/MonoGame.Tools.Tests/OggImporterTests.cs +++ b/Tools/MonoGame.Tools.Tests/OggImporterTests.cs @@ -9,9 +9,7 @@ namespace MonoGame.Tests.ContentPipeline { -#if MACOS && CI - [Ignore("Hanging on Mac in CI?")] -#endif + [Category("Audio")] class OggImporterTests { [Test] diff --git a/Tools/MonoGame.Tools.Tests/TextureImporterTests.cs b/Tools/MonoGame.Tools.Tests/TextureImporterTests.cs index c7e20d5e0da..2c29a8dd635 100644 --- a/Tools/MonoGame.Tools.Tests/TextureImporterTests.cs +++ b/Tools/MonoGame.Tools.Tests/TextureImporterTests.cs @@ -106,7 +106,7 @@ public void ImportTif( ) /// [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( ) { diff --git a/Tools/MonoGame.Tools.Tests/WavImporterTests.cs b/Tools/MonoGame.Tools.Tests/WavImporterTests.cs index 0439e40a0ad..04e7c8b45ea 100644 --- a/Tools/MonoGame.Tools.Tests/WavImporterTests.cs +++ b/Tools/MonoGame.Tools.Tests/WavImporterTests.cs @@ -9,9 +9,7 @@ namespace MonoGame.Tests.ContentPipeline { -#if MACOS && CI - [Ignore("Hanging on Mac in CI")] -#endif + [Category("Audio")] class WavImporterTests { [Test] diff --git a/Tools/MonoGame.Tools.Tests/WmaImporterTests.cs b/Tools/MonoGame.Tools.Tests/WmaImporterTests.cs index 7bca033404f..af28b8ae358 100644 --- a/Tools/MonoGame.Tools.Tests/WmaImporterTests.cs +++ b/Tools/MonoGame.Tools.Tests/WmaImporterTests.cs @@ -9,9 +9,7 @@ namespace MonoGame.Tests.ContentPipeline { -#if MACOS && CI - [Ignore("Hanging on Mac in CI?")] -#endif + [Category("Audio")] class WmaImporterTests { [Test] diff --git a/build/BuildContext.cs b/build/BuildContext.cs index c94433bdfc3..1ce16e46fe1 100644 --- a/build/BuildContext.cs +++ b/build/BuildContext.cs @@ -9,6 +9,7 @@ public enum ProjectType Framework, Tools, Templates, + Tests, ContentPipeline, MGCBEditor, MGCBEditorLauncher @@ -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", diff --git a/build/BuildToolsTasks/BuildToolTestsTask.cs b/build/BuildToolsTasks/BuildToolTestsTask.cs index 15f9c9f23e5..1d0f43c6a67 100644 --- a/build/BuildToolsTasks/BuildToolTestsTask.cs +++ b/build/BuildToolsTasks/BuildToolTestsTask.cs @@ -1,7 +1,7 @@ namespace BuildScripts; -[TaskName("Build ToolTests")] +[TaskName("Build Tool Tests")] [IsDependentOn(typeof(BuildContentPipelineTask))] public sealed class BuildToolTestsTask : FrostingTask { diff --git a/build/DeployTasks/UploadArtifactsTask.cs b/build/DeployTasks/UploadArtifactsTask.cs index 313855a1a78..310e79fb692 100644 --- a/build/DeployTasks/UploadArtifactsTask.cs +++ b/build/DeployTasks/UploadArtifactsTask.cs @@ -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}"); } } diff --git a/build/TestTasks/DownloadTestArtifactsTask.cs b/build/TestTasks/DownloadTestArtifactsTask.cs index 09ad276625c..46118bcfd52 100644 --- a/build/TestTasks/DownloadTestArtifactsTask.cs +++ b/build/TestTasks/DownloadTestArtifactsTask.cs @@ -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");