mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Skip cross-target cargo check unless the OS surface changed (#8717)
* Split cron-ci cargo run and skip long jobs on PRs Assisted-by: Grok:4.6 * Run cross-target cargo check only on platform diffs Assisted-by: Grok:4.6 * Trigger cross-target checks on OS FFI and posix files Assisted-by: Grok:4.6 * Watch every OS-specific module for cross-target checks Assisted-by: Grok:4.6 * Restore cron-ci coverage and benchmarks on workflow PRs Assisted-by: Grok:4.6
This commit is contained in:
1 parent
0bc7fe15d0
commit
fc80382af2
2 files changed
+91
-6
No files matched your search
@@ -42,6 +42,9 @@ jobs:
|
||||
outputs:
|
||||
# Flag that is raised when any rust code is changed.
|
||||
rust_code: ${{ steps.check_rust_code.outputs.changed }}
|
||||
# Cross-target cargo check is skipped unless the diff can change
|
||||
# platform-specific compilation. Force with the run:cross-check label.
|
||||
cross_target: ${{ steps.check_cross_target.outputs.changed }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
@@ -75,6 +78,90 @@ jobs:
|
||||
env:
|
||||
MERGE_BASE: ${{ steps.merge_base.outputs.sha }}
|
||||
|
||||
- name: Check if cross-target compilation can change
|
||||
id: check_cross_target
|
||||
run: |
|
||||
if [ "${FORCE_CROSS_TARGET}" = "true" ]; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! git diff --quiet "${MERGE_BASE}...HEAD" -- \
|
||||
':Cargo.lock' \
|
||||
':rust-toolchain.toml' \
|
||||
':.cargo/**' \
|
||||
':.github/workflows/ci.yaml' \
|
||||
':crates/host_env/**' \
|
||||
':crates/stdlib/src/openssl/**' \
|
||||
':crates/stdlib/src/ssl/**' \
|
||||
':**/_signal.rs' \
|
||||
':**/_testconsole.rs' \
|
||||
':**/_thread.rs' \
|
||||
':**/_winapi.rs' \
|
||||
':**/_wmi.rs' \
|
||||
':**/cert_store.rs' \
|
||||
':**/crt_fd*.rs' \
|
||||
':**/errno.rs' \
|
||||
':**/faulthandler.rs' \
|
||||
':**/fcntl.rs' \
|
||||
':**/fileutils.rs' \
|
||||
':**/grp.rs' \
|
||||
':**/locale.rs' \
|
||||
':**/mmap.rs' \
|
||||
':**/msvcrt.rs' \
|
||||
':**/multiprocessing.rs' \
|
||||
':**/native_certs.rs' \
|
||||
':**/nt.rs' \
|
||||
':**/openssl.rs' \
|
||||
':**/os.rs' \
|
||||
':**/overlapped.rs' \
|
||||
':**/posix*.rs' \
|
||||
':**/pwd.rs' \
|
||||
':**/resource.rs' \
|
||||
':**/scproxy.rs' \
|
||||
':**/select.rs' \
|
||||
':**/shm.rs' \
|
||||
':**/signal.rs' \
|
||||
':**/socket.rs' \
|
||||
':**/ssl.rs' \
|
||||
':**/syslog.rs' \
|
||||
':**/thread.rs' \
|
||||
':**/time.rs' \
|
||||
':**/termios.rs' \
|
||||
':**/testconsole.rs' \
|
||||
':**/tkinter.rs' \
|
||||
':**/uuid.rs' \
|
||||
':**/winapi.rs' \
|
||||
':**/windows.rs' \
|
||||
':**/winreg.rs' \
|
||||
':**/winsound.rs' \
|
||||
':**/wmi.rs'
|
||||
then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Platform cfg, or FFI crates that only exist on some targets.
|
||||
platform_re='target_os|target_arch|target_family|target_env|target_vendor|target_pointer_width|target_endian|cfg\(windows\)|cfg\(unix\)|cfg\(wasi|not\(windows|not\(unix|\[target\.|\blibc::|\bnix::|windows_sys|winapi::|rustix::|std::os::'
|
||||
|
||||
if ! git diff -G "${platform_re}" --quiet "${MERGE_BASE}...HEAD"; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while IFS= read -r file; do
|
||||
[ -f "${file}" ] || continue
|
||||
if grep -Eq "${platform_re}" "${file}"; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
done < <(git diff --name-only "${MERGE_BASE}...HEAD" -- '*.rs')
|
||||
|
||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
MERGE_BASE: ${{ steps.merge_base.outputs.sha }}
|
||||
FORCE_CROSS_TARGET: ${{ contains(github.event.pull_request.labels.*.name, 'run:cross-check') }}
|
||||
|
||||
rust_tests:
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
||||
env:
|
||||
@@ -217,7 +304,7 @@ jobs:
|
||||
if: |
|
||||
(
|
||||
!contains(github.event.pull_request.labels.*.name, 'skip:ci') &&
|
||||
needs.determine_changes.outputs.rust_code == 'true'
|
||||
needs.determine_changes.outputs.cross_target == 'true'
|
||||
) || github.ref == 'refs/heads/main'
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
run: cargo build --release --verbose
|
||||
|
||||
- name: collect tests data
|
||||
run: cargo run --release extra_tests/jsontests.py
|
||||
run: target/release/rustpython extra_tests/jsontests.py
|
||||
env:
|
||||
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
|
||||
|
||||
@@ -113,12 +113,10 @@ jobs:
|
||||
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
|
||||
- name: build rustpython
|
||||
run: cargo build --release --verbose
|
||||
run: cargo build --release --verbose --features sqlite
|
||||
|
||||
- name: Collect what is left data
|
||||
run: |
|
||||
chmod +x ./scripts/whats_left.py
|
||||
./scripts/whats_left.py --features "ssl,sqlite" > whats_left.temp
|
||||
run: python -I scripts/whats_left.py --rustpython target/release/rustpython > whats_left.temp
|
||||
env:
|
||||
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
|
||||
|
||||
|
||||
Reference in new issue
Block a user