Skip to content
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

CI: Work around missing 'distutils' for Python 3.12+ (GHA round two) #795

Merged

Conversation

DeeDeeG
Copy link
Member

@DeeDeeG DeeDeeG commented Nov 7, 2023

Identify the Bug

The "Editor Tests" workflow is failing in GitHub Actions lately.

Similar problem as #779, but circling back around to address it on the other workflow .yml files as well.

Description of the Change

Adds a step to install the setuptools Python package just before any of our GitHub Actions workflows try to install dependencies.

Context: setuptools provides a copy of the distutils module, which node-gyp tries to import, but which was deprecated in recent Python versions and does not ship out of the box in Python 3.12+. There is a fix for this in node-gyp 10.0, but older copies of Yarn or npm come with older node-gyp, so here we are.

Alternate Designs

This fix won't actually be needed for a little while on the Ubuntu-based workflows, since those are still on Python 3.8, Python 3.10, soon to be Python 3.11... Only Python 3.12+ is affected by the issue. But doing this now means it won't come back again if/when ubuntu-latest ships Python 3.12 or newer, I guess.

So, we could undo the change to documentation.yml, package-tests-linux.yml and validate-wasm-grammar-prs.yml for now and probably not need the change for a little while.

Possible Drawbacks

This adds 6 lines to all the GitHub Actions workflow .yml files, so it might seem too verbose, more noticeable on the really short workflow files. Especially the very simple Linux-only workflows that don't need the fix immediately. Only takes a second to run, though.

Verification Process

CI should pass. Specifically. the "Editor Tests" workflow on macOS should start passing with this (has been failing lately), and the other workflows shouldn't start failing due to this change.

Release Notes

N/A (CI-only change) but: Fix missing 'distutils' with Python 3.12+ in GitHub Actions (round two)

Older versions of node-gyp are incompatible with Python 3.12+,
at least out of the box, since Python 3.12+ no-longer ship with
'distutils' out of the box.

We can work around it by installing 'setuptools' package,
which comes with the required 'distutils'.

Newer versions of node-gyp should come with a fix for this,
but older Yarn or npm will ship with older node-gyp, so here we are.

Note that this isn't really needed on the ubuntu-based CI workflows
for now, since those are on the rather conservatively-updated
Debian/Ubuntu-packaged versions of Python (no newer than Python 3.11,
at present.) But being proactive means this won't sneak up on us later.
@DeeDeeG DeeDeeG changed the title CI: Work around missing 'distutils' for Python 3.12+ CI: Work around missing 'distutils' for Python 3.12+ (round two) Nov 7, 2023
@DeeDeeG DeeDeeG changed the title CI: Work around missing 'distutils' for Python 3.12+ (round two) CI: Work around missing 'distutils' for Python 3.12+ (GHA round two) Nov 7, 2023
Copy link
Member

@confused-Techie confused-Techie left a comment

Choose a reason for hiding this comment

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

Since all tests pass and this solves a current issue in our testing strategy, lets go ahead and get it merged!
Thanks for the awesome work @DeeDeeG

@confused-Techie confused-Techie merged commit 83026fe into master Nov 7, 2023
99 checks passed
@DeeDeeG DeeDeeG deleted the CI-workaround-for-distutils-issue-Python3.12 branch November 16, 2023 03:39
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.

2 participants