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

ci: Enable testing on M1 macOS #27723

merged 7 commits into from
Apr 1, 2024

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Jan 31, 2024

PR summary

Just added in beta today:
https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/

Need to see which of the optional dependencies are okay with this.

PR checklist

@QuLogic QuLogic added OS: Apple CI: testing CI configuration and testing labels Jan 31, 2024
@QuLogic QuLogic added this to the v3.9.0 milestone Jan 31, 2024
@QuLogic
Copy link
Member Author

QuLogic commented Jan 31, 2024

Minimum Python available there is 3.10 now, so bumped that up. It looks like pycairo and PyGObject don't have wheels. PyQt5 and wxPython4 have wheels, but I haven't tried allowing the others that were blocked on macOS yet.

We do seem to be getting a lot more failures here than we did when trying Cirrus in #24597.

@QuLogic QuLogic mentioned this pull request Jan 31, 2024
6 tasks
@QuLogic
Copy link
Member Author

QuLogic commented Jan 31, 2024

I've de-conditionalized all optional GUI dependencies so I can verify whether they should be skipped or not.

@QuLogic
Copy link
Member Author

QuLogic commented Jan 31, 2024

The results are the following:

System PyGObject3 PyGObject4 PyQt5 PySide2 PyQt6 PySide6 wxPython
Py3.9 Ubuntu 20.04 MinVer ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Py3.9 Ubuntu 20.04 Extras ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Py3.10 Ubuntu 20.04 Extras ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Py3.11 Ubuntu 22.04 Extras ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Py3.12 Ubuntu 22.04 ✔️ ✔️ ✔️ ‼️ ✔️ ✔️
macOS 12 amd64 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
macOS 14 arm64 🎡 ✔️ ✔️ ✔️ ✔️

Most are available everywhere.

The PyGObject 3/4 split doesn't have any effect, as the dependencies are the same either way (the only difference is the native dependency.) Only PyGObject 4 on macOS 14 arm64 is missing wheels, but appears to be available regardless after building them.

PySide2 on Python 3.12 installs a wheel, but crashes. I believe PySide2 is no longer supported so they didn't bother fixing it for Python 3.12, and because it's some kind of universal thing, it still installed. On the other hand the M1 was new enough that there were no wheels for it.

@QuLogic
Copy link
Member Author

QuLogic commented Jan 31, 2024

I rebased #24597 for comparison, and it doesn't seem to fail nearly as many tests. I can't see any tolerance issues at all. For a reason I don't understand, xfail appears to be broken on both.

@QuLogic
Copy link
Member Author

QuLogic commented Jan 31, 2024

Ah, looking at the pytest 8 changelog, xfails are now fully reported with backtraces. This seems far too noisy, and we may have to disable that.

@QuLogic QuLogic force-pushed the macos-m1 branch 6 times, most recently from 030f350 to e722c5f Compare February 1, 2024 01:57
@tacaswell
Copy link
Member

(mpl-dev) tcaswell@seven matplotlib %  python -c 'from matplotlib.backends._macosx import print_screen_info; print_screen_info()'                                                                                                                                                                                      macos-m1
mainScreen: Acer B286HK (3840.000000x2160.000000)+0.000000+0.000000 @8
deepestScreen: Acer B286HK (3840.000000x2160.000000)+0.000000+0.000000 @8
Available screens: 1
    0: Acer B286HK (3840.000000x2160.000000)+0.000000+0.000000 @8
(mpl-dev) tcaswell@seven matplotlib %  python -c 'from matplotlib.backends._macosx import print_screen_info; print_screen_info()'                                                                                                                                                                                      macos-m1
mainScreen: (unknown)
deepestScreen: (unknown)
Available screens: 0
(mpl-dev) tcaswell@seven matplotlib %  python -c 'from matplotlib.backends._macosx import print_screen_info; print_screen_info()'                                                                                                                                                                                      macos-m1
mainScreen: (unknown)
deepestScreen: (unknown)
Available screens: 0

That is the result for me running over ssh with:

  • account logged in and a screen connected (but locked)
  • account logged out and a screen connected
  • account logged out and no screen connected

The account I was logged in via and the account I was ssh'd to were the same. My guess is that being logged in as a different user on the screen would still result in no screens being reported via ssh (but I have not tested that if we care I can).

We should definitely adapt this and use it the same way we use the "do we have a screen" check on linux to auto fallback to Agg.

@QuLogic
Copy link
Member Author

QuLogic commented Feb 8, 2024

OK, I removed the debugging, and pushed the screen check to #27761.

@QuLogic QuLogic force-pushed the macos-m1 branch 2 times, most recently from 6afde26 to 154fba8 Compare March 28, 2024 02:29
@github-actions github-actions bot added the CI: Run cibuildwheel Run wheel building tests on a PR label Mar 28, 2024
@QuLogic QuLogic added CI: Run cibuildwheel Run wheel building tests on a PR and removed CI: Run cibuildwheel Run wheel building tests on a PR labels Mar 28, 2024
@QuLogic
Copy link
Member Author

QuLogic commented Mar 28, 2024

We decided to xfail the test_other_signal_before_sigint test, because sometimes seems fixed, and sometimes doesn't, regardless of the commit above, and @ksunden reproduced once, but not much luck after that.

Also, contrary to our call @ksunden / @tacaswell, I decided to keep the native arm64 build here. In fact, the cross-compiled one is brokenly-named as well, so we need to fix it one way or the other, and might as well do it now.

@QuLogic QuLogic marked this pull request as ready for review March 28, 2024 04:37
@QuLogic
Copy link
Member Author

QuLogic commented Mar 28, 2024

Because this fixes the wheel names, this is important to get in to 3.9 before the rc.

@QuLogic QuLogic added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Mar 28, 2024
@tacaswell
Copy link
Member

I only half understand the comment in the svg backend.

QuLogic added 7 commits March 28, 2024 22:28
We are only interested in whether we emitted the warning, and don't care
if the test segfaults or otherwise crashes. Thus it is better to check
the output from the parent process, instead of `pytest.warns` in the
subprocess and checking the return code.
We aren't testing on macOS 10.12 any more, but macos-latest, which is
now macOS 12. Wheels for Python 3.12 should be available everywhere by
now as well.

Only PySide2 remains conditional, as it is deprecated, but provides
universal wheels that install but don't work on Python 3.12.
These are mostly just single bit changes in antialiasing portions of
diagonal lines.
We currently special-case the SVG converter depending on if it used
fonttype='none', and use one that has our base fonts available. However,
this is not based on the rcParam setting (because we don't have that at
conversion time), but on whether the SVG text contains the font styling
[1]. This check for styling uses the _current_ version, which was
changed way back in matplotlib#19253.

These files were never re-generated though, and used the old version of
the style, meaning the expected images never triggered the special
converter. The result images are written with the current style, and
_do_ trigger the special conveter.

Evidentally, this never was a problem for most developers, because
everyone had DejaVu Sans installed globally, so the expected images
matched. However, on the clean macOS CI, it's not installed globally, so
the expected images get converted with the wrong font, and the test
fails.

[1] https://github.com/matplotlib/matplotlib/blob/de1102668dbc0694e98653bd17641e9d99394e57/lib/matplotlib/testing/compare.py#L303
Now that we are running a (simple) test, we'll have to ensure the
deployment target is correct. This would have been needed for a release
anyway, but can be removed once meson-python 0.16.0 is out.
@QuLogic
Copy link
Member Author

QuLogic commented Mar 29, 2024

I made some edits to those comments.

@ksunden ksunden merged commit 97c1282 into matplotlib:main Apr 1, 2024
@QuLogic QuLogic deleted the macos-m1 branch April 1, 2024 22:12
@rcomer rcomer mentioned this pull request Apr 3, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: svg CI: Run cibuildwheel Run wheel building tests on a PR CI: testing CI configuration and testing OS: Apple Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: mplot3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants