diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 6d78afb..53374aa 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -40,15 +40,23 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Go (for kraft-hyperlight) - run: | - curl -sL https://go.dev/dl/go1.25.1.linux-amd64.tar.gz | sudo tar -C /usr/local -xz - echo "/usr/local/go/bin" >> $GITHUB_PATH + - uses: actions/setup-go@v5 + with: + go-version: '1.25.1' + cache: false - name: Install just uses: extractions/setup-just@v2 + - name: Cache kraft-hyperlight + id: kraft-cache + uses: actions/cache@v4 + with: + path: /usr/local/bin/kraft-hyperlight + key: kraft-hyperlight-linux-${{ hashFiles('.github/workflows/benchmarks.yml') }} + - name: Build kraft-hyperlight + if: steps.kraft-cache.outputs.cache-hit != 'true' run: | git clone --branch hyperlight-platform --depth 1 \ https://github.com/danbugs/kraftkit.git /tmp/kraftkit @@ -116,6 +124,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + - name: Enable KVM permissions run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ @@ -313,14 +325,16 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + - name: Install pyhl shell: pwsh run: | - cargo install --git https://github.com/${{ github.repository }} ` - --branch ${{ github.head_ref || github.ref_name }} ` - hyperlight-unikraft-host ` - --bin pyhl ` - --locked --force + cd host + cargo build --release --bin pyhl + Copy-Item target\release\pyhl.exe $env:USERPROFILE\.cargo\bin\ -Force - name: Download prebuilt image uses: actions/download-artifact@v4 diff --git a/.github/workflows/host-checks.yml b/.github/workflows/host-checks.yml index f2bbcfd..80f9aa8 100644 --- a/.github/workflows/host-checks.yml +++ b/.github/workflows/host-checks.yml @@ -37,6 +37,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + - name: Install Rust components for pinned toolchain # The repo pins 1.89.0 via rust-toolchain.toml at the repo root. # cargo fmt / clippy use the pinned channel, so install their diff --git a/.github/workflows/publish-examples.yml b/.github/workflows/publish-examples.yml index e625b60..ca5091d 100644 --- a/.github/workflows/publish-examples.yml +++ b/.github/workflows/publish-examples.yml @@ -88,11 +88,29 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.25.1' + cache: false + + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + + - name: Cache kraft-hyperlight + id: kraft-cache + uses: actions/cache@v4 + with: + path: /usr/local/bin/kraft-hyperlight + key: kraft-hyperlight-linux-${{ hashFiles('.github/workflows/publish-examples.yml') }} + - name: Install tools run: | - # Install kraft-hyperlight - git clone --branch hyperlight-platform --depth 1 https://github.com/danbugs/kraftkit.git /tmp/kraftkit - cd /tmp/kraftkit && go build -o /usr/local/bin/kraft-hyperlight ./cmd/kraft + # Install kraft-hyperlight (if not cached) + if [ ! -f /usr/local/bin/kraft-hyperlight ]; then + git clone --branch hyperlight-platform --depth 1 https://github.com/danbugs/kraftkit.git /tmp/kraftkit + cd /tmp/kraftkit && go build -o /usr/local/bin/kraft-hyperlight ./cmd/kraft + fi # Install hyperlight-unikraft cd ${{ github.workspace }}/host && cargo build --release sudo cp target/release/hyperlight-unikraft /usr/local/bin/ diff --git a/.github/workflows/test-examples.yml b/.github/workflows/test-examples.yml index 6bfee81..ef921c1 100644 --- a/.github/workflows/test-examples.yml +++ b/.github/workflows/test-examples.yml @@ -68,15 +68,23 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Go (for kraft-hyperlight) - run: | - curl -sL https://go.dev/dl/go1.25.1.linux-amd64.tar.gz | sudo tar -C /usr/local -xz - echo "/usr/local/go/bin" >> $GITHUB_PATH + - uses: actions/setup-go@v5 + with: + go-version: '1.25.1' + cache: false - name: Install just uses: extractions/setup-just@v2 + - name: Cache kraft-hyperlight + id: kraft-cache + uses: actions/cache@v4 + with: + path: /usr/local/bin/kraft-hyperlight + key: kraft-hyperlight-linux-${{ hashFiles('.github/workflows/test-examples.yml') }} + - name: Build kraft-hyperlight + if: steps.kraft-cache.outputs.cache-hit != 'true' run: | git clone --branch hyperlight-platform --depth 1 \ https://github.com/danbugs/kraftkit.git /tmp/kraftkit @@ -224,6 +232,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + - name: Enable KVM permissions (no-op if device absent) run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ @@ -387,15 +399,23 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Go (for kraft-hyperlight) - run: | - curl -sL https://go.dev/dl/go1.25.1.linux-amd64.tar.gz | sudo tar -C /usr/local -xz - echo "/usr/local/go/bin" >> $GITHUB_PATH + - uses: actions/setup-go@v5 + with: + go-version: '1.25.1' + cache: false - name: Install just uses: extractions/setup-just@v2 + - name: Cache kraft-hyperlight + id: kraft-cache + uses: actions/cache@v4 + with: + path: /usr/local/bin/kraft-hyperlight + key: kraft-hyperlight-linux-${{ hashFiles('.github/workflows/test-examples.yml') }} + - name: Build kraft-hyperlight + if: steps.kraft-cache.outputs.cache-hit != 'true' run: | git clone --branch hyperlight-platform --depth 1 \ https://github.com/danbugs/kraftkit.git /tmp/kraftkit @@ -532,17 +552,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install hyperlight-unikraft host binaries + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + + - name: Build host binaries shell: pwsh run: | - cargo install --git https://github.com/${{ github.repository }} ` - --branch ${{ github.head_ref || github.ref_name }} ` - hyperlight-unikraft-host ` - --bin hyperlight-unikraft ` - --bin multifn-test ` - --bin pydriver-run ` - --bin pyhl ` - --locked --force + cd host + cargo build --release --bin hyperlight-unikraft --bin multifn-test --bin pydriver-run --bin pyhl + Copy-Item target\release\hyperlight-unikraft.exe $env:USERPROFILE\.cargo\bin\ -Force + Copy-Item target\release\multifn-test.exe $env:USERPROFILE\.cargo\bin\ -Force + Copy-Item target\release\pydriver-run.exe $env:USERPROFILE\.cargo\bin\ -Force + Copy-Item target\release\pyhl.exe $env:USERPROFILE\.cargo\bin\ -Force - name: Download prebuilt image uses: actions/download-artifact@v4 @@ -636,6 +658,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: host -> target + # Linux needs /dev/kvm access to run the guest. - name: Enable KVM permissions (Linux only) if: runner.os == 'Linux' @@ -660,11 +686,9 @@ jobs: - name: Install pyhl shell: pwsh run: | - cargo install --git https://github.com/${{ github.repository }} ` - --branch ${{ github.head_ref || github.ref_name }} ` - hyperlight-unikraft-host ` - --bin pyhl ` - --locked --force + cd host + cargo build --release --bin pyhl + Copy-Item target/release/pyhl* $env:USERPROFILE/.cargo/bin/ -Force - name: Download prebuilt python-agent-driver image uses: actions/download-artifact@v4