Skip to content

Commit 4c37418

Browse files
simongdaviesdanbugsarschlesmarossetludfjig
committed
The initial Hyperlight Commit 🎉
Co-authored-by: Dan Chiarlone <[email protected]> Co-authored-by: Aaron Schlesinger <[email protected]> Co-authored-by: Mark Rossetti <[email protected]> Co-authored-by: Ludvig Liljenberg <[email protected]> Co-authored-by: Lucy Menon <[email protected]> Co-authored-by: Shyam Rajendran <[email protected]> Co-authored-by: Carolyn Van Slyck <[email protected]> Co-authored-by: Nell Shamrell-Harrington <[email protected]> Co-authored-by: Jorge Prendes <[email protected]> Co-authored-by: David Justice <[email protected]> Co-authored-by: Doru-Florin Blânzeanu <[email protected]> Co-authored-by: Gudge <[email protected]> Co-authored-by: Ralph Squillace <[email protected]> Co-authored-by: Krinkin, Mike <[email protected]> Co-authored-by: Taylor Matyasz <[email protected]> Co-authored-by: elfuzzmatador <[email protected]> Co-authored-by: Kris Nóva <[email protected]>
0 parents  commit 4c37418

File tree

357 files changed

+196176
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+196176
-0
lines changed

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Reference: https://github.com/dotnet/roslyn/blob/main/.editorconfig
2+
# EditorConfig is awesome: https://EditorConfig.org
3+
4+
# top-most EditorConfig file
5+
root = true
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
insert_final_newline = true
10+
charset = utf-8
11+
12+
# JSON files
13+
[*.json]
14+
indent_size = 2
15+
16+
# Powershell files
17+
[*.ps1]
18+
indent_size = 2
19+
20+
# Shell script files
21+
[*.sh]
22+
end_of_line = lf
23+
indent_size = 2

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .github/release.yml
2+
3+
changelog:
4+
exclude:
5+
labels:
6+
- chore
7+
- ignore
8+
categories:
9+
- title: 🛠 Breaking Changes
10+
labels:
11+
- breaking-change
12+
- title: 🎉 New Features
13+
labels:
14+
- enhancement
15+
- feature
16+
- title: 🐛 Bug Fixes
17+
labels:
18+
- bug
19+
- title: 🔒 Security Fixes
20+
labels:
21+
- security
22+
- title: 🚀 Performance Improvements
23+
labels:
24+
- performance
25+
- title: 👒 Dependencies
26+
labels:
27+
- dependencies
28+
- title: 📚 Documentation
29+
labels:
30+
- documentation
31+
- title: 🔬 Testing
32+
labels:
33+
- testing
34+
- title: 📝 Other Changes
35+
labels:
36+
- "*"

.github/workflows/Benchmarks.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Benchmarks
4+
5+
on:
6+
workflow_call: # This is called from CreateRelease.yml
7+
secrets:
8+
ADO_HYPERLIGHT_CARGO_RO_AZURE_CLIENT_ID:
9+
required: true
10+
AZURE_TENANT_ID:
11+
required: true
12+
inputs:
13+
environment:
14+
required: false
15+
type: string
16+
17+
permissions:
18+
id-token: write
19+
contents: read
20+
21+
jobs:
22+
# this job requires the build-guest-binaries job be complete prior to
23+
# its execution. this dependency should be expressed in the dependent
24+
# workflow
25+
benchmark:
26+
environment: ${{ inputs.environment }}
27+
strategy:
28+
fail-fast: true
29+
matrix:
30+
build: [windows-2022-release, linux-kvm-release, linux-hyperv-release]
31+
include:
32+
- build: windows-2022-release
33+
os: [self-hosted, Windows, X64, "1ES.Pool=HL-win-2022-amd"]
34+
hypervisor: none
35+
- build: linux-kvm-release
36+
os: [self-hosted, Linux, X64, "1ES.Pool=HL-Ubuntu-22.04-KVM"]
37+
hypervisor: kvm
38+
- build: linux-hyperv-release
39+
os: [self-hosted, Linux, X64, "1ES.Pool=HL-mshv-dev"]
40+
hypervisor: hyperv
41+
42+
runs-on: ${{ matrix.os }}
43+
steps:
44+
### Setup ###
45+
46+
- uses: actions/checkout@v4
47+
48+
- uses: hyperlight-dev/[email protected]
49+
with:
50+
rust-toolchain: "1.81.0"
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Download Guest Binaries
55+
uses: actions/download-artifact@v3
56+
with:
57+
name: guest-binaries-release
58+
path: ./downloaded-guest-binaries-release
59+
60+
- name: Copy Guest Binaries
61+
run: |
62+
cp ./downloaded-guest-binaries-release/callbackguest ./src/tests/rust_guests/bin/release/callbackguest
63+
cp ./downloaded-guest-binaries-release/callbackguest.exe ./src/tests/rust_guests/bin/release/callbackguest.exe
64+
cp ./downloaded-guest-binaries-release/simpleguest ./src/tests/rust_guests/bin/release/simpleguest
65+
cp ./downloaded-guest-binaries-release/simpleguest.exe ./src/tests/rust_guests/bin/release/simpleguest.exe
66+
cp ./downloaded-guest-binaries-release/dummyguest ./src/tests/rust_guests/bin/release/dummyguest
67+
68+
### Benchmarks ###
69+
- name: Install github-cli (Linux mariner)
70+
if: runner.os == 'Linux' && matrix.hypervisor == 'hyperv'
71+
run: sudo dnf install gh -y
72+
73+
- name: Install github-cli (Linux ubuntu)
74+
if: runner.os == 'Linux' && matrix.hypervisor == 'kvm'
75+
run: sudo apt install gh -y
76+
77+
- name: Fetch tags
78+
run: git fetch --tags origin
79+
80+
- name: Download benchmarks from most recent release
81+
run: just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} # skip tag parameter to compare to latest stable release
82+
continue-on-error: true
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Run Benchmarks
87+
run: just bench-ci dev release
88+
89+
- uses: actions/upload-artifact@v3
90+
with:
91+
name: benchmarks_${{runner.os}}_${{matrix.hypervisor}}
92+
path: ./target/criterion/
93+
if-no-files-found: error

.github/workflows/CargoAudit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Audit cargo dependencies for security vulnerabilities
2+
on:
3+
schedule:
4+
- cron: "0 9 * * 1" # run at 9am every Monday
5+
workflow_dispatch: # allow manual triggering
6+
7+
permissions:
8+
issues: write # Creates issues for any vulnerabilities found
9+
contents: read
10+
checks: write # Needs to create check
11+
12+
jobs:
13+
audit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
# We are not using the common workflow here because it installs a bunch of tools we don't need.
19+
# TODO: Once the runner image is updated to include the necessary tools (without downloading), we can switch to the common workflow.
20+
- uses: dtolnay/rust-toolchain@master
21+
with:
22+
toolchain: "1.81.0"
23+
24+
- uses: rustsec/[email protected]
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/CargoPublish.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Publish crates to intenral cargo registry
4+
5+
on:
6+
workflow_dispatch:
7+
workflow_call:
8+
secrets:
9+
ADO_HYPERLIGHT_CARGO_RW_AZURE_CLIENT_ID:
10+
required: true
11+
AZURE_TENANT_ID:
12+
required: true
13+
14+
permissions:
15+
contents: read
16+
id-token: write
17+
18+
jobs:
19+
publish-hyperlight-packages:
20+
environment: release
21+
runs-on: [self-hosted, Linux, X64, "1ES.Pool=HL-Ubuntu-22.04-KVM"]
22+
23+
# We should only publish from dev if minver contains `-preview`
24+
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/dev' }}
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
fetch-tags: true
31+
32+
- uses: hyperlight-dev/[email protected]
33+
with:
34+
rust-toolchain: "1.81.0"
35+
36+
- name: Set up cargo workspaces version
37+
run: |
38+
cargo install cargo-workspaces
39+
cargo install minver_rs
40+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
41+
git config --global user.Name "${{ github.actor }}"
42+
43+
- name: Set crate versions
44+
run: |
45+
git fetch --tags || true
46+
version=$(MINVER_TAG_PREFIX=v MINVER_AUTO_INCREMENT_LEVEL=Minor MINVER_PRERELEASE_IDENTIFIER=preview minver)
47+
echo "Setting version to $version"
48+
cargo ws version --force=hyperlight_* --no-git-commit --yes custom $version
49+
echo "HYPERLIGHT_VERSION=$version" >> "$GITHUB_ENV"
50+
51+
- name: Determine if we should publish crates
52+
run: |
53+
echo "github.ref=${{ github.ref }}"
54+
echo "HYPERLIGHT_VERSION=$HYPERLIGHT_VERSION"
55+
if [[ ${{ github.ref }} =~ 'refs/heads/release/' || ( ${{ github.ref }} == 'refs/heads/dev' && $HYPERLIGHT_VERSION =~ '-preview' ) ]]
56+
then
57+
echo "Setting SHOULD_PUBLISH in GITHUB_ENV"
58+
echo "SHOULD_PUBLISH=true" >> "$GITHUB_ENV"
59+
fi
60+
# `allow-dirty` is needed in the publish below because we are using the `--no-git-commit`
61+
# option above to cover the case where no changes are made by cargo ws version because the version
62+
# is already correct
63+
- name: Publish hyperlight-flatbuffers
64+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
65+
run: cargo publish --manifest-path ./src/hyperlight_common/Cargo.toml --registry hyperlight_packages --allow-dirty
66+
67+
- name: Publish hyperlight-guest
68+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
69+
run: cargo publish --manifest-path ./src/hyperlight_guest/Cargo.toml --registry hyperlight_packages --allow-dirty
70+
71+
- name: Publish hyperlight-host
72+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
73+
run: cargo publish --manifest-path ./src/hyperlight_host/Cargo.toml --registry hyperlight_packages --allow-dirty
74+
75+
# `--no-verify` is needed because build.rs writes to "include/hyperlight_guest.h", but since we exclude that directory in Cargo.toml, it should be fine.
76+
# Cargo does not want you to modify files outside of OUT_DIR
77+
- name: Publish hyperlight-guest-capi
78+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
79+
run: cd ./src/hyperlight_guest_capi && cargo publish --registry hyperlight_packages --no-verify --allow-dirty # cd is required because of https://github.com/rust-lang/cargo/issues/10302
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
# This job cleans up old pre-releases and pre-releases packages retaining the last 40 versions
4+
5+
name: Clean up old pre-releases and packages and artifacts
6+
on:
7+
schedule:
8+
- cron: "0 8 * * 1" # run at 8am every Monday
9+
workflow_dispatch: # allow manual triggering
10+
11+
jobs:
12+
cleanup:
13+
name: Clean up old pre-releases and packages
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: write # required for reading & deleting github actions artifacts
17+
contents: write # required for reading and deleting releases
18+
19+
steps:
20+
21+
- name: Delete old 'Hyperlight' releases
22+
uses: sgpublic/[email protected]
23+
with:
24+
pre-release-drop: true
25+
pre-release-keep-count: 5
26+
pre-release-drop-tag: true
27+
draft-drop: false
28+
env:
29+
GITHUB_TOKEN: ${{ github.token }}
30+
31+
- uses: actions/checkout@v4
32+
33+
- name: Delete old Github Actions Artifacts
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: ./dev/clean-github-artifacts.sh

0 commit comments

Comments
 (0)