Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Cloud-hypervisor on every PR #146

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/clh_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Cloud Hypervisor Build
on: [pull_request, create]

jobs:
build:
if: github.event_name == 'pull_request'
name: Cloud Hypervisor Build using MSHV chnages
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
target:
- x86_64-unknown-linux-gnu
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
path: mshv

- name: Install Rust toolchain (${{ matrix.rust }})
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
components: rustfmt, clippy

- name: Cloning Cloud Hypervisor Repo
uses: actions/checkout@main
with:
repository: cloud-hypervisor/cloud-hypervisor
token: ${{ secrets.MY_MSHV_PAT }}
path: cloud-hypervisor

- name: Copying script to CLH directory
working-directory: ./mshv
run: cp scripts/use-local-mshv.sh ../cloud-hypervisor/

- name: Applying patch(to use local mshv crates) with script
working-directory: ./cloud-hypervisor
run: ./use-local-mshv.sh

- name: Build Cloud-Hypervisor(mshv,kvm)
working-directory: ./cloud-hypervisor
run: cargo build --release --all --no-default-features --features mshv,kvm

- name: Build Cloud-Hypervisor(sev_snp)
working-directory: ./cloud-hypervisor
run: cargo build --release --all --no-default-features --features sev_snp

- name: Clippy(kvm,mshv)
working-directory: ./cloud-hypervisor
run: cargo clippy --locked --all --all-targets --no-default-features --tests --examples --features "mshv,kvm" -- -D warnings -D clippy::undocumented_unsafe_blocks

- name: Clippy(sev_snp)
working-directory: ./cloud-hypervisor
run: cargo clippy --locked --all --all-targets --no-default-features --tests --examples --features "sev_snp" -- -D warnings -D clippy::undocumented_unsafe_blocks
12 changes: 12 additions & 0 deletions scripts/use-local-mshv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/sh

line=$(grep -n '\[dev-dependencies\]' Cargo.toml | tail -n1 | cut -f1 -d:)

sed -i "$line i [patch.\"https://github.com/rust-vmm/mshv\"]\n" ./Cargo.toml
line=$((line+1))
sed -i "$line i mshv-bindings = { path = \"../mshv/mshv-bindings\" }" ./Cargo.toml

line=$((line+1))
sed -i "$line i mshv-ioctls = { path = \"../mshv/mshv-ioctls\" }" ./Cargo.toml