Skip to content

Commit cb54ea0

Browse files
authored
Add RISC-V CI build (#1073)
1 parent aa2d1a1 commit cb54ea0

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,43 @@ jobs:
5151
- name: Run clippy
5252
run: cargo clippy --all-targets --features ilp-highs -- -D warnings
5353

54+
# Cross-compile the portable Rust surface to RISC-V Linux, then execute the
55+
# CLI under QEMU user-mode emulation to verify runtime behavior (not just
56+
# that the binary links).
57+
riscv:
58+
name: RISC-V build & run
59+
runs-on: ubuntu-latest
60+
env:
61+
FEATURES: "ilp-lp-solvers"
62+
steps:
63+
- uses: actions/checkout@v5
64+
- uses: dtolnay/rust-toolchain@stable
65+
with:
66+
targets: riscv64gc-unknown-linux-gnu
67+
- uses: Swatinem/rust-cache@v2
68+
- name: Install RISC-V cross tools and QEMU
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu qemu-user
72+
- name: Build workspace for RISC-V
73+
env:
74+
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
75+
run: cargo build --workspace --no-default-features --features "$FEATURES" --target riscv64gc-unknown-linux-gnu
76+
- name: Verify RISC-V executable
77+
run: |
78+
riscv64-linux-gnu-readelf -h target/riscv64gc-unknown-linux-gnu/debug/pred \
79+
| grep 'Machine:.*RISC-V'
80+
- name: Run CLI smoke test under QEMU
81+
env:
82+
PRED: qemu-riscv64 -L /usr/riscv64-linux-gnu target/riscv64gc-unknown-linux-gnu/debug/pred
83+
run: |
84+
# Registry loads and the catalog renders on RISC-V.
85+
$PRED list | head -5
86+
# End-to-end create + brute-force solve: MIS of a 5-cycle is 2.
87+
$PRED create MaximumIndependentSet --graph 0-1,1-2,2-3,3-4,4-0 -o mis.json
88+
$PRED solve mis.json --solver brute-force | tee solve.out
89+
grep -q '"evaluation": "Max(2)"' solve.out
90+
5491
# Build, test (nextest), doc tests, and paper.
5592
test:
5693
name: Test

0 commit comments

Comments
 (0)