From ab32c785ea176b933c83c44f268ebc1647b55de3 Mon Sep 17 00:00:00 2001 From: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 7 Mar 2026 12:28:26 +0100 Subject: [PATCH] Restructure CI with matrix approach and multi-feature support (#7376) * `--features` flag can take multiple values * Simplify CI job * Remove bad default * Enable jit on macOS --- .github/workflows/ci.yaml | 27 +++++++++++---------------- scripts/whats_left.py | 14 +++++++++----- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 04e5b958d..b862e59a9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -293,7 +293,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-2025] + os: + - macos-latest + - ubuntu-latest + - windows-2025 fail-fast: false steps: - uses: actions/checkout@v6.0.2 @@ -302,18 +305,14 @@ jobs: - uses: actions/setup-python@v6.2.0 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Set up the Mac environment run: brew install autoconf automake libtool openssl@3 if: runner.os == 'macOS' + - name: build rustpython - run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} - if: runner.os == 'macOS' - - name: build rustpython - run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }},jit - if: runner.os != 'macOS' - - uses: actions/setup-python@v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} + run: cargo build --release --verbose --features=threading,jit ${{ env.CARGO_ARGS }} + - name: run snippets run: python -m pip install -r requirements.txt && pytest -v working-directory: ./extra_tests @@ -445,14 +444,10 @@ jobs: run: | target/release/rustpython -m venv testvenv testvenv/bin/rustpython -m pip install wheel - - if: runner.os != 'macOS' - name: Check whats_left is not broken + + - name: Check whats_left is not broken shell: bash - run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading,jit" - - if: runner.os == 'macOS' # TODO fix jit on macOS - name: Check whats_left is not broken (macOS) - shell: bash - run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading" # no jit on macOS for now + run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit lint: name: Lint Rust & Python code diff --git a/scripts/whats_left.py b/scripts/whats_left.py index 00db9a0ac..9a4d57df6 100755 --- a/scripts/whats_left.py +++ b/scripts/whats_left.py @@ -67,9 +67,9 @@ def parse_args(): ) parser.add_argument( "--features", - action="store", - help="which features to enable when building RustPython (default: ssl)", - default="ssl", + action="append", + help="which features to enable when building RustPython (default: [])", + default=[], ) args = parser.parse_args() @@ -449,16 +449,20 @@ with open(GENERATED_FILE, "w", encoding="utf-8") as f: cargo_build_command = ["cargo", "build", "--release"] if args.no_default_features: cargo_build_command.append("--no-default-features") + +joined_features = ",".join(args.features) if args.features: - cargo_build_command.extend(["--features", args.features]) + cargo_build_command.extend(["--features", joined_features]) subprocess.run(cargo_build_command, check=True) cargo_run_command = ["cargo", "run", "--release"] if args.no_default_features: cargo_run_command.append("--no-default-features") + if args.features: - cargo_run_command.extend(["--features", args.features]) + cargo_run_command.extend(["--features", joined_features]) + cargo_run_command.extend(["-q", "--", GENERATED_FILE]) result = subprocess.run(