mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
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:
1 parent
a7217a087b
commit
d7e41ebff5
3 files changed
+85
-28
No files matched your search
+53
-13
@@ -125,14 +125,34 @@ jobs:
|
||||
- name: Install macOS dependencies
|
||||
uses: ./.github/actions/install-macos-deps
|
||||
|
||||
- name: run rust tests
|
||||
run: cargo test --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }}
|
||||
- name: Build rust tests
|
||||
run: cargo test --no-run --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }}
|
||||
env:
|
||||
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
|
||||
|
||||
- name: run rust tests
|
||||
run: cargo test --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }} --lib --bins --tests
|
||||
env:
|
||||
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
|
||||
|
||||
- name: Run rust doctests
|
||||
run: cargo test --doc --locked --workspace --exclude rustpython-capi ${{ env.WORKSPACE_EXCLUDES }} --features threading ${{ env.CARGO_ARGS }}
|
||||
env:
|
||||
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
|
||||
|
||||
- name: Build c-api tests
|
||||
working-directory: crates/capi
|
||||
run: cargo test --no-run --locked
|
||||
if: runner.os != 'Windows' # Requires pyo3 0.29+ on Windows
|
||||
|
||||
- name: run c-api tests
|
||||
working-directory: crates/capi
|
||||
run: cargo test --locked
|
||||
run: cargo test --locked --lib --bins --tests
|
||||
if: runner.os != 'Windows' # Requires pyo3 0.29+ on Windows
|
||||
|
||||
- name: Run c-api doctests
|
||||
working-directory: crates/capi
|
||||
run: cargo test --doc --locked
|
||||
if: runner.os != 'Windows' # Requires pyo3 0.29+ on Windows
|
||||
|
||||
- name: check compilation without host_env (sandbox mode)
|
||||
@@ -164,14 +184,24 @@ jobs:
|
||||
# run: cargo build --features tkinter
|
||||
# if: runner.os == 'Linux'
|
||||
|
||||
- name: Test example projects
|
||||
- name: Build example projects
|
||||
run: |
|
||||
cargo run --manifest-path example_projects/barebone/Cargo.toml
|
||||
cargo run --manifest-path example_projects/frozen_stdlib/Cargo.toml
|
||||
cargo build --manifest-path example_projects/barebone/Cargo.toml
|
||||
cargo build --manifest-path example_projects/frozen_stdlib/Cargo.toml
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
- name: Run example projects
|
||||
run: |
|
||||
example_projects/barebone/target/debug/example-barebone
|
||||
example_projects/frozen_stdlib/target/debug/example_frozen_stdlib
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
- name: Build rustpython for update_lib tests
|
||||
run: cargo build --locked
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
- name: run update_lib tests
|
||||
run: cargo run --locked -- -m unittest discover -s scripts/update_lib/tests -v
|
||||
run: target/debug/rustpython -m unittest discover -s scripts/update_lib/tests -v
|
||||
env:
|
||||
PYTHONPATH: scripts
|
||||
if: runner.os == 'Linux'
|
||||
@@ -487,7 +517,7 @@ jobs:
|
||||
|
||||
- name: Check whats_left is not broken
|
||||
shell: bash
|
||||
run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit
|
||||
run: python -I scripts/whats_left.py --rustpython target/release/rustpython
|
||||
|
||||
clippy:
|
||||
# Named after the matrix entry rather than left to be named for it: a
|
||||
@@ -681,6 +711,11 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Build tests under miri
|
||||
run: cargo +${{ env.NIGHTLY_CHANNEL }} miri test --no-run --locked -p rustpython-vm -- miri_test
|
||||
env:
|
||||
MIRIFLAGS: "-Zmiri-ignore-leaks -Zmiri-permissive-provenance"
|
||||
|
||||
- name: Run tests under miri
|
||||
run: cargo +${{ env.NIGHTLY_CHANNEL }} miri test --locked -p rustpython-vm -- miri_test
|
||||
env:
|
||||
@@ -769,15 +804,20 @@ jobs:
|
||||
with:
|
||||
wabt-version: "1.0.36"
|
||||
|
||||
- name: check wasm32-unknown without js
|
||||
- name: Build wasm32-unknown without js
|
||||
working-directory: example_projects/wasm32_without_js/rustpython-without-js
|
||||
run: cargo build
|
||||
|
||||
- name: Build wasm-runtime
|
||||
run: cargo build --release --manifest-path example_projects/wasm32_without_js/wasm-runtime/Cargo.toml
|
||||
|
||||
- name: Check wasm32-unknown without js
|
||||
working-directory: example_projects/wasm32_without_js
|
||||
run: |
|
||||
cd example_projects/wasm32_without_js/rustpython-without-js
|
||||
cargo build
|
||||
cd ..
|
||||
if wasm-objdump -xj Import rustpython-without-js/target/wasm32-unknown-unknown/debug/rustpython_without_js.wasm; then
|
||||
echo "ERROR: wasm32-unknown module expects imports from the host environment" >&2
|
||||
fi
|
||||
cargo run --release --manifest-path wasm-runtime/Cargo.toml rustpython-without-js/target/wasm32-unknown-unknown/debug/rustpython_without_js.wasm
|
||||
wasm-runtime/target/release/wasm-runtime rustpython-without-js/target/wasm32-unknown-unknown/debug/rustpython_without_js.wasm
|
||||
|
||||
- name: build notebook demo
|
||||
if: github.ref == 'refs/heads/release'
|
||||
|
||||
@@ -52,4 +52,4 @@ def benchamark_collection(loops, cycles, links):
|
||||
|
||||
assert collected is None or collected >= cycles * (links + 1)
|
||||
|
||||
benchamark_collection(1, CYCLES, LINKS)
|
||||
benchamark_collection(10, CYCLES, LINKS)
|
||||
+31
-14
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user