Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ci: Enable testing on M1 macOS #27723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ jobs:
CIBW_SKIP: "*-musllinux_aarch64"
CIBW_TEST_COMMAND: >-
python {package}/ci/check_version_number.py
# Apple Silicon machines are not available for testing, so silence the
# warning from cibuildwheel. Remove the skip when they're available.
CIBW_TEST_SKIP: "*-macosx_arm64"
MACOSX_DEPLOYMENT_TARGET: "10.12"
MPL_DISABLE_FH4: "yes"
strategy:
matrix:
Expand All @@ -131,7 +127,15 @@ jobs:
- os: windows-latest
cibw_archs: "auto64"
- os: macos-11
cibw_archs: "x86_64 arm64"
cibw_archs: "x86_64"
# NOTE: macos_target can be moved back into global environment after
# meson-python 0.16.0 is released.
macos_target: "10.12"
- os: macos-14
cibw_archs: "arm64"
# NOTE: macos_target can be moved back into global environment after
# meson-python 0.16.0 is released.
macos_target: "11.0"

steps:
- name: Set up QEMU
Expand All @@ -153,6 +157,7 @@ jobs:
env:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"

- name: Build wheels for CPython 3.11
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
Expand All @@ -161,6 +166,7 @@ jobs:
env:
CIBW_BUILD: "cp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"

- name: Build wheels for CPython 3.10
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
Expand All @@ -169,6 +175,7 @@ jobs:
env:
CIBW_BUILD: "cp310-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"

- name: Build wheels for CPython 3.9
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
Expand All @@ -177,6 +184,7 @@ jobs:
env:
CIBW_BUILD: "cp39-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"

- name: Build wheels for PyPy
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
Expand All @@ -185,6 +193,7 @@ jobs:
env:
CIBW_BUILD: "pp39-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"
if: matrix.cibw_archs != 'aarch64'

- uses: actions/upload-artifact@v4
Expand Down
54 changes: 25 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ jobs:
pyqt6-ver: '!=6.6.0'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: macos-latest
- os: macos-12 # This runnre is on Intel chips.
python-version: 3.9
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: macos-14 # This runner is on M1 (arm64) chips.
python-version: '3.12'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -157,7 +161,8 @@ jobs:
macOS)
brew install ccache
brew tap homebrew/cask-fonts
brew install font-noto-sans-cjk gobject-introspection gtk4 ninja
brew install font-noto-sans-cjk ghostscript gobject-introspection gtk4 ninja
brew install --cask inkscape
;;
esac

Expand Down Expand Up @@ -228,7 +233,6 @@ jobs:
# (sometimes, the install appears to be successful but shared
# libraries cannot be loaded at runtime, so an actual import is a
# better check).
# PyGObject, pycairo, and cariocffi do not install on macOS 10.12.
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
(
python -c 'import gi; gi.require_version("Gtk", "4.0"); from gi.repository import Gtk' &&
Expand All @@ -238,43 +242,35 @@ jobs:
echo 'PyGObject 3 is available' || echo 'PyGObject 3 is not available'
)

# There are no functioning wheels available for macOS 10.12 (as of
# Sept 2020) for either pyqt5 (there are only wheels for 10.13+) or
# pyside2 (the latest version (5.13.2) with 10.12 wheels has a
# fatal to us bug, it was fixed in 5.14.0 which has 10.13 wheels)
python -mpip install --upgrade pyqt5${{ matrix.pyqt5-ver }} &&
python -c 'import PyQt5.QtCore' &&
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
if [[ "${{ runner.os }}" != 'macOS'
# Even though PySide2 wheels can be installed on Python 3.12, they are broken and since PySide2 is
# deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels
# on M1 macOS, so don't bother there either.
if [[ "${{ matrix.os }}" != 'macos-14'
&& "${{ matrix.python-version }}" != '3.12' ]]; then
python -mpip install --upgrade pyside2${{ matrix.pyside2-ver }} &&
python -c 'import PySide2.QtCore' &&
echo 'PySide2 is available' ||
echo 'PySide2 is not available'
fi
if [[ "${{ runner.os }}" != 'macOS' ]]; then
python -mpip install --upgrade pyqt6${{ matrix.pyqt6-ver }} &&
python -c 'import PyQt6.QtCore' &&
echo 'PyQt6 is available' ||
echo 'PyQt6 is not available'
fi
if [[ "${{ runner.os }}" != 'macOS'
&& "${{ matrix.python-version }}" != '3.12' ]]; then
python -mpip install --upgrade pyside6${{ matrix.pyside6-ver }} &&
python -c 'import PySide6.QtCore' &&
echo 'PySide6 is available' ||
echo 'PySide6 is not available'
fi
python -mpip install --upgrade pyqt6${{ matrix.pyqt6-ver }} &&
python -c 'import PyQt6.QtCore' &&
echo 'PyQt6 is available' ||
echo 'PyQt6 is not available'
python -mpip install --upgrade pyside6${{ matrix.pyside6-ver }} &&
python -c 'import PySide6.QtCore' &&
echo 'PySide6 is available' ||
echo 'PySide6 is not available'

if [[ "${{ matrix.python-version }}" != '3.12' ]]; then
python -mpip install --upgrade \
-f "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }}" \
wxPython &&
python -c 'import wx' &&
echo 'wxPython is available' ||
echo 'wxPython is not available'
fi
python -mpip install --upgrade \
-f "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }}" \
wxPython &&
python -c 'import wx' &&
echo 'wxPython is available' ||
echo 'wxPython is not available'

- name: Install the nightly dependencies
# Only install the nightly dependencies during the scheduled event
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,11 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None):
writer.end('g')

def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
# NOTE: If you change the font styling CSS, then be sure the check for
# svg.fonttype = none in `lib/matplotlib/testing/compare.py::convert` remains in
# sync. Also be sure to re-generate any SVG using this mode, or else such tests
# will fail to use the right converter for the expected images, and they will
# fail strangely.
writer = self.writer

color = rgb2hex(gc.get_rgb())
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ def convert(filename, cache):
convert = converter[path.suffix[1:]]
if path.suffix == ".svg":
contents = path.read_text()
# NOTE: This check should be kept in sync with font styling in
# `lib/matplotlib/backends/backend_svg.py`. If it changes, then be sure to
# re-generate any SVG test files using this mode, or else such tests will
# fail to use the converter for the expected images (but will for the
# results), and the tests will fail strangely.
if 'style="font:' in contents:
# for svg.fonttype = none, we explicitly patch the font search
# path so that fonts shipped by Matplotlib are found.
Expand Down
Loading