diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 258309b519..464d1fde4d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -180,76 +180,13 @@ jobs: 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,17 +241,23 @@ jobs: 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: | - 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 }} 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