-
Notifications
You must be signed in to change notification settings - Fork 92
229 lines (195 loc) · 8.67 KB
/
CreateRelease.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Create a Release
on:
workflow_dispatch:
push:
branches: [main]
permissions:
contents: write
id-token: write
jobs:
build-rust-ubuntu:
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }}
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
steps:
- uses: actions/checkout@v4
- uses: hyperlight-dev/[email protected]
with:
rust-toolchain: "1.81.0"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Debug
run: cargo build --verbose
- name: Build Release
run: cargo build --verbose --release
build-rust-windows:
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: hyperlight-dev/[email protected]
with:
rust-toolchain: "1.81.0"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Debug
run: cargo build --verbose
- name: Build Release
run: cargo build --verbose --release
build-guest-binaries:
uses: ./.github/workflows/dep_build_guest_binaries.yml
secrets: inherit
fuzzing:
uses: ./.github/workflows/dep_fuzzing.yml
with:
max_total_time: 3600 # 1 hour in seconds
secrets: inherit
benchmarks:
needs: [build-guest-binaries]
uses: ./.github/workflows/Benchmarks.yml
secrets: inherit
permissions:
id-token: write
contents: read
cargo-publish:
needs: [publish]
uses: ./.github/workflows/CargoPublish.yml
with:
dry_run: false
secrets: inherit
permissions:
id-token: write
contents: read
publish:
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }}
runs-on: windows-2022
needs:
[
build-rust-ubuntu,
build-rust-windows,
build-guest-binaries,
benchmarks,
]
steps:
- name: Set Debug Configuration
if: ${{ github.ref=='refs/heads/main' }}
run: echo "CONFIG=debug" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
- name: Set Release Configuration
if: ${{ contains(github.ref, 'refs/heads/release/') }}
run: echo "CONFIG=release" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: hyperlight-dev/[email protected]
with:
rust-toolchain: "1.81.0"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set HYPERLIGHT_VERSION
if: ${{ contains(github.ref, 'refs/heads/release/') }}
id: set_hyperlight_version
run: |
git fetch --tags
$version="${{ github.ref }}"
$version=$version -replace "refs/heads/release/v", ""
echo "HYPERLIGHT_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "HYPERLIGHT_VERSION=$Env:HYPERLIGHT_VERSION"
shell: pwsh
- name: Ensure path exists for debug build
if: ${{ env.CONFIG }} == "debug"
run: mkdir -p target\debug
shell: pwsh
- name: Ensure path exists for release build
if: ${{ env.CONFIG }} == "release"
run: mkdir -p target\release
shell: pwsh
- name: Download Guest Binaries
uses: actions/download-artifact@v4
with:
name: guest-binaries-${{ env.CONFIG }}
path: ./downloaded-guest-binaries-${{ env.CONFIG }}
- name: Copy Guest Binaries
run: |
cp ./downloaded-guest-binaries-${{ env.CONFIG }}/callbackguest ./src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest
cp ./downloaded-guest-binaries-${{ env.CONFIG }}/callbackguest.exe ./src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest.exe
cp ./downloaded-guest-binaries-${{ env.CONFIG }}/simpleguest ./src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest
cp ./downloaded-guest-binaries-${{ env.CONFIG }}/simpleguest.exe ./src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest.exe
cp ./downloaded-guest-binaries-${{ env.CONFIG }}/dummyguest ./src/tests/rust_guests/bin/${{ env.CONFIG }}/dummyguest
- name: Build and archive guest library + header files
run: |
just tar-headers
just tar-static-lib
- name: Download all benchmarks
uses: actions/download-artifact@v4
with:
pattern: benchmarks_*
# note: artifacts retain their upload name, so we don't have to specify the path
- name: Archive benchmarks
run: |
tar -zcvf benchmarks_Windows_hyperv_amd.tar.gz benchmarks_Windows_hyperv_amd
tar -zcvf benchmarks_Linux_hyperv_amd.tar.gz benchmarks_Linux_hyperv_amd
tar -zcvf benchmarks_Linux_kvm_amd.tar.gz benchmarks_Linux_kvm_amd
tar -zcvf benchmarks_Windows_hyperv_intel.tar.gz benchmarks_Windows_hyperv_intel
tar -zcvf benchmarks_Linux_hyperv_intel.tar.gz benchmarks_Linux_hyperv_intel
tar -zcvf benchmarks_Linux_kvm_intel.tar.gz benchmarks_Linux_kvm_intel
- name: Install github-cli
run: |
$ProgressPreference = 'SilentlyContinue'
# check if gh cli is installed
$installed = [bool](Get-Command -ErrorAction Ignore -Type Application gh)
if ($installed) { Write-Host "gh cli already installed"; exit 0 }
# download and install gh cli
Invoke-WebRequest https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_windows_amd64.msi -OutFile gh.msi
msiexec.exe /i gh.msi /quiet /l log.txt | Out-Null
Write-Host "msiexec exited with code $LASTEXITCCODE"
if ($LASTEXITCODE -ne 0) { cat log.txt; exit 1 }
# Publish the native guests so that its possible to use Hyperlight without building it.
- name: Create release
# Only create a release from tag if we are on a release branch
if: ${{ contains(github.ref, 'refs/heads/release/') }}
run: |
gh release create v${{ env.HYPERLIGHT_VERSION }} -t "Release v${{ env.HYPERLIGHT_VERSION }}" --generate-notes `
src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest `
src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest.exe `
src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest `
src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest.exe `
src/tests/rust_guests/bin/${{ env.CONFIG }}/dummyguest `
benchmarks_Windows_hyperv_amd.tar.gz `
benchmarks_Linux_hyperv_amd.tar.gz `
benchmarks_Linux_kvm_amd.tar.gz `
benchmarks_Windows_hyperv_intel.tar.gz `
benchmarks_Linux_hyperv_intel.tar.gz `
benchmarks_Linux_kvm_intel.tar.gz `
hyperlight-guest-c-api-linux.tar.gz `
hyperlight-guest-c-api-windows.tar.gz `
include.tar.gz
env:
GH_TOKEN: ${{ github.token }}
- name: Create prerelease
# Only create a prerelease if we are on the main branch
if: ${{ github.ref=='refs/heads/main' }}
run: |
gh release delete dev-latest -y --cleanup-tag || $true
gh release create dev-latest -t "Latest prerelease from main branch" --latest=false -p `
src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest `
src/tests/rust_guests/bin/${{ env.CONFIG }}/callbackguest.exe `
src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest `
src/tests/rust_guests/bin/${{ env.CONFIG }}/simpleguest.exe `
src/tests/rust_guests/bin/${{ env.CONFIG }}/dummyguest `
benchmarks_Windows_hyperv_amd.tar.gz `
benchmarks_Linux_hyperv_amd.tar.gz `
benchmarks_Linux_kvm_amd.tar.gz `
benchmarks_Windows_hyperv_intel.tar.gz `
benchmarks_Linux_hyperv_intel.tar.gz `
benchmarks_Linux_kvm_intel.tar.gz `
hyperlight-guest-c-api-linux.tar.gz `
hyperlight-guest-c-api-windows.tar.gz `
include.tar.gz
env:
GH_TOKEN: ${{ github.token }}