From 0be7d1bd826fd8668cf38f1a5f15f79fd0a1581b Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 27 Nov 2025 19:56:38 +0100 Subject: [PATCH] ci: replace `cargo rustc` -> `cargo build` to support virtual manifests `cargo rustc` is incompatible with virtual manifests, so the CI needs to use cargo build instead. However, passing `RUSTFLAGS="-D warnings"` via the environment would propagate to all dependencies, and some of them currently fail to build under ``-D warnings` due to issues like [0]: ``` error: creating a mutable reference to mutable static --> src/temp.rs:97:5 | 97 | DIRS.pop() | ^^^^^^^^^^ mutable reference to mutable static ``` To resolve this, apply ``-D warnings` only to the `cargo clippy` commands (which apply to our workspace only) and avoid enforcing it for the entire cargo build. [0]: https://github.com/cloud-hypervisor/cloud-hypervisor/actions/runs/19962283528/job/57245376263?pr=7525 Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- .github/workflows/build.yaml | 24 +++++++++---------- .github/workflows/preview-riscv64-build.yaml | 4 ++-- .../workflows/preview-riscv64-modules.yaml | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c7147fc3f..8528d5429 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,40 +35,40 @@ jobs: target: ${{ matrix.target }} - name: Build (default features) - run: cargo rustc --locked --bin cloud-hypervisor -- -D warnings + run: cargo build --locked --bin cloud-hypervisor - name: Build (kvm) - run: cargo rustc --locked --bin cloud-hypervisor --no-default-features --features "kvm" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --no-default-features --features "kvm" - name: Build (default features + tdx) - run: cargo rustc --locked --bin cloud-hypervisor --features "tdx" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "tdx" - name: Build (default features + dbus_api) - run: cargo rustc --locked --bin cloud-hypervisor --features "dbus_api" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "dbus_api" - name: Build (default features + guest_debug) - run: cargo rustc --locked --bin cloud-hypervisor --features "guest_debug" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "guest_debug" - name: Build (default features + pvmemcontrol) - run: cargo rustc --locked --bin cloud-hypervisor --features "pvmemcontrol" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "pvmemcontrol" - name: Build (default features + fw_cfg) - run: cargo rustc --locked --bin cloud-hypervisor --features "fw_cfg" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "fw_cfg" - name: Build (default features + ivshmem) - run: cargo rustc --locked --bin cloud-hypervisor --features "ivshmem" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --features "ivshmem" - name: Build (mshv) - run: cargo rustc --locked --bin cloud-hypervisor --no-default-features --features "mshv" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --no-default-features --features "mshv" - name: Build (sev_snp) - run: cargo rustc --locked --bin cloud-hypervisor --no-default-features --features "sev_snp" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --no-default-features --features "sev_snp" - name: Build (igvm) - run: cargo rustc --locked --bin cloud-hypervisor --no-default-features --features "igvm" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --no-default-features --features "igvm" - name: Build (mshv + kvm) - run: cargo rustc --locked --bin cloud-hypervisor --no-default-features --features "mshv,kvm" -- -D warnings + run: cargo build --locked --bin cloud-hypervisor --no-default-features --features "mshv,kvm" - name: Release Build (default features) run: cargo build --locked --all --release --target=${{ matrix.target }} diff --git a/.github/workflows/preview-riscv64-build.yaml b/.github/workflows/preview-riscv64-build.yaml index baed1741d..e5fbf5ee2 100644 --- a/.github/workflows/preview-riscv64-build.yaml +++ b/.github/workflows/preview-riscv64-build.yaml @@ -21,10 +21,10 @@ jobs: run: /opt/scripts/exec-in-qemu.sh rustup default 1.89.0 - name: Build test (kvm) - run: /opt/scripts/exec-in-qemu.sh cargo rustc --locked --no-default-features --features "kvm" + run: /opt/scripts/exec-in-qemu.sh cargo build --locked --no-default-features --features "kvm" -p cloud-hypervisor - name: Clippy test (kvm) - run: /opt/scripts/exec-in-qemu.sh cargo clippy --locked --no-default-features --features "kvm" + run: /opt/scripts/exec-in-qemu.sh cargo clippy --locked --no-default-features --features "kvm" -p cloud-hypervisor - name: Check no files were modified run: test -z "$(git status --porcelain)" diff --git a/.github/workflows/preview-riscv64-modules.yaml b/.github/workflows/preview-riscv64-modules.yaml index ffb4fd4b6..1ae1c6375 100644 --- a/.github/workflows/preview-riscv64-modules.yaml +++ b/.github/workflows/preview-riscv64-modules.yaml @@ -27,7 +27,7 @@ jobs: run: /opt/scripts/exec-in-qemu.sh rustup default 1.89.0 - name: Build ${{ matrix.module }} Module (kvm) - run: /opt/scripts/exec-in-qemu.sh cargo rustc --locked -p ${{ matrix.module }} --no-default-features --features "kvm" -- -D warnings + run: /opt/scripts/exec-in-qemu.sh cargo build --locked -p ${{ matrix.module }} --no-default-features --features "kvm" - name: Clippy ${{ matrix.module }} Module (kvm) run: /opt/scripts/exec-in-qemu.sh cargo clippy --locked -p ${{ matrix.module }} --no-default-features --features "kvm" -- -D warnings