Skip to content

Commit 06dd5e3

Browse files
authored
Merge branch 'hyperlight-dev:main' into danbugs/memory-layout
2 parents 6e82f64 + c89f72d commit 06dd5e3

File tree

9 files changed

+202
-17
lines changed

9 files changed

+202
-17
lines changed

Diff for: .github/dependabot.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
time: "03:00"
78
labels:
89
- "kind/dependencies"
910
- package-ecosystem: "cargo"
1011
directory: "/"
1112
schedule:
1213
interval: "daily"
14+
time: "03:00"
1315
labels:
1416
- "kind/dependencies"
1517
ignore:

Diff for: .github/workflows/auto-merge-dependabot.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Auto Merge Dependabot PRs
2+
3+
on:
4+
schedule:
5+
# Run daily at 04:00 UTC since dependabot runs at 03:00 UTC
6+
- cron: '0 4 * * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
# This workflow uses a GitHub App token to approve and merge Dependabot PRs
14+
# The token is created using the `actions/create-github-app-token` action
15+
# The token is used so that the updates are made by the GitHub App instead of Github Actions
16+
# and will show up as such in the PR comments and history
17+
# In addition, the token is scoped to only the permissions needed for this workflow
18+
# see https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow for details
19+
20+
jobs:
21+
auto-merge-dependabot:
22+
runs-on: ubuntu-latest
23+
steps:
24+
25+
# Gets the GitHub App token
26+
- uses: actions/create-github-app-token@v2
27+
id: get-app-token
28+
with:
29+
# required
30+
app-id: ${{ secrets.DEPENDABOT_APP_ID }}
31+
private-key: ${{ secrets.DEPENDABOT_APP_KEY }}
32+
permission-pull-requests: write
33+
permission-contents: write
34+
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
with:
38+
token: ${{ steps.get-app-token.outputs.token }}
39+
persist-credentials: false
40+
41+
- name: Setup GitHub CLI
42+
run: |
43+
# GitHub CLI is pre-installed on GitHub-hosted runners
44+
gh --version
45+
46+
- name: Make script executable
47+
run: chmod +x ./dev/auto-approve-dependabot.sh
48+
49+
- name: Run auto approve script
50+
env:
51+
GITHUB_TOKEN: ${{ steps.get-app-token.outputs.token }}
52+
run: ./dev/auto-approve-dependabot.sh ${{ github.repository }}

Diff for: Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ By default, Hyperlight restricts guest access to a minimal API. The only _host f
2727
guest to print messages, which are displayed on the host console or redirected to stdout, as configured. Hosts can
2828
choose to expose additional host functions, expanding the guest’s capabilities as needed.
2929

30-
Below is an example demonstrating the use of the Hyperlight host library in Rust to execute a simple guest application
31-
and an example of a simple guest application using the Hyperlight guest library in also written in Rust.
30+
Below is an example demonstrating the use of the Hyperlight host library in Rust to execute a simple guest application.
31+
It is followed by an example of a simple guest application using the Hyperlight guest library, also written in Rust.
3232

3333
### Host
3434

Diff for: dev/auto-approve-dependabot.sh

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
# This script checks for open PRs from dependabot that have all checks passing and have not been
6+
# modified by another user, and approves+merges them automatically.
7+
# To be run as a GitHub action.
8+
9+
# Check if repository argument is provided
10+
if [ -z "$1" ]; then
11+
echo "Error: Repository name not provided."
12+
echo "Usage: $0 <owner/repo>"
13+
echo "Example: $0 hyperlight-dev/hyperlight"
14+
exit 1
15+
fi
16+
17+
REPO="$1"
18+
echo "Checking for open Dependabot PRs to approve and merge in $REPO..."
19+
20+
# Get all open PRs from dependabot
21+
dependabot_prs=$(gh pr list -R "$REPO" --author "dependabot[bot]" --state open --json number,title,reviews)
22+
23+
# Exit early if no PRs found
24+
if [ -z "$dependabot_prs" ] || [ "$dependabot_prs" = "[]" ]; then
25+
echo "No open Dependabot PRs found in $REPO"
26+
exit 0
27+
fi
28+
29+
# Count how many PRs we found
30+
pr_count=$(echo "$dependabot_prs" | jq 'length')
31+
echo "Found $pr_count open Dependabot PRs in $REPO"
32+
33+
# Process each PR
34+
echo "$dependabot_prs" | jq -c '.[]' | while read -r pr; do
35+
pr_number=$(echo "$pr" | jq -r '.number')
36+
pr_title=$(echo "$pr" | jq -r '.title')
37+
38+
echo "Processing PR #$pr_number: $pr_title"
39+
40+
# Check if PR only modifies allowed files
41+
pr_files=$(gh pr view "$pr_number" -R "$REPO" --json files)
42+
invalid_files=$(echo "$pr_files" | jq -r '.files[].path' | grep -v -E '(Cargo\.toml|Cargo\.lock|\.github/workflows/.+)' || true)
43+
44+
if [ -n "$invalid_files" ]; then
45+
echo " ❌ PR #$pr_number modifies files that are not allowed for auto-merge:"
46+
echo ${invalid_files/#/ - }
47+
echo " ℹ️ Only changes to Cargo.toml, Cargo.lock, or .github/workflows/ files are allowed"
48+
continue
49+
fi
50+
51+
echo " ✅ PR #$pr_number only modifies allowed files (Cargo.toml, Cargo.lock, or .github/workflows/)"
52+
53+
# First, get detailed PR information including all checks
54+
pr_details=$(gh pr view "$pr_number" -R "$REPO" --json statusCheckRollup,state)
55+
56+
# Check if all status checks have passed (regardless of required or not)
57+
all_checks_pass=true
58+
has_pending_checks=false
59+
failed_checks=""
60+
61+
# First identify checks that are still in progress
62+
pending_checks=$(echo "$pr_details" | jq -r '.statusCheckRollup[] | select(.status == "IN_PROGRESS" or .status == "QUEUED" or .status == "PENDING") | .name')
63+
64+
if [ -n "$pending_checks" ]; then
65+
echo " ⏳ PR #$pr_number has pending checks:"
66+
echo "$pending_checks" | sed 's/^/ - /'
67+
echo " ℹ️ We will still approve the PR so it can merge automatically once all checks pass"
68+
has_pending_checks=true
69+
fi
70+
71+
# Check for failed checks - only include checks that have a conclusion and are not still running
72+
# Explicitly exclude checks with status IN_PROGRESS, QUEUED, or PENDING
73+
failed_checks=$(echo "$pr_details" | jq -r '.statusCheckRollup[] |
74+
select(.conclusion != null and
75+
.conclusion != "SUCCESS" and
76+
.conclusion != "NEUTRAL" and
77+
.conclusion != "SKIPPED" and
78+
.status != "IN_PROGRESS" and
79+
.status != "QUEUED" and
80+
.status != "PENDING") | .name')
81+
82+
if [ -n "$failed_checks" ]; then
83+
echo " ❌ PR #$pr_number has failed checks:"
84+
echo "$failed_checks" | sed 's/^/ - /'
85+
all_checks_pass=false
86+
continue
87+
fi
88+
89+
# If we've reached here, either all checks have passed or some are pending
90+
if [ "$has_pending_checks" = false ]; then
91+
echo " ✅ All status checks passed for PR #$pr_number"
92+
fi
93+
94+
# Check if PR has been modified by someone other than dependabot
95+
pr_commits=$(gh pr view "$pr_number" -R "$REPO" --json commits)
96+
non_dependabot_authors=$(echo "$pr_commits" | jq -r '.commits[].authors[].login' | grep -v -e "dependabot\[bot\]" -e "^$" || true)
97+
98+
if [ -n "$non_dependabot_authors" ]; then
99+
echo " ❌ PR #$pr_number has been modified by users other than dependabot: $non_dependabot_authors"
100+
continue
101+
fi
102+
103+
# Check if PR needs approval (i.e., hasn't been approved already)
104+
already_approved=$(echo "$pr" | jq -r '.reviews[] | select(.state == "APPROVED") | .state' | grep -c "APPROVED" || true)
105+
106+
if [ "$already_approved" -eq 0 ]; then
107+
echo " ✅ Approving PR #$pr_number"
108+
gh pr review "$pr_number" -R "$REPO" --approve -b "Automatically approved by dependabot auto-approve workflow"
109+
else
110+
echo " ℹ️ PR #$pr_number is already approved"
111+
fi
112+
113+
if [ "$has_pending_checks" = true ] || [ "$all_checks_pass" = true ]; then
114+
# Check if PR is up-to-date with base branch
115+
merge_status=$(gh pr view "$pr_number" -R "$REPO" --json mergeStateStatus -q '.mergeStateStatus')
116+
117+
if [ "$merge_status" != "CLEAN" ]; then
118+
echo " ⚠️ PR #$pr_number is not up to date (status: $merge_status)"
119+
else
120+
echo " ✅ PR #$pr_number is up to date with base branch"
121+
fi
122+
123+
# Enable auto-merge with squash strategy
124+
echo " ✅ Enabling auto-merge (squash strategy) for PR #$pr_number"
125+
gh pr merge "$pr_number" -R "$REPO" --auto --squash
126+
echo " ✅ Auto-merge enabled for PR #$pr_number"
127+
fi
128+
129+
done
130+
131+
echo "Finished processing Dependabot PRs for $REPO"

Diff for: src/hyperlight_common/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ workspace = true
1616

1717
[dependencies]
1818
flatbuffers = { version = "25.2.10", default-features = false }
19-
anyhow = { version = "1.0.97", default-features = false }
19+
anyhow = { version = "1.0.98", default-features = false }
2020
log = "0.4.27"
2121
tracing = { version = "0.1.41", optional = true }
2222
strum = {version = "0.27", default-features = false, features = ["derive"]}

Diff for: src/hyperlight_guest/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libc = [] # compile musl libc
1818
printf = [] # compile printf
1919

2020
[dependencies]
21-
anyhow = { version = "1.0.97", default-features = false }
21+
anyhow = { version = "1.0.98", default-features = false }
2222
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
2323
buddy_system_allocator = "0.11.0"
2424
hyperlight-common = { workspace = true }

Diff for: src/hyperlight_host/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ windows = { version = "0.61", features = [
6666
] }
6767
windows-sys = { version = "0.59", features = ["Win32"] }
6868
windows-result = "0.3"
69-
rust-embed = { version = "8.6.0", features = ["debug-embed", "include-exclude", "interpolate-folder-path"] }
69+
rust-embed = { version = "8.7.0", features = ["debug-embed", "include-exclude", "interpolate-folder-path"] }
7070
sha256 = "1.6.0"
7171
windows-version = "0.1"
7272

@@ -113,7 +113,7 @@ windows = { version = "0.61", features = [
113113
proc-maps = "0.4.0"
114114

115115
[build-dependencies]
116-
anyhow = { version = "1.0.97" }
116+
anyhow = { version = "1.0.98" }
117117
cfg_aliases = "0.2.1"
118118
built = { version = "0.7.7", features = ["chrono", "git2"] }
119119

Diff for: src/hyperlight_testing/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "hyperlight-testing"
33
edition = "2021"
44

55
[dependencies]
6-
anyhow = "1.0.97"
6+
anyhow = "1.0.98"
77
log = "0.4"
88
once_cell = "1.21"
99
tracing = { version = "0.1.41", features = ["log"] }

0 commit comments

Comments
 (0)