Skip to content

Commit a7ffa35

Browse files
authored
generate vendor.tar in release workflow (#83)
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 9bbb6f6 commit a7ffa35

4 files changed

Lines changed: 44 additions & 27 deletions

File tree

.github/workflows/CreateRelease.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Create a Release
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [ release/**, dev ]
6+
branches: [ release/**, main ]
77

88
permissions:
99
contents: write
@@ -15,14 +15,21 @@ jobs:
1515
uses: ./.github/workflows/Benchmarks.yml
1616

1717
publish:
18+
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref
19+
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }}
1820
needs: [ benchmarks ]
1921
runs-on: windows-latest
20-
strategy:
21-
matrix:
22-
config: [debug, release]
2322
env:
2423
PLATFORM: x64
2524
steps:
25+
- name: Set Debug Configuration
26+
if: ${{ github.ref=='refs/heads/main' }}
27+
run: echo "CONFIG=debug" >> $GITHUB_ENV
28+
29+
- name: Set Release Configuration
30+
if: ${{ contains(github.ref, 'refs/heads/release/') }}
31+
run: echo "CONFIG=release" >> $GITHUB_ENV
32+
2633
- uses: actions/checkout@v4
2734
with:
2835
fetch-depth: 0
@@ -31,6 +38,18 @@ jobs:
3138
uses: hyperlight-dev/ci-setup-workflow@v1.5.0
3239
with:
3340
rust-toolchain: "1.85.0"
41+
- name: Verify vendor.tar
42+
run: |
43+
mv ./src/hyperlight_wasm/vendor.tar ./vendor.tar
44+
just make-vendor-tar
45+
if ! git diff --no-index ./vendor.tar ./src/hyperlight_wasm/vendor.tar; then
46+
echo "vendor.tar is not up to date, please run 'just make-vendor-tar' and commit the changes"
47+
exit 1
48+
fi
49+
shell: bash
50+
- name: Package hyperlight-wasm crate
51+
run: cargo package -p hyperlight-wasm
52+
shell: bash
3453
- name: Install minver_rs
3554
run: |
3655
cargo install minver_rs
@@ -44,18 +63,13 @@ jobs:
4463
echo "HYPERLIGHTWASM_VERSION=$(minver)"| Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
4564
echo "HYPERLIGHTWASM_VERSION=$(minver)"
4665
shell: pwsh
47-
- name: Download Wasm Host
48-
uses: actions/download-artifact@v4
49-
with:
50-
name: wasm-runtime-${{ matrix.config }}
51-
path: ${{ env.PLATFORM }}/${{ matrix.config }}
5266
- name: Download Wasm Modules
5367
uses: actions/download-artifact@v4
5468
with:
5569
name: guest-modules
56-
path: ${{ env.PLATFORM }}/${{ matrix.config }}
70+
path: ${{ env.PLATFORM }}/${{ env.CONFIG }}
5771
- name: Build rust wasm modules
58-
run: just build-rust-wasm-examples ${{ matrix.config }}
72+
run: just build-rust-wasm-examples ${{ env.CONFIG }}
5973
shell: bash
6074
- name: Download Benchmarks (Windows)
6175
uses: actions/download-artifact@v4
@@ -89,40 +103,33 @@ jobs:
89103
Write-Host "msiexec exited with code $LASTEXITCCODE"
90104
if ($LASTEXITCODE -ne 0) { cat log.txt; exit 1 }
91105
- name: Create pre-release
92-
if: (!contains(github.ref, 'refs/heads/release/')) && matrix.config == 'debug'
106+
if: ${{ github.ref=='refs/heads/main' }}
93107
run: |
94108
echo "PWD: $PWD"
95109
ls -alR
96110
gh release delete dev-latest -y --cleanup-tag || true
97111
gh release create dev-latest -t "Latest Development Build From Dev Branch" --latest=false -p \
98-
${{ env.PLATFORM }}/${{ matrix.config }}/HelloWorld.wasm \
99-
${{ env.PLATFORM }}/${{ matrix.config }}/RunWasm.wasm \
100-
${{ env.PLATFORM }}/${{ matrix.config }}/HelloWorld.aot \
101-
${{ env.PLATFORM }}/${{ matrix.config }}/wasm_runtime.* \
102-
${{ env.PLATFORM }}/${{ matrix.config }}/rust_wasm_samples.aot \
103-
${{ env.PLATFORM }}/${{ matrix.config }}/rust_wasm_samples.wasm \
104112
benchmarks_Windows_whp.tar.gz \
105113
benchmarks_Linux_hyperv.tar.gz \
106114
benchmarks_Linux_kvm.tar.gz
107115
env:
108116
GH_TOKEN: ${{ github.token }}
109117
shell: bash
110118
- name: Create Release
111-
if: contains(github.ref, 'refs/heads/release/') && matrix.config == 'release'
119+
if: ${{ contains(github.ref, 'refs/heads/release/') }}
112120
run: |
113121
echo "PWD: $PWD"
114122
ls -alR
115123
gh release create v${{ env.HYPERLIGHTWASM_VERSION }} -t "Release v${{ env.HYPERLIGHTWASM_VERSION }}" --generate-notes \
116-
${{ env.PLATFORM }}/${{ matrix.config }}/HelloWorld.wasm \
117-
${{ env.PLATFORM }}/${{ matrix.config }}/RunWasm.wasm \
118-
${{ env.PLATFORM }}/${{ matrix.config }}/HelloWorld.aot \
119-
${{ env.PLATFORM }}/${{ matrix.config }}/RunWasm.aot \
120-
${{ env.PLATFORM }}/${{ matrix.config }}/wasm_runtime.* \
121-
${{ env.PLATFORM }}/${{ matrix.config }}/rust_wasm_samples.aot \
122-
${{ env.PLATFORM }}/${{ matrix.config }}/rust_wasm_samples.wasm \
123124
benchmarks_Windows_whp.tar.gz \
124125
benchmarks_Linux_hyperv.tar.gz \
125126
benchmarks_Linux_kvm.tar.gz
126127
env:
127128
GH_TOKEN: ${{ github.token }}
128129
shell: bash
130+
- name: Publish to crates.io
131+
if: ${{ contains(github.ref, 'refs/heads/release/') }}
132+
run: cargo publish hyperlight-wasm
133+
env:
134+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
135+
shell: bash

.github/workflows/CreateReleaseBranch.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ jobs:
1818
- uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21+
- uses: extractions/setup-just@v3
22+
with:
23+
just-version: "1.40"
2124
- name: Create Release Branch
2225
run: |
2326
git checkout -b release/${GITHUB_REF_NAME}
27+
just make-vendor-tar
28+
sed '/vendor.tar/d' ./src/hyperlight_wasm/.gitignore
29+
git add ./src/hyperlight_wasm/vendor.tar
30+
git add ./src/hyperlight_wasm/.gitignore
31+
git commit -m "Vendor dependencies for release ${GITHUB_REF_NAME}" -s -S
2432
git push --set-upstream origin release/${GITHUB_REF_NAME}
2533
shell: bash

src/hyperlight_wasm/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
vendor.tar
1+
vendor.tar
2+
target
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

0 commit comments

Comments
 (0)