Browse Source

Merge branch 'v2_develop' into gradients

Thomas Nind 1 year ago
parent
commit
2544d07093
2 changed files with 42 additions and 4 deletions
  1. 34 4
      .github/workflows/dotnet-core.yml
  2. 8 0
      UnitTests/Views/DateFieldTests.cs

+ 34 - 4
.github/workflows/dotnet-core.yml

@@ -13,7 +13,14 @@ on:
 jobs:
 jobs:
   build_and_test:
   build_and_test:
 
 
-    runs-on: ubuntu-latest
+    runs-on: ${{ matrix.os }}
+    strategy:
+      # Turn on fail-fast once we have the tests running on all platforms
+      fail-fast: false
+      matrix:
+        os: [ windows-latest ]
+        #os: [ ubuntu-latest, windows-latest, macos-latest ]
+
     timeout-minutes: 10
     timeout-minutes: 10
     steps:
     steps:
     
     
@@ -32,12 +39,35 @@ jobs:
     - name: Build Debug
     - name: Build Debug
       run: dotnet build --configuration Debug --no-restore
       run: dotnet build --configuration Debug --no-restore
 
 
+    - name: Install sed on macOS and update xunit.runner.json
+      if: runner.os == 'macOS'
+      run: |
+          brew install gnu-sed
+          PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
+          sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
+
+    - name: Update xunit.runner.json (Windows/Ubuntu)
+      if: runner.os != 'macOS'
+      run: |
+          sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
+
+      # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
+      # Without it, the test runner crashes on ubuntu (but not Windows or mac)
     - name: Test
     - name: Test
       run: |
       run: |
-        sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
-        dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings  --blame --diag:logs/logs.txt --blame-hang --blame-hang-timeout 60s
-        mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
+        dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings --diag:logs/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always 
+     
+        # mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
 
 
+    - name: Upload Test Logs
+      if: always()
+      uses: actions/upload-artifact@v4
+      with:
+        name: test-logs-for-blame-debugging
+        path: |
+          logs/    
+          UnitTests/TestResults/
+  
     # 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]

+ 8 - 0
UnitTests/Views/DateFieldTests.cs

@@ -1,4 +1,5 @@
 using System.Globalization;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 
 namespace Terminal.Gui.ViewsTests;
 namespace Terminal.Gui.ViewsTests;
 
 
@@ -174,6 +175,12 @@ public class DateFieldTests
     [Fact]
     [Fact]
     public void Using_All_Culture_StandardizeDateFormat ()
     public void Using_All_Culture_StandardizeDateFormat ()
     {
     {
+        // BUGBUG: This is a workaround for the issue with the date separator in macOS. See https://github.com/gui-cs/Terminal.Gui/issues/3592
+        if (RuntimeInformation.IsOSPlatform (OSPlatform.OSX))
+        {
+            return;
+        }
+
         CultureInfo cultureBackup = CultureInfo.CurrentCulture;
         CultureInfo cultureBackup = CultureInfo.CurrentCulture;
 
 
         DateTime date = DateTime.Parse ("1/1/1971");
         DateTime date = DateTime.Parse ("1/1/1971");
@@ -188,6 +195,7 @@ public class DateFieldTests
                 separator = separator.Replace ("\u200f", "");
                 separator = separator.Replace ("\u200f", "");
             }
             }
 
 
+
             string format = culture.DateTimeFormat.ShortDatePattern;
             string format = culture.DateTimeFormat.ShortDatePattern;
             var df = new DateField (date);
             var df = new DateField (date);