Split CI cargo run and test into build then execute (#8705)

* Run gc_collect ten times per benchmark iteration

Assisted-by: Grok:4.6

* Reuse the prebuilt rustpython for CI whats_left

whats_left was invoking cargo build --release without threading,
so the snippets job rebuilt the interpreter after the earlier
release build.

Assisted-by: Grok:4.6

* Split CI cargo run and test into build then execute

Assisted-by: Grok:4.6

* Compile doctests in the CI build step

cargo test --no-run skips doctests, so rustdoc compilation
was still happening in the run step.

Assisted-by: Grok:4.6

* Drop cron-ci.yaml from this PR

A pull_request path filter matches the whole PR, so every
push was starting the periodic benchmark and coverage jobs.

Assisted-by: Grok:4.6

* Run doctests in their own CI step

cargo test --doc --no-run is rejected, so doctests cannot
be compiled without also executing them.

Assisted-by: Grok:4.6

* Do not run benchmark targets in rust tests

--all-targets includes Criterion benches, which cargo test
does not run by default.

Assisted-by: Grok:4.6
This commit is contained in:
Jeong, YunWon authored and GitHub committed 2026-09-14 22:08:40 +09:00
1 parent a7217a087b
commit d7e41ebff5
3 files changed
+85 -28

No files matched your search

+31 -14
View File
@@ -71,6 +71,10 @@ def parse_args():
help="which features to enable when building RustPython (default: [])",
default=[],
)
parser.add_argument(
"--rustpython",
help="use this RustPython executable instead of building one with cargo",
)
args = parser.parse_args()
return args
@@ -446,27 +450,40 @@ with open(GENERATED_FILE, "w", encoding="utf-8") as f:
f.write(output + "\n")
cargo_build_command = ["cargo", "build", "--release"]
if args.no_default_features:
cargo_build_command.append("--no-default-features")
def resolve_rustpython(path):
if os.path.isfile(path):
return path
if os.name == "nt" and not path.lower().endswith(".exe"):
exe = path + ".exe"
if os.path.isfile(exe):
return exe
sys.exit(f"RustPython executable not found: {path}")
joined_features = ",".join(args.features)
if args.features:
cargo_build_command.extend(["--features", joined_features])
subprocess.run(cargo_build_command, check=True)
if args.rustpython:
rustpython_run_command = [resolve_rustpython(args.rustpython), GENERATED_FILE]
else:
cargo_build_command = ["cargo", "build", "--release"]
if args.no_default_features:
cargo_build_command.append("--no-default-features")
cargo_run_command = ["cargo", "run", "--release"]
if args.no_default_features:
cargo_run_command.append("--no-default-features")
joined_features = ",".join(args.features)
if args.features:
cargo_build_command.extend(["--features", joined_features])
if args.features:
cargo_run_command.extend(["--features", joined_features])
subprocess.run(cargo_build_command, check=True)
cargo_run_command.extend(["-q", "--", GENERATED_FILE])
rustpython_run_command = ["cargo", "run", "--release"]
if args.no_default_features:
rustpython_run_command.append("--no-default-features")
if args.features:
rustpython_run_command.extend(["--features", joined_features])
rustpython_run_command.extend(["-q", "--", GENERATED_FILE])
result = subprocess.run(
cargo_run_command,
rustpython_run_command,
env={**os.environ.copy(), "RUSTPYTHONPATH": "Lib"},
text=True,
capture_output=True,