10000 ci: Introduce ubuntu-24.04 to restore GTK test coverage with recent PyGObject versions by jayaddison · Pull Request #29765 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ci: Introduce ubuntu-24.04 to restore GTK test coverage with recent PyGObject versions #29765

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

Conversation

jayaddison
Copy link
Contributor

PR summary

  • Why is this change necessary?

GitHub Actions continuous integration unit test coverage is reduced on Linux due to an unsatisfied system dependency requested by recent versions of the Python PyGObject library.

In particular, PyGObject version 3.52.0 introduces a requirement for girepository-2.0: https://gitlab.gnome.org/GNOME/pygobject/-/blob/e3dee9719e7249acfa7e78a3bbae251301a134a4/NEWS#L9-10

The relevant system package to fulfil the requirement is not available on Ubuntu 22.04, and seems unlikely to become available on that platform. This causes some Linux GTK UI tests in the CI here to be skipped.

  • What problem does it solve?

Test coverage can be improved by including an Ubuntu 24.04 test job using a host that provides the girepository-2.0 dependency.

  • What is the reasoning for this implementation?

This is intended to be a minimal approach, adding a single job to the existing tests.yml workflow definitions.

A compatible possibility would be to place an upper-bound on the version of PyGObject installed during jobs on previous versions of Ubuntu.

PR checklist

Resolves #29749

@jayaddison
Copy link
Contributor Author

The geninfo error that appears in the ubuntu-24.04 build logs from commit 2dd9560:

geninfo: ERROR: "/opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/pybind11/include/pybind11/pytypes.h":1562: mismatched exception tag for id 1, 1: '1' -> '0'

..seems to relate to this line of code: https://github.com/pybind/pybind11/blob/a2e59f0e7065404b44dfe92a28aca47ba1378dc4/include/pybind11/pytypes.h#L1562

From what I gather from starting to read a separate-but-similar discussion thread in linux-test-project/lcov#209, this means that there's a mismatch between lcov's expectation about exceptions in the code during coverage testing.

@tacaswell
Copy link
Member

It looks like the verion of gcov has gone from 11 -> 13 as well.

Per linux-test-project/lcov#209 (comment) I suspect that we are seeing the lines from the pybind11 headers showing up sometimes in exceptions and sometimes not hence confusing the tools. I suspect we should go the route of flagging these as ignorable?

@tacaswell tacaswell added this to the v3.11.0 milestone Mar 18, 2025
@jayaddison
Copy link
Contributor Author

It looks like the verion of gcov has gone from 11 -> 13 as well.

Per linux-test-project/lcov#209 (comment) I suspect that we are seeing the lines from the pybind11 headers showing up sometimes in exceptions and sometimes not hence confusing the tools. I suspect we should go the route of flagging these as ignorable?

Thanks - possibly, yep. I've been trying to figure out what the cause of that is. As best I can tell, it's a string conversion (CVT) macro in pybind11 that is emitting the error -- and it's within a py::str class declared by that library. I have a guess that it may be a typecast to py::str where the mismatch occurs -- but I haven't experimented with that yet.

I did build pybind11 locally with coverage enabled, ran the pytest suite for it, and those did not result in an lcov mismatch error -- so there may be a coverage gap that we can report upstream to them if we can identify it.

@jayaddison
Copy link
Contributor Author

It looks like the verion of gcov has gone from 11 -> 13 as well.

Per linux-test-project/lcov#209 (comment) I suspect that we are seeing the lines from the pybind11 headers showing up sometimes in exceptions and sometimes not hence confusing the tools. I suspect we should go the route of flagging these as ignorable?

I've opened a discussion thread (a request for assistance, really) about this at: pybind/pybind11#5573

@jayaddison

This comment was marked as resolved.

jayaddison added a commit to jayaddison/matplotlib that referenced this pull request Mar 23, 2025
Using a lcov 1.x backwards-compatible rc config setting

Refs:
  - matplotlib#29765 (comment)
  - linux-test-project/lcov#209 (comment)
@jayaddison jayaddison force-pushed the issue-29749/add-ubuntu2404-runner branch from 3b81246 to 6d15950 Compare March 23, 2025 15:59
Comment on lines 190 to 175
elif [[ "${{ matrix.os }}" = ubuntu-22.04 || "${{ matrix.os }}" = ubuntu-22.04-arm ]]; then
sudo apt-get install -yy --no-install-recommends \
gir1.2-gtk-4.0 \
libgirepository1.0-dev
else # ubuntu-24.04
sudo apt-get install -yy --no-install-recommends \
libgirepository-2.0-dev
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I think we should also add GTK4 to the system packages on Ubuntu 24.04 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. attempting to do that exposes a missing dependency of GLESv2 for GTK4 on Ubuntu 24.04 - maybe want to do that, but I'll defer that initially.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref: https://github.com/matplotlib/matplotlib/actions/runs/14021446821/job/39253940887#step:14:323

Surrounding context:

_ test_interactive_backend[toolbar2-MPLBACKEND=gtk4agg-BACKEND_DEPS=cairo,gi] __
...
E           Failed: Subprocess failed to test intended behavior
E           libEGL warning: DRI3: Screen seems not DRI3 capable
E           libEGL warning: DRI3: Screen seems not DRI3 capable
E           MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INCOMPATIBLE_DRIVER)
E           libEGL warning: egl: failed to create dri2 screen
E  
8000
         
E           (process:16046): Gtk-WARNING **: 17:51:27.373: Unable to acquire the address of the accessibility bus: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files. If you are attempting to run GTK without a11y support, GTK_A11Y should be set to 'none'.
E           Couldn't open libGLESv2.so.2: libGLESv2.so.2: cannot open shared object file: No such file or directory
E           Fatal Python error: Aborted

@jayaddison

This comment was marked as resolved.

@jayaddison

This comment was marked as resolved.

@jayaddison
Copy link
Contributor Author

I think I will go ahead and ignore those warnings/errors, at least in the short term. The main reason for this is that I would like to merge this -- adding additional test coverage -- before removing Ubuntu 20.04 from the test mix to resolve #29766.

Note: my updated understanding from the relevant lcov manual section is that mentioning an error-name (e.g. mismatch) a single time (as opposed to repeated twice or more) in the --ignore-errors list means that corresponding errors are downgraded to warning-level -- so they should still be visible, without failing the build.

@jayaddison
Copy link
Contributor Author

I've a local rebase/squash of these changes prepared, and can push that soon, if preferred. There were a few details in some of the interim commits - particularly the GLESv2 requirement if we want to enable GTK4 - that could be relevant for easier inspection, though.

@jayaddison

This comment was marked as off-topic.

@jayaddison

This comment was marked as off-topic.

@jayaddison
Copy link
Contributor Author

I've a local rebase/squash of these changes prepared, and can push that soon, if preferred. There were a few details in some of the interim commits - particularly the GLESv2 requirement if we want to enable GTK4 - that could be relevant for easier inspection, though.

(clarification: by this I mean that the interim commits are slightly easier to inspect during code review if not replaced by force-pushes; in this case I would prefer to squash the commits before merge)

@jayaddison jayaddison force-pushed the issue-29749/add-ubuntu2404-runner branch from 1bc5c19 to ad69c7e Compare April 1, 2025 01:18
@tacaswell
Copy link
Member

I do not understand the circleci error. It looks like it is trying to run on the branch from @jayaddison 's account rather than on the PR from the mpl org. We should not hold merging on that.

@jayaddison
Copy link
Contributor Author

Thanks @tacaswell - that has confused me slightly too; I don't have a CircleCI account.

@tacaswell tacaswell merged commit 7d5d027 into matplotlib:main Apr 1, 2025
37 of 38 checks passed
@jayaddison jayaddison deleted the issue-29749/add-ubuntu2404-runner branch April 1, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unit tests: Ubuntu 22.04 lacks dependencies required for recent PyGObject versions
3 participants
0