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

Workflow to build vfio crates #150

Merged
merged 4 commits into from
May 1, 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
8 changes: 3 additions & 5 deletions .github/workflows/clh_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request, create]
jobs:
build:
if: github.event_name == 'pull_request'
name: Cloud Hypervisor Build using MSHV chnages
name: Cloud Hypervisor Build using MSHV changes
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -28,18 +28,16 @@ jobs:
- name: Cloning Cloud Hypervisor Repo
uses: actions/checkout@v4
with:
depth: 1
branch: 'main'
repository: cloud-hypervisor/cloud-hypervisor
path: cloud-hypervisor

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

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

- name: Build Cloud-Hypervisor(mshv,kvm)
working-directory: ./cloud-hypervisor
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/vfio_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: VFIO Build
on: [pull_request, create]

jobs:
build:
if: github.event_name == 'pull_request'
name: VFIO Build using MSHV changes
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 vfio Repo
uses: actions/checkout@v4
with:
repository: rust-vmm/vfio
path: vfio
- name: Copying script to vfio directory
working-directory: ./mshv
run: cp scripts/use-local-mshv-for-vfio-build.sh ../vfio/

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

- name: Build vfio(mshv)
working-directory: ./vfio
run: cargo build --release --all --no-default-features --features mshv

- name: Build vfio(nohv)
working-directory: ./vfio
run: cargo build --release --no-default-features

- name: Clippy(mshv)
working-directory: ./vfio
run: cargo clippy --workspace --bins --examples --benches --no-default-features --features mshv --all-targets -- -D warnings

- name: Clippy(nohv)
working-directory: ./vfio
run: cargo clippy --workspace --bins --examples --benches --no-default-features --all-targets -- -D warnings

File renamed without changes.
6 changes: 6 additions & 0 deletions scripts/use-local-mshv-for-vfio-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/sh

sed -i 's/mshv-ioctls = { git = "https:\/\/github.com\/rust-vmm\/mshv", branch = "main", optional = true }*/mshv-ioctls = { path = \"..\/..\/..\/mshv\/mshv-ioctls\", optional = true }/g' ./crates/vfio-ioctls/Cargo.toml
sed -i 's/mshv-bindings = { git = "https:\/\/github.com\/rust-vmm\/mshv", branch = "main", features = \["with-serde", "fam-wrappers"\], optional = true }*/mshv-bindings = { path = "..\/..\/..\/mshv\/mshv-bindings", features = ["with-serde", "fam-wrappers"], optional = true }/g' ./crates/vfio-ioctls/Cargo.toml