Skip to content
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
35 changes: 28 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,37 @@ on:
branches: [main]
workflow_call:

# Cancels old running job if a new one is triggered (e.g. by a push onto the same branch).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
run-tests:
name: Run tests on ${{ matrix.os }}
name: Run tests on ${{ matrix.environment }} ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
os: [ "ubuntu-latest", "windows-latest" ]
environment: [ "HL", "GH" ]
runs-on: ${{ fromJson(
matrix.environment == 'HL' &&
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId=cargo-hyperlight-{2}-{3}-{4}"]',
matrix.os == 'windows-latest' && 'Windows' || 'Linux',
matrix.os == 'windows-latest' && 'win2025' || 'kvm',
github.run_id,
github.run_number,
github.run_attempt)
|| format('["{0}"]', matrix.os) ) }}
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- uses: extractions/setup-just@v4
- name: Enable kvm
if: runner.os == 'Linux'
if: runner.os == 'Linux' && runner.arch == 'X64' && matrix.environment == 'GH'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
Expand All @@ -39,11 +53,18 @@ jobs:
shell: bash
run: just build-guest
- name: Run example
if: runner.arch == 'X64'
shell: bash
run: just run-guest
- name: Test `new` subcommand
- name: Build C guest example
shell: bash
run: just build-c-guest
- name: Run C guest example
shell: bash
run: just run-c-guest
- name: Run other tests
shell: bash
run: just test-new
run: just test

spelling:
name: Spell check with typos
Expand Down Expand Up @@ -76,4 +97,4 @@ jobs:
run: just fmt
- name: Check clippy
shell: bash
run: just clippy
run: just clippy
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
/examples/*/target
/examples/**/target
/examples/c/sysroot
/examples/c/guest/guest
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3"
which = { version = "8", features = ["regex"] }
quote = "1.0"
proc-macro2 = "1.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Then to build the hyperlight guest binary, run
cargo hyperlight build --release
```

Your binary will be built for the `x86_64-hyperlight-none` target by default, and placed in `target/x86_64-hyperlight-none/release/guest`.
Your binary will be built for the `x86_64-hyperlight-none` target (or `aarch64-hyperlight-none` on ARM) by default, and placed in `target/<arch>-hyperlight-none/release/guest`.

There's no need for any extra configuration, the command will take care of everything.

Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ fn main() {
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
println!("cargo:rustc-env=GIT_DATE={}", git_date);

println!(
"cargo:rustc-env=CARGO_HYPERLIGHT_HOST_TRIPLE={}",
std::env::var("TARGET").unwrap()
);

// Re-run build script if git HEAD changes
println!("cargo:rerun-if-changed=.git/HEAD");
}
Loading
Loading