Skip to content

Add CPython to CI - #28113

Open
hoodmane wants to merge 6 commits into
emscripten-core:mainfrom
hoodmane:add-cpython-ci
Open

hoodmane wants to merge 6 commits into
emscripten-core:mainfrom
hoodmane:add-cpython-ci

Conversation

@hoodmane

Copy link
Copy Markdown
Collaborator

Resolves issue #28097.

Comment thread .circleci/config.yml Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new CircleCI job and a supporting Python script (test/cpython_test.py) to build and run the CPython test suite against the local Emscripten checkout. The review feedback focuses on improving the robustness of the script: adding safety checks for config.NODE_JS in node_path(), preventing a trailing path separator when modifying PATH in build_env(), simplifying the test() function by removing redundant exception handling, and catching subprocess.CalledProcessError at the top level in main() to exit cleanly without tracebacks.

Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice!

Sorry about new noise from gemini code review... sometimes is get be useful, but maybe not here.

Comment thread test/cpython_test.py
sys.path.insert(0, __rootpath__)

from tools import config
from tools.utils import path_from_root

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just FYI, I'm trying to move away from using parts of the compiler itself in test code like this.

This looks pretty minimal but the more you can avoid using these the better (since in the long run I'd like to remove this code sharing).

Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py
# we always want to use the local emscripten.
env.pop('EMSDK_CACHE', None)
if config.EM_CONFIG:
env['EM_CONFIG'] = config.EM_CONFIG

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this is already done in config.py:init (on line 274)

Comment thread test/cpython_test.py Resolved
Comment thread test/cpython_test.py Resolved
@hoodmane

Copy link
Copy Markdown
Collaborator Author

Thanks @sbc100 for the quick review!

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm!

I wonder if we could split the CI into two steps:

  1. Build cpython
  2. Run the tests

That way it will be easy to see in the circleci UI how long each phase takes.

Comment thread .circleci/config.yml
# CPython's Platforms/emscripten build scripts need Python >= 3.12, hence
# the different executor.
executor: linux-python
resource_class: large

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does the cpython build automatically use parallel build? How about the test suite?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think compilation is parallelized, so far the test suite is completely serial.

@hoodmane

hoodmane commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

split the CI into two steps

Yeah makes sense will do.

This branch has not been deployed

No deployments
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