Skip to content

Commit fa6ebec

Browse files
authored
fix: download guest artifacts after Rust cache restore (#278)
Download the shared guest bundle after Rust cache restoration in every consumer job. On partial cache hits, rust-cache cleans target/ and deletes the previously downloaded bundle manifest, causing valid guests to fail verification. Keeping downloads after that cleanup preserves strict verification without rebuilding guests in each job. The regression failed in CI before the fix. This addresses the cache failure exposed by #275; it does not change cancellation behavior. --------- Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 03c827d commit fa6ebec

2 files changed

Lines changed: 50 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ jobs:
131131
os: [ubuntu-latest, windows-latest]
132132
steps:
133133
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
134-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
135-
with:
136-
name: guest-bundle
137-
138134
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
139135
with:
140136
components: clippy
@@ -146,6 +142,11 @@ jobs:
146142
target/hyperlight-js-runtime
147143
target/hls
148144
145+
# Rust cache cleanup can remove target/guest-build; download the bundle afterward.
146+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
147+
with:
148+
name: guest-bundle
149+
149150
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
150151

151152
- name: Install Python
@@ -199,10 +200,6 @@ jobs:
199200
os: [ubuntu-latest, windows-latest]
200201
steps:
201202
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
202-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
203-
with:
204-
name: guest-bundle
205-
206203
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
207204
with:
208205
toolchain: nightly, 1.94
@@ -215,6 +212,10 @@ jobs:
215212
target/hyperlight-js-runtime
216213
target/hls
217214
215+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
216+
with:
217+
name: guest-bundle
218+
218219
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
219220
with:
220221
dotnet-version: '8.0.x'
@@ -287,10 +288,6 @@ jobs:
287288
os: [ubuntu-latest, windows-latest]
288289
steps:
289290
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
290-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
291-
with:
292-
name: guest-bundle
293-
294291
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
295292
with:
296293
components: clippy
@@ -302,6 +299,10 @@ jobs:
302299
target/hyperlight-js-runtime
303300
target/hls
304301
302+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
303+
with:
304+
name: guest-bundle
305+
305306
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
306307

307308
- name: Install Python
@@ -375,10 +376,6 @@ jobs:
375376
HYPERLIGHT_GUEST_ARTIFACT: "1"
376377
steps:
377378
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
378-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
379-
with:
380-
name: guest-bundle
381-
382379
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
383380
with:
384381
cache-key: release-${{ hashFiles('src/wasm_sandbox/wit/**/*.wit') }}
@@ -389,6 +386,10 @@ jobs:
389386
target/hyperlight-js-runtime
390387
target/hls
391388
389+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
390+
with:
391+
name: guest-bundle
392+
392393
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
393394

394395
- name: Install Python
@@ -437,10 +438,6 @@ jobs:
437438
HYPERLIGHT_GUEST_ARTIFACT: "1"
438439
steps:
439440
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
440-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
441-
with:
442-
name: guest-bundle
443-
444441
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
445442
with:
446443
cache-key: release-${{ hashFiles('src/wasm_sandbox/wit/**/*.wit') }}
@@ -451,6 +448,10 @@ jobs:
451448
target/hyperlight-js-runtime
452449
target/hls
453450
451+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
452+
with:
453+
name: guest-bundle
454+
454455
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
455456

456457
- name: Install Python
@@ -549,10 +550,6 @@ jobs:
549550
os: [ubuntu-latest, windows-latest]
550551
steps:
551552
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
552-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
553-
with:
554-
name: guest-bundle
555-
556553
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
557554
with:
558555
components: clippy
@@ -564,6 +561,10 @@ jobs:
564561
target/hyperlight-js-runtime
565562
target/hls
566563
564+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
565+
with:
566+
name: guest-bundle
567+
567568
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
568569

569570
- name: Install just
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Keep shared guest artifacts out of Rust cache restore cleanup."""
2+
3+
import re
4+
import unittest
5+
from pathlib import Path
6+
7+
8+
class GuestArtifactWorkflowTests(unittest.TestCase):
9+
def test_guest_download_follows_rust_cache_restore(self):
10+
workflow = Path(__file__).resolve().parents[2] / ".github" / "workflows" / "ci.yml"
11+
jobs = re.split(r"(?m)^ ([\w-]+):\s*$", workflow.read_text(encoding="utf-8").split("jobs:\n", 1)[1])
12+
consumers = 0
13+
for name, job in zip(jobs[1::2], jobs[2::2], strict=True):
14+
if 'HYPERLIGHT_GUEST_ARTIFACT: "1"' not in job:
15+
continue
16+
consumers += 1
17+
with self.subTest(job=name):
18+
restore = job.index("- uses: actions-rust-lang/setup-rust-toolchain@")
19+
download = job.index("- uses: actions/download-artifact@")
20+
self.assertGreater(download, restore, "Rust cache restore can delete the downloaded guest manifest")
21+
self.assertGreater(consumers, 0)
22+
23+
24+
if __name__ == "__main__":
25+
unittest.main()

0 commit comments

Comments
 (0)