1+ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+ name : Benchmarks
4+
5+ on :
6+ workflow_call : # this is called from CreateRelease.yml
7+
8+ # The reason for default shell bash is because on our self-hosted windows runners,
9+ # the default shell is powershell, which doesn't work correctly together with `just` commands.
10+ # Even if a command inside a just-recipe fails, github reports the step as successful.
11+ # The problem may or may not be related to our custom windows runner not applying the
12+ # powershell steps outlined here
13+ # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
14+ defaults :
15+ run :
16+ shell : bash
17+
18+ jobs :
19+ build-wasm-examples :
20+ uses : ./.github/workflows/dep_build_wasm_examples.yml
21+
22+ benchmark :
23+ needs :
24+ - build-wasm-examples
25+ strategy :
26+ fail-fast : true
27+ matrix :
28+ hypervisor : [hyperv, mshv, mshv3, kvm] # hyperv is windows, mshv and kvm are linux
29+ cpu : [amd, intel]
30+ config : [release] # don't want to benchmark debug-builds
31+
32+ runs-on : ${{ fromJson(format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]', matrix.hypervisor == 'hyperv' && 'Windows' || 'Linux', matrix.hypervisor == 'hyperv' && 'win2022' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor, matrix.cpu)) }}
33+
34+ steps :
35+ - uses : actions/checkout@v4
36+
37+ - uses : hyperlight-dev/ci-setup-workflow@v1.3.0
38+ with :
39+ rust-toolchain : " 1.82.0"
40+
41+ - name : Build Wasm Runtime Binary
42+ working-directory : ./src/hyperlight_wasm
43+ run : just build-wasm-runtime ${{ matrix.config }}
44+
45+ - uses : dtolnay/rust-toolchain@1.82.0
46+ with :
47+ components : clippy, rustfmt
48+
49+ - name : Download Wasm Modules
50+ uses : actions/download-artifact@v4
51+ with :
52+ name : guest-modules
53+ path : ./x64/${{ matrix.config }}
54+
55+ # ## Benchmarks ###
56+
57+ # Install GH cli (needed for just bench-download)
58+ - name : Install github-cli (Linux mariner)
59+ if : runner.os == 'Linux' && matrix.hypervisor == 'mshv' || matrix.hypervisor == 'mshv3'
60+ run : sudo dnf install gh -y
61+
62+ - name : Install github-cli (Linux ubuntu)
63+ if : runner.os == 'Linux' && matrix.hypervisor == 'kvm'
64+ run : sudo apt install gh -y
65+
66+ - name : Fetch tags
67+ run : |
68+ git fetch --tags origin
69+
70+ - name : Download benchmark from most recent release
71+ run : |
72+ just bench-download ${{ runner.os }} ${{ matrix.hypervisor }}
73+ continue-on-error : true
74+ working-directory : ./src/hyperlight_wasm
75+ env :
76+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
77+
78+ - name : Run Benchmarks
79+ run : |
80+ just bench-ci dev release
81+ working-directory : ./src/hyperlight_wasm
82+
83+ - name : Upload Benchmarks
84+ uses : actions/upload-artifact@v4
85+ with :
86+ name : benchmarks_${{runner.os}}_${{matrix.hypervisor}}
87+ path : ./target/criterion/
88+ if-no-files-found : error
0 commit comments