-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Run CI tests with max processes #7254
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
Changes from all commits
7f1ca40
ea0d06e
ccb66b1
b641625
4cf7973
04274b4
954b0be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,7 +141,7 @@ | |
|
|
||
| - name: Install dependencies | ||
| uses: ./.github/actions/install-linux-deps | ||
| with: ${{ matrix.dependencies || fromJSON('{}') }} | ||
|
Check failure on line 144 in .github/workflows/ci.yaml
|
||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
|
|
@@ -180,76 +180,13 @@ | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} | ||
| env: | ||
| RUST_BACKTRACE: full | ||
| # PLATFORM_INDEPENDENT_TESTS are tests that do not depend on the underlying OS. | ||
| # They are currently only run on Linux to speed up the CI. | ||
| PLATFORM_INDEPENDENT_TESTS: >- | ||
| test__colorize | ||
| test_array | ||
| test_asyncgen | ||
| test_binop | ||
| test_bisect | ||
| test_bool | ||
| test_bytes | ||
| test_call | ||
| test_cmath | ||
| test_collections | ||
| test_complex | ||
| test_contains | ||
| test_copy | ||
| test_dataclasses | ||
| test_decimal | ||
| test_decorators | ||
| test_defaultdict | ||
| test_deque | ||
| test_dict | ||
| test_dictcomps | ||
| test_dictviews | ||
| test_dis | ||
| test_enumerate | ||
| test_exception_variations | ||
| test_float | ||
| test_fractions | ||
| test_genericalias | ||
| test_genericclass | ||
| test_grammar | ||
| test_range | ||
| test_index | ||
| test_int | ||
| test_int_literal | ||
| test_isinstance | ||
| test_iter | ||
| test_iterlen | ||
| test_itertools | ||
| test_json | ||
| test_keyword | ||
| test_keywordonlyarg | ||
| test_list | ||
| test_long | ||
| test_longexp | ||
| test_operator | ||
| test_ordered_dict | ||
| test_pep646_syntax | ||
| test_pow | ||
| test_raise | ||
| test_richcmp | ||
| test_scope | ||
| test_set | ||
| test_slice | ||
| test_sort | ||
| test_string | ||
| test_string_literals | ||
| test_strtod | ||
| test_structseq | ||
| test_subclassinit | ||
| test_super | ||
| test_syntax | ||
| test_tstring | ||
| test_tuple | ||
| test_unary | ||
| test_unpack | ||
| test_unpack_ex | ||
| test_weakref | ||
| test_yield_from | ||
| # Tests that can be flaky when running with multiple processes `-j 2`. We will use `-j 1` for these. | ||
| FLAKY_MP_TESTS: >- | ||
| test_class | ||
| test_eintr | ||
| test_multiprocessing_fork | ||
| test_multiprocessing_forkserver | ||
| test_multiprocessing_spawn | ||
| name: Run snippets and cpython tests | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
|
|
@@ -304,24 +241,30 @@ | |
| run: python -m pip install -r requirements.txt && pytest -v | ||
| working-directory: ./extra_tests | ||
|
|
||
| - name: run cpython platform-independent tests | ||
| if: runner.os == 'Linux' | ||
| - name: Detect available cores | ||
| id: cores | ||
| shell: bash | ||
| run: | | ||
|
Check warning on line 247 in .github/workflows/ci.yaml
|
||
| target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} | ||
| timeout-minutes: 45 | ||
| cores=$(python -c 'print(__import__("os").process_cpu_count())') | ||
| echo "cores=${cores}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Run CPython tests | ||
| run: | | ||
| target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.FLAKY_MP_TESTS }} ${{ join(matrix.skips, ' ') }} | ||
| timeout-minutes: ${{ matrix.timeout }} | ||
|
Comment on lines
+251
to
+254
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This no longer isolates the By excluding only Also applies to: 258-260 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not the goal. it's fine
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🧠 Learnings used |
||
| env: | ||
| RUSTPYTHON_SKIP_ENV_POLLUTERS: true | ||
|
|
||
| - name: run cpython platform-dependent tests | ||
| - name: Run flaky MP CPython tests | ||
| run: | | ||
| target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ join(matrix.skips, ' ') }} | ||
| target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v ${{ env.FLAKY_MP_TESTS }} | ||
| timeout-minutes: ${{ matrix.timeout }} | ||
| env: | ||
| RUSTPYTHON_SKIP_ENV_POLLUTERS: true | ||
|
|
||
| - name: run cpython tests to check if env polluters have stopped polluting | ||
| shell: bash | ||
| run: | | ||
|
Check warning on line 267 in .github/workflows/ci.yaml
|
||
| for thing in ${{ join(matrix.env_polluting_tests, ' ') }}; do | ||
| for i in $(seq 1 10); do | ||
| set +e | ||
|
|
@@ -554,9 +497,9 @@ | |
| - name: build rustpython | ||
| run: cargo build --release --target wasm32-wasip1 --features freeze-stdlib,stdlib --verbose | ||
| - name: run snippets | ||
| run: wasmer run --dir $(pwd) target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/extra_tests/snippets/stdlib_random.py" | ||
|
Check warning on line 500 in .github/workflows/ci.yaml
|
||
| - name: run cpython unittest | ||
| run: wasmer run --dir $(pwd) target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/Lib/test/test_int.py" | ||
|
Check warning on line 502 in .github/workflows/ci.yaml
|
||
|
|
||
| cargo-shear: | ||
| name: cargo shear | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In Python 3.14, can os.process_cpu_count() return None, and is a fallback required before using it as an integer worker count?💡 Result:
No, os.process_cpu_count does not exist in Python 3.14, and thus cannot return None. The standard function is os.cpu_count, which returns the number of logical CPUs in the system or None if indeterminable. A fallback (e.g., defaulting to 1 or 4) is required when using it as an integer worker count, such as in multiprocessing.Pool(processes=os.cpu_count).
Citations:
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 280
Fix non-existent function call in core detection.
Line 247 calls
os.process_cpu_count(), which does not exist in Python—the correct function isos.cpu_count(), which can also returnNone. This will cause runtime failure. Additionally, Python for CI test orchestration introduces unnecessary complexity; use bash directly with fallbacks.🛠️ Suggested fix
- name: Detect available cores id: cores shell: bash run: | - cores=$(python -c 'print(__import__("os").process_cpu_count())') - echo "cores=${cores}" >> $GITHUB_OUTPUT + cores="${NUMBER_OF_PROCESSORS:-}" + if [ -z "${cores}" ]; then + cores="$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc 2>/dev/null || echo 1)" + fi + echo "cores=${cores}" >> "$GITHUB_OUTPUT"📝 Committable suggestion
🤖 Prompt for AI Agents