Skip to content

Commit 122fac9

Browse files
authored
Optimize CI cache usage (#6707)
* Make whats_left.py compile with same settings as before * Add --no-default-features to scripts/whats_left.py * Build RustPython with no default features * Retrigger CI
1 parent ce1bbc7 commit 122fac9

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,14 @@ jobs:
422422
run: |
423423
target/release/rustpython -m venv testvenv
424424
testvenv/bin/rustpython -m pip install wheel
425-
- name: Check whats_left is not broken
426-
run: python -I scripts/whats_left.py
425+
- if: runner.os != 'macOS'
426+
name: Check whats_left is not broken
427+
shell: bash
428+
run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading,jit"
429+
- if: runner.os == 'macOS' # TODO fix jit on macOS
430+
name: Check whats_left is not broken (macOS)
431+
shell: bash
432+
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
427433

428434
lint:
429435
name: Check Rust code with clippy

scripts/whats_left.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def parse_args():
6060
action="store_true",
6161
help="print output as JSON (instead of line by line)",
6262
)
63+
parser.add_argument(
64+
"--no-default-features",
65+
action="store_true",
66+
help="disable default features when building RustPython",
67+
)
6368
parser.add_argument(
6469
"--features",
6570
action="store",
@@ -441,19 +446,23 @@ def remove_one_indent(s):
441446
f.write(output + "\n")
442447

443448

444-
subprocess.run(
445-
["cargo", "build", "--release", f"--features={args.features}"], check=True
446-
)
449+
cargo_build_command = ["cargo", "build", "--release"]
450+
if args.no_default_features:
451+
cargo_build_command.append("--no-default-features")
452+
if args.features:
453+
cargo_build_command.extend(["--features", args.features])
454+
455+
subprocess.run(cargo_build_command, check=True)
456+
457+
cargo_run_command = ["cargo", "run", "--release"]
458+
if args.no_default_features:
459+
cargo_run_command.append("--no-default-features")
460+
if args.features:
461+
cargo_run_command.extend(["--features", args.features])
462+
cargo_run_command.extend(["-q", "--", GENERATED_FILE])
463+
447464
result = subprocess.run(
448-
[
449-
"cargo",
450-
"run",
451-
"--release",
452-
f"--features={args.features}",
453-
"-q",
454-
"--",
455-
GENERATED_FILE,
456-
],
465+
cargo_run_command,
457466
env={**os.environ.copy(), "RUSTPYTHONPATH": "Lib"},
458467
text=True,
459468
capture_output=True,

0 commit comments

Comments
 (0)