Skip to content

Commit ab32c78

Browse files
authored
Restructure CI with matrix approach and multi-feature support (RustPython#7376)
* `--features` flag can take multiple values * Simplify CI job * Remove bad default * Enable jit on macOS
1 parent d9020c5 commit ab32c78

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ jobs:
293293
runs-on: ${{ matrix.os }}
294294
strategy:
295295
matrix:
296-
os: [macos-latest, ubuntu-latest, windows-2025]
296+
os:
297+
- macos-latest
298+
- ubuntu-latest
299+
- windows-2025
297300
fail-fast: false
298301
steps:
299302
- uses: actions/checkout@v6.0.2
@@ -302,18 +305,14 @@ jobs:
302305
- uses: actions/setup-python@v6.2.0
303306
with:
304307
python-version: ${{ env.PYTHON_VERSION }}
308+
305309
- name: Set up the Mac environment
306310
run: brew install autoconf automake libtool openssl@3
307311
if: runner.os == 'macOS'
312+
308313
- name: build rustpython
309-
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }}
310-
if: runner.os == 'macOS'
311-
- name: build rustpython
312-
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }},jit
313-
if: runner.os != 'macOS'
314-
- uses: actions/setup-python@v6.2.0
315-
with:
316-
python-version: ${{ env.PYTHON_VERSION }}
314+
run: cargo build --release --verbose --features=threading,jit ${{ env.CARGO_ARGS }}
315+
317316
- name: run snippets
318317
run: python -m pip install -r requirements.txt && pytest -v
319318
working-directory: ./extra_tests
@@ -445,14 +444,10 @@ jobs:
445444
run: |
446445
target/release/rustpython -m venv testvenv
447446
testvenv/bin/rustpython -m pip install wheel
448-
- if: runner.os != 'macOS'
449-
name: Check whats_left is not broken
450-
shell: bash
451-
run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading,jit"
452-
- if: runner.os == 'macOS' # TODO fix jit on macOS
453-
name: Check whats_left is not broken (macOS)
447+
448+
- name: Check whats_left is not broken
454449
shell: bash
455-
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
450+
run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit
456451

457452
lint:
458453
name: Lint Rust & Python code

scripts/whats_left.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def parse_args():
6767
)
6868
parser.add_argument(
6969
"--features",
70-
action="store",
71-
help="which features to enable when building RustPython (default: ssl)",
72-
default="ssl",
70+
action="append",
71+
help="which features to enable when building RustPython (default: [])",
72+
default=[],
7373
)
7474

7575
args = parser.parse_args()
@@ -449,16 +449,20 @@ def remove_one_indent(s):
449449
cargo_build_command = ["cargo", "build", "--release"]
450450
if args.no_default_features:
451451
cargo_build_command.append("--no-default-features")
452+
453+
joined_features = ",".join(args.features)
452454
if args.features:
453-
cargo_build_command.extend(["--features", args.features])
455+
cargo_build_command.extend(["--features", joined_features])
454456

455457
subprocess.run(cargo_build_command, check=True)
456458

457459
cargo_run_command = ["cargo", "run", "--release"]
458460
if args.no_default_features:
459461
cargo_run_command.append("--no-default-features")
462+
460463
if args.features:
461-
cargo_run_command.extend(["--features", args.features])
464+
cargo_run_command.extend(["--features", joined_features])
465+
462466
cargo_run_command.extend(["-q", "--", GENERATED_FILE])
463467

464468
result = subprocess.run(

0 commit comments

Comments
 (0)