From d86a1ad87b7abedc3a6a4547f00d9a5790eb3362 Mon Sep 17 00:00:00 2001 From: GiggleLiu Date: Mon, 6 Jul 2026 15:12:55 +0800 Subject: [PATCH 1/2] Add RISC-V CI build --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f95b3a8b..9f98968f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,31 @@ jobs: - name: Run clippy run: cargo clippy --all-targets --features ilp-highs -- -D warnings + # Cross-compile the portable Rust surface to RISC-V Linux. + riscv: + name: RISC-V build + runs-on: ubuntu-latest + env: + FEATURES: "ilp-lp-solvers" + steps: + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + with: + targets: riscv64gc-unknown-linux-gnu + - uses: Swatinem/rust-cache@v2 + - name: Install RISC-V cross tools + run: | + sudo apt-get update + sudo apt-get install -y gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu + - name: Build workspace for RISC-V + env: + CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc + run: cargo build --workspace --no-default-features --features "$FEATURES" --target riscv64gc-unknown-linux-gnu + - name: Verify RISC-V executable + run: | + riscv64-linux-gnu-readelf -h target/riscv64gc-unknown-linux-gnu/debug/pred \ + | grep 'Machine:.*RISC-V' + # Build, test (nextest), doc tests, and paper. test: name: Test From 52c313a0f5e8fd9f50096552c11c6ad67f286a88 Mon Sep 17 00:00:00 2001 From: GiggleLiu Date: Mon, 6 Jul 2026 23:12:44 +0800 Subject: [PATCH 2/2] Run RISC-V binary under QEMU in CI smoke test The riscv job previously only cross-compiled and grepped the ELF header, proving the binary links but not that it runs. Add qemu-user and execute pred under emulation: list the registry, then create and brute-force solve a 5-cycle MIS instance, asserting the correct optimum Max(2). Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f98968f..e703c4fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,9 +51,11 @@ jobs: - name: Run clippy run: cargo clippy --all-targets --features ilp-highs -- -D warnings - # Cross-compile the portable Rust surface to RISC-V Linux. + # Cross-compile the portable Rust surface to RISC-V Linux, then execute the + # CLI under QEMU user-mode emulation to verify runtime behavior (not just + # that the binary links). riscv: - name: RISC-V build + name: RISC-V build & run runs-on: ubuntu-latest env: FEATURES: "ilp-lp-solvers" @@ -63,10 +65,10 @@ jobs: with: targets: riscv64gc-unknown-linux-gnu - uses: Swatinem/rust-cache@v2 - - name: Install RISC-V cross tools + - name: Install RISC-V cross tools and QEMU run: | sudo apt-get update - sudo apt-get install -y gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu + sudo apt-get install -y gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu qemu-user - name: Build workspace for RISC-V env: CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc @@ -75,6 +77,16 @@ jobs: run: | riscv64-linux-gnu-readelf -h target/riscv64gc-unknown-linux-gnu/debug/pred \ | grep 'Machine:.*RISC-V' + - name: Run CLI smoke test under QEMU + env: + PRED: qemu-riscv64 -L /usr/riscv64-linux-gnu target/riscv64gc-unknown-linux-gnu/debug/pred + run: | + # Registry loads and the catalog renders on RISC-V. + $PRED list | head -5 + # End-to-end create + brute-force solve: MIS of a 5-cycle is 2. + $PRED create MaximumIndependentSet --graph 0-1,1-2,2-3,3-4,4-0 -o mis.json + $PRED solve mis.json --solver brute-force | tee solve.out + grep -q '"evaluation": "Max(2)"' solve.out # Build, test (nextest), doc tests, and paper. test: