From 9e622058be254648ace8700dbf934dd7f844c671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Sat, 17 Oct 2026 21:31:58 -0400 Subject: [PATCH 1/2] Use latest runner images with Mono from Homebrew --- .github/workflows/main.yml | 31 ++++++++----- .vsts-ci.yml | 43 ++++++++++++------- .../IronPython/Lib/iptest/process_util.py | 27 ++++++------ tests/suite/test_clrload.py | 6 +-- 4 files changed, 65 insertions(+), 42 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0fe903e0e..437639a13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,13 +13,13 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-22.04, macos-14] + os: [windows-latest, ubuntu-latest, macos-latest] steps: # Prerequisites - name: Install tools - if: matrix.os == 'ubuntu-22.04' - run: sudo apt-get -yq install mono-vbnc dos2unix + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get -yq install dos2unix - uses: actions/checkout@v6 with: submodules: true @@ -32,11 +32,7 @@ jobs: # CI debug information - name: Version Information - run: | - dotnet --info - try { msbuild -version } catch { } - try { mono --version } catch { } - shell: pwsh + run: dotnet --info # Build & package - name: Build @@ -56,7 +52,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-22.04, macos-14] + os: [windows-latest, ubuntu-latest, macos-latest] framework: ['net462', 'net8.0', 'net10.0'] stdlib: ['3.4', '3.6'] @@ -86,6 +82,16 @@ jobs: with: dotnet-version: '8.0.x' + # Setup Mono (the runner images no longer include it) + - name: Install Mono + if: matrix.os != 'windows-latest' && matrix.framework == 'net462' + run: | + if [ "$RUNNER_OS" = Linux ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + echo "$HOMEBREW_PREFIX/bin" >> "$GITHUB_PATH" + fi + brew install mono + # Build & Test - name: Build run: pwsh make.ps1 @@ -101,8 +107,11 @@ jobs: run: | $ipy = "bin/Release/${{ matrix.framework }}/ipy" if ('${{ matrix.framework }}' -ne 'net462') { dotnet "$ipy.dll" -VV } - elseif ($IsWindows) { & "$ipy.exe" -VV } - else { mono "$ipy.exe" -VV } + elseif ('${{ matrix.os }}' -eq 'windows-latest') { & "$ipy.exe" -VV } + else { + mono --version + mono "$ipy.exe" -VV + } shell: pwsh - name: Test (${{ matrix.framework }}) run: ./make.ps1 -frameworks ${{ matrix.framework }} test-all diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 9a1a753bb..f95e4d841 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -4,10 +4,10 @@ jobs: matrix: linux: osName: 'Linux' - imageName: 'ubuntu-22.04' + imageName: 'ubuntu-latest' mac: osName: 'macOS' - imageName: 'macOS-14' + imageName: 'macOS-latest' windows: osName: 'Windows' imageName: 'windows-latest' @@ -38,14 +38,8 @@ jobs: version: '10.0.x' # Display version info - - task: PowerShell@2 + - script: dotnet --info displayName: Version Information - inputs: - targetType: inline - script: | - dotnet --info - try { msbuild -version } catch { } - try { mono --version } catch { } # Build & Package - powershell: ./make.ps1 @@ -86,19 +80,19 @@ jobs: matrix: linux_net462: osName: Linux - imageName: ubuntu-22.04 + imageName: ubuntu-latest framework: net462 linux_net8_0: osName: Linux - imageName: ubuntu-22.04 + imageName: ubuntu-latest framework: net8.0 macos_net462: osName: macOS - imageName: macOS-14 + imageName: macOS-latest framework: net462 macos_net8_0: osName: macOS - imageName: macOS-14 + imageName: macOS-latest framework: net8.0 windows_net462: osName: Windows @@ -110,11 +104,11 @@ jobs: framework: net8.0 linux_net10_0: osName: Linux - imageName: ubuntu-22.04 + imageName: ubuntu-latest framework: net10.0 macos_net10_0: osName: macOS - imageName: macOS-14 + imageName: macOS-latest framework: net10.0 windows_net10_0: osName: Windows @@ -144,6 +138,16 @@ jobs: version: '8.0.x' condition: eq(variables.framework, 'net8.0') + # Setup Mono (the runner images no longer include it) + - bash: | + if [ "$(osName)" = Linux ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + echo "##vso[task.prependpath]$HOMEBREW_PREFIX/bin" + fi + brew install mono + displayName: Install Mono + condition: and(ne(variables.osName, 'Windows'), eq(variables.framework, 'net462')) + # Build & Test - powershell: ./make.ps1 displayName: Build @@ -153,6 +157,15 @@ jobs: - powershell: ./make.ps1 -frameworks $(framework) readytorun displayName: ReadyToRun condition: and(succeeded(), ne(variables.framework, 'net462')) + - powershell: | + $ipy = "bin/Release/$(framework)/ipy" + if ('$(framework)' -ne 'net462') { dotnet "$ipy.dll" -VV } + elseif ('$(osName)' -eq 'Windows') { & "$ipy.exe" -VV } + else { + mono --version + mono "$ipy.exe" -VV + } + displayName: Version Information ($(framework)) - powershell: ./make.ps1 -frameworks $(framework) test-all displayName: Test ($(framework)) diff --git a/src/core/IronPython/Lib/iptest/process_util.py b/src/core/IronPython/Lib/iptest/process_util.py index c89f40da4..c34e61e9d 100644 --- a/src/core/IronPython/Lib/iptest/process_util.py +++ b/src/core/IronPython/Lib/iptest/process_util.py @@ -45,27 +45,30 @@ def has_ilasm(self): self.__has_ilasm = True return self.__has_ilasm - def run_csc(self, args): + def find_mono_tool(self, name): + import shutil + path = shutil.which(name) + if path: + return path if is_osx: - return self.run_tool("/Library/Frameworks/Mono.framework/Versions/Current/Commands/mcs", args) - elif is_posix: - return self.run_tool("/usr/bin/mcs", args) + return os.path.join("/Library/Frameworks/Mono.framework/Versions/Current/Commands", name) + return os.path.join("/usr/bin", name) + + def run_csc(self, args): + if is_posix: + return self.run_tool(self.find_mono_tool("mcs"), args) else: return self.run_tool(os.path.join(self.get_clr_dir(),"csc.exe"), args) def run_vbc(self, args): - if is_osx: - return self.run_tool("/Library/Frameworks/Mono.framework/Versions/Current/Commands/vbnc", args) - elif is_posix: - return self.run_tool("/usr/bin/vbnc", args) + if is_posix: + return self.run_tool(self.find_mono_tool("vbnc"), args) else: return self.run_tool(os.path.join(self.get_clr_dir(),"vbc.exe"), args) def run_ilasm(self, args): - if is_osx: - return self.run_tool("/Library/Frameworks/Mono.framework/Versions/Current/Commands/ilasm", args) - elif is_posix: - return self.run_tool("/usr/bin/ilasm", args) + if is_posix: + return self.run_tool(self.find_mono_tool("ilasm"), args) else: return self.run_tool(os.path.join(self.get_clr_dir(),"ilasm.exe"), args) diff --git a/tests/suite/test_clrload.py b/tests/suite/test_clrload.py index 5b38f4bfb..cbda92e3c 100644 --- a/tests/suite/test_clrload.py +++ b/tests/suite/test_clrload.py @@ -85,10 +85,8 @@ def test_gac(self): import System def get_gac(): process = System.Diagnostics.Process() - if is_osx: - process.StartInfo.FileName = "/Library/Frameworks/Mono.framework/Versions/Current/Commands/gacutil" - elif is_posix: - process.StartInfo.FileName = "/usr/bin/gacutil" + if is_posix: + process.StartInfo.FileName = self.find_mono_tool("gacutil") else: process.StartInfo.FileName = System.IO.Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), "gacutil.exe") process.StartInfo.Arguments = "/nologo /l" From 4ae6103d58e413731016a6464a4e11f234e8553c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Sat, 17 Oct 2026 22:22:36 -0400 Subject: [PATCH 2/2] Fix failing test --- tests/suite/test_methoddispatch.py | 6 +++++- tests/suite/test_regressions.py | 12 ------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/suite/test_methoddispatch.py b/tests/suite/test_methoddispatch.py index 97142fc2f..ba70d66cf 100644 --- a/tests/suite/test_methoddispatch.py +++ b/tests/suite/test_methoddispatch.py @@ -1437,9 +1437,13 @@ def test_enumerator_conversions(self): self.assertRaises(TypeError, cd.ObjectEnumerator, seq) self.assertRaises(TypeError, cd.NonGenericEnumerator, seq) - def test_property_conversions(self): + def test_property_conversions_cp24802(self): + # cp24802: assigning a float to a Single property narrows like a method call + import System from IronPythonTest import Dispatch d = Dispatch() + d.P01 = System.Single(3.14) + self.assertEqual(d.P01, System.Single(3.14)) d.P01 = 2.0 self.assertEqual(d.P01, 2.0) diff --git a/tests/suite/test_regressions.py b/tests/suite/test_regressions.py index 71393504e..9c6868c35 100644 --- a/tests/suite/test_regressions.py +++ b/tests/suite/test_regressions.py @@ -545,18 +545,6 @@ def f(a=None): self.assertRaisesRegex(TypeError, "f\(\) got multiple values for keyword argument 'a'", lambda: f(a=1, **{"a": 3})) - @unittest.skipIf(is_netcoreapp, 'requires System.Drawing.Common dependency') - @skipUnlessIronPython() - def test_cp24802(self): - import clr - clr.AddReference('System.Drawing') - import System - p = System.Drawing.Pen(System.Drawing.Color.Blue) - p.Width = System.Single(3.14) - self.assertEqual(p.Width, System.Single(3.14)) - p.Width = 4.0 - self.assertEqual(p.Width, 4.0) - def test_cp23822(self): from copy import deepcopy