Explorar o código

Fixes #3689. Release builds broken (#3690)

* Initial commit

* added #if DEBUG_IDISPOSABLE

* Tweaked yml
Tig hai 11 meses
pai
achega
e21f158077

+ 20 - 2
.github/workflows/dotnet-core.yml

@@ -11,7 +11,7 @@ on:
       - '**.md'
       - '**.md'
       
       
 jobs:
 jobs:
-  build_and_test:
+  build_and_test_debug:
 
 
     runs-on: ${{ matrix.os }}
     runs-on: ${{ matrix.os }}
     strategy:
     strategy:
@@ -23,7 +23,7 @@ jobs:
     timeout-minutes: 10
     timeout-minutes: 10
     steps:
     steps:
 
 
-# Build
+# Build (Debug)
 
 
     - name: Checkout code
     - name: Checkout code
       uses: actions/checkout@v4
       uses: actions/checkout@v4
@@ -76,6 +76,24 @@ jobs:
           logs/    
           logs/    
           UnitTests/TestResults/
           UnitTests/TestResults/
   
   
+
+  build_release:
+    # Ensure that RELEASE builds are not broken
+    runs-on: ubuntu-latest
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v4
+
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v4
+      with:
+        dotnet-version: 8.x
+        dotnet-quality: 'ga'
+
+    - name: Build Release
+      run: dotnet build --configuration Release
+
+
     # Note: this step is currently not writing to the gist for some reason
     # Note: this step is currently not writing to the gist for some reason
     # - name: Create Test Coverage Badge
     # - name: Create Test Coverage Badge
     #   uses: simon-k/[email protected]
     #   uses: simon-k/[email protected]

+ 4 - 1
UnitTests/Views/ColorPickerTests.cs

@@ -620,8 +620,9 @@ public class ColorPickerTests
 
 
         var hex = GetTextField (cp, ColorPickerPart.Hex);
         var hex = GetTextField (cp, ColorPickerPart.Hex);
 
 
+#if DEBUG_IDISPOSABLE
         Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.False (b.WasDisposed));
         Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.False (b.WasDisposed));
-
+#endif
         cp.Style.ColorModel = ColorModel.RGB;
         cp.Style.ColorModel = ColorModel.RGB;
         cp.ApplyStyleChanges ();
         cp.ApplyStyleChanges ();
 
 
@@ -636,7 +637,9 @@ public class ColorPickerTests
         var hexAfter = GetTextField (cp, ColorPickerPart.Hex);
         var hexAfter = GetTextField (cp, ColorPickerPart.Hex);
 
 
         // Old bars should be disposed
         // Old bars should be disposed
+#if DEBUG_IDISPOSABLE
         Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.True (b.WasDisposed));
         Assert.All (new View [] { b1, b2, b3, tf1, tf2, tf3,hex }, b => Assert.True (b.WasDisposed));
+#endif
         Assert.NotSame (hex,hexAfter);
         Assert.NotSame (hex,hexAfter);
 
 
         Assert.NotSame (b1,b1After);
         Assert.NotSame (b1,b1After);

+ 4 - 3
UnitTests/Views/ToplevelTests.cs

@@ -258,7 +258,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
         top.Remove (top.StatusBar);
         top.Remove (top.StatusBar);
         Assert.Null (top.StatusBar);
         Assert.Null (top.StatusBar);
         Assert.NotNull (statusBar);
         Assert.NotNull (statusBar);
-#if true
+#if DEBUG_IDISPOSABLE
         Assert.False (menuBar.WasDisposed);
         Assert.False (menuBar.WasDisposed);
         Assert.False (statusBar.WasDisposed);
         Assert.False (statusBar.WasDisposed);
         menuBar.Dispose ();
         menuBar.Dispose ();
@@ -407,7 +407,8 @@ public partial class ToplevelTests (ITestOutputHelper output)
         win.NewMouseEvent (new () { Position = new (6, 0), Flags = MouseFlags.Button1Pressed });
         win.NewMouseEvent (new () { Position = new (6, 0), Flags = MouseFlags.Button1Pressed });
 
 
         //Assert.Null (Toplevel._dragPosition);
         //Assert.Null (Toplevel._dragPosition);
-#if true
+#if DEBUG_IDISPOSABLE
+
         Assert.False (top.MenuBar.WasDisposed);
         Assert.False (top.MenuBar.WasDisposed);
         Assert.False (top.StatusBar.WasDisposed);
         Assert.False (top.StatusBar.WasDisposed);
 #endif
 #endif
@@ -418,7 +419,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
         Assert.Null (top.StatusBar);
         Assert.Null (top.StatusBar);
         Assert.NotNull (menuBar);
         Assert.NotNull (menuBar);
         Assert.NotNull (statusBar);
         Assert.NotNull (statusBar);
-#if true
+#if DEBUG_IDISPOSABLE
         Assert.True (menuBar.WasDisposed);
         Assert.True (menuBar.WasDisposed);
         Assert.True (statusBar.WasDisposed);
         Assert.True (statusBar.WasDisposed);
 #endif
 #endif