Skip to content

Add CPython to CI - #28113

Merged
hoodmane merged 11 commits into
emscripten-core:mainfrom
hoodmane:add-cpython-ci
Nov 5, 2026
Merged

hoodmane merged 11 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 Resolved
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.

Comment thread .circleci/config.yml Outdated
- build-linux
- test-cpython:
requires:
- build-linux

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 wonder if you need to have this dependency? For quick feedback its best not to depend on this. Reling on build-linux is mostly usefull for bots that would build many different system library configurations.

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.

Okay I'll try dropping this.

Comment thread .circleci/config.yml Resolved
@sbc100

sbc100 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

In the current run Sync + Build took 9m 18s out of what IIRC is ~20 minutes total, so I guess the runtime is about equal between build and test.

@sbc100

sbc100 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

lgtm once all the tests pass and assuming this is not the slowest job we have.

@hoodmane do you have commit permissions here already?

@hoodmane

hoodmane commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

I do, will merge once I confirm those things.

@hoodmane

hoodmane commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Yeah it's not anywhere close to being the slowest job now that it doesn't depend on build-linux. But if it did depend on build-linux I guess it would be the slowest.

job                                                                                 finish  (own)
 test-misc                      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████   62.9m  (27.3m)
 test-core2                     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████████████    62.3m  (26.7m)
 test-browser-chrome-2gb        ░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████      59.7m  (24.1m)
 test-browser-chrome-wasm64-4gb ░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████      59.4m  (23.8m)
 test-core3                     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████      58.9m  (23.3m)
 test-sanity                    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████         56.3m  (20.7m)
 test-browser-firefox           ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████           53.4m  (17.8m)
 test-modularize-instance       ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████             50.3m  (14.6m)
 test-core0                     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████              49.1m  (13.5m)
 test-wasm64-4gb                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████               48.2m  (12.6m)
 test-wasm2js1                  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████                46.5m  (10.9m)
 test-esm-integration           ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████                 45.4m  (9.8m)
 test-stress                    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████                   43.5m  (7.9m)
 test-sockets-chrome            ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████                     40.9m  (5.3m)
 test-posixtest                 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░████                     40.3m  (4.7m)
 test-wasm64-misc               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░███                      39.2m  (3.6m)
 test-mac-arm64                 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██                       38.7m  (3.1m)
 test-browser-chrome-wasm64     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░██                       38.5m  (2.9m)
 test-windows                   ████████████████████████████                         35.7m  (35.7m)
*test-cpython                   ████████████████████████                             30.7m  (30.7m)

░ = waiting on build-linux (35.6m)   █ = job runtime   * = this PR

@hoodmane
hoodmane merged commit 2023f3c into emscripten-core:main Nov 5, 2026
43 checks passed
@hoodmane
hoodmane deleted the add-cpython-ci branch November 5, 2026 02:01
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