ci: Add riscv64 cross-build check

The previous CI (removed in #7760) built natively inside a riscv64 QEMU
VM over SSH on a self-hosted host. That setup was disabled for chronic
infrastructure flakiness (#7758).

Reintroduce coverage deliberately minimal: cross-compile the
cloud-hypervisor binary on a stock ubuntu-latest runner, and nothing
more.

- No integration tests: no riscv64 hardware needed.
- No clippy: cross clippy with -D warnings currently trips on
  riscv64-gated lints that need a separate cleanup commit first.

Cross-compiling needs only a riscv64 linker, not Docker/cross: the
binary does not pull openssl-sys (that arrives via a dev-dependency of
test_infra, unused by -p cloud-hypervisor), so no cross sysroot is
required.

Signed-off-by: Gauthier Jolly <contact@gjolly.fr>
This commit is contained in:
Gauthier Jolly
2026-07-05 16:20:04 +02:00
committed by Rob Bradford
parent 67095b0da1
commit 5b3416adf4

View File

@@ -510,6 +510,35 @@ jobs:
run: cargo build --locked --all --release --target=${{ matrix.target }} run: cargo build --locked --all --release --target=${{ matrix.target }}
- name: Check build did not modify any files - name: Check build did not modify any files
run: test -z "$(git status --porcelain)" run: test -z "$(git status --porcelain)"
build-riscv64:
name: build-riscv64
needs: [preflight]
if: needs.preflight.outputs.full == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
- "1.89.0" # MSRV — keep quoted.
env:
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
steps:
- name: Code checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install riscv64 cross linker
run: sudo apt-get update && sudo apt-get install -y gcc-riscv64-linux-gnu
- name: Install Rust toolchain (${{ matrix.rust }})
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: riscv64gc-unknown-linux-gnu
- name: Build (kvm)
run: cargo build --locked --package cloud-hypervisor --no-default-features --features "kvm" --target riscv64gc-unknown-linux-gnu
- name: Check build did not modify any files
run: test -z "$(git status --porcelain)"
# garm-jammy + gnu: runs on PR and MQ. Other 3 matrix entries are in # garm-jammy + gnu: runs on PR and MQ. Other 3 matrix entries are in
# integration-x86-64-mq (sibling, MQ-only, runs in parallel). # integration-x86-64-mq (sibling, MQ-only, runs in parallel).
integration-x86-64-pr: integration-x86-64-pr:
@@ -803,6 +832,7 @@ jobs:
needs: needs:
- audit - audit
- build - build
- build-riscv64
- dco - dco
- formatting - formatting
- fuzz-build - fuzz-build