Scope Toolkit source checks to changed Rust

This commit is contained in:
2026-10-21 06:54:48 -06:00
parent 74cee50d35
commit 20d7f49c9d
+23
View File
@@ -18,9 +18,30 @@ jobs:
with:
fetch-depth: 0
- name: Check changed source
id: surface
run: |
base="$(git merge-base HEAD origin/next)"
git diff --check "$base" HEAD
python3 - "$base" <<'PY' >> "$GITHUB_OUTPUT"
import subprocess
import sys
changed = subprocess.check_output(
['git', 'diff', '--name-only', '-z', sys.argv[1], 'HEAD']
).split(b'\0')
rust_prefixes = (
b'crates/alkane-core/', b'crates/alkane-discovery/',
b'crates/alkane-access/', b'crates/alkane-flash/',
b'crates/alkane-artifacts/', b'crates/alkane-cli/',
b'thirdparty/asic-rs/', b'.cargo/',
)
rust = any(
path in (b'Cargo.toml', b'Cargo.lock', b'rust-toolchain.toml')
or path.startswith(rust_prefixes)
for path in changed if path
)
print(f"rust={'true' if rust else 'false'}")
PY
python3 - <<'PY'
from pathlib import Path
for path in Path('ci').glob('*.py'):
@@ -30,6 +51,7 @@ jobs:
bash -n "$script"
done
- name: Check non-GUI Rust format
if: steps.surface.outputs.rust == 'true'
run: |
rustup component add rustfmt
cargo fmt --check \
@@ -40,6 +62,7 @@ jobs:
--package alkane-artifacts \
--package alkane-cli
- name: Check non-GUI Rust crates
if: steps.surface.outputs.rust == 'true'
env:
CARGO_TARGET_DIR: target
run: |