Repository navigation
145 lines (129 loc) · 5.7 KB
/
Copy pathdep_benchmarks.yml
File metadata and controls
145 lines (129 loc) · 5.7 KB
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# Reusable workflow to run benchmarks on a single hypervisor/cpu_vendor combination.
#
# Artifact upload:
# Benchmark results are uploaded as workflow artifacts named
# benchmarks_<OS>_<hypervisor>_<cpu_vendor>, kept for as long as GitHub
# allows so that a later run can still be compared against them. A set
# mshv_kernel joins the hypervisor, as in benchmarks_Linux_mshv3-6.18_amd.
# Reading them is left to whoever wants a report, so that a comparison
# covers every configuration at once.
name: Run Benchmarks
on:
workflow_call:
inputs:
docs_only:
description: Skip building if docs only
required: false
type: string
default: "false"
hypervisor:
description: Hypervisor for this run (passed from caller matrix)
required: true
type: string
cpu_vendor:
description: CPU vendor for the build, amd or intel (passed from caller matrix)
required: true
type: string
arch:
description: CPU architecture for the build, X64 or arm64 (passed from caller matrix)
required: true
type: string
mshv_kernel:
description: MSHV kernel of the Azure Linux 3 pool, for example 6.18. Empty selects the default mshv3 pool.
required: false
type: string
default: ""
baseline_ref:
description: >-
Commit to measure these results against. When set, its benchmarks run
first on this machine, so the comparison reflects the change rather
than the difference between two runners.
required: false
type: string
default: ""
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
run-benchmarks:
if: ${{ inputs.docs_only == 'false' }}
timeout-minutes: ${{ fromJSON(vars.BENCHMARKS_JOB_TIMEOUT || '60') }}
runs-on: ${{ fromJson(inputs.arch == 'X64'
&& format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}", "JobId=run-benchmarks-{3}-{4}-{5}"]',
inputs.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && format('azlinux3-mshv{0}', inputs.mshv_kernel != '' && format('-{0}', inputs.mshv_kernel) || '') || inputs.hypervisor,
inputs.cpu_vendor,
github.run_id,
github.run_number,
github.run_attempt)
|| '["self-hosted", "Linux", "arm64", "kvm"]') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The baseline pass checks out another commit, which needs its history.
fetch-depth: ${{ inputs.baseline_ref == '' && 1 || 0 }}
- uses: hyperlight-dev/ci-setup-workflow@2f4142ba17cf573af44fc1e1f1ffc743daded5b3 # v1.10.0
with:
rust-toolchain: "1.94"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rust cache
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: "${{ inputs.arch }}-${{ runner.os }}-${{ inputs.hypervisor }}-release"
save-if: "false"
- name: Set up sccache
uses: ./.github/actions/setup-sccache
- name: Download Rust guests
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rust-guests-${{ inputs.arch }}-release
path: src/tests/rust_guests/bin/release/
- name: Download C guests
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: c-guests-${{ inputs.arch }}-release
path: src/tests/c_guests/bin/release/
- name: Download baseline Rust guests
if: inputs.baseline_ref != ''
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rust-guests-${{ inputs.arch }}-release-baseline
path: ${{ runner.temp }}/baseline-guests/rust/
- name: Download baseline C guests
if: inputs.baseline_ref != ''
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: c-guests-${{ inputs.arch }}-release-baseline
path: ${{ runner.temp }}/baseline-guests/c/
# Both commits are measured on this machine, so the comparison reflects
# them rather than the difference between two runners. The branch point
# is read off the merge this run validates, so on anything else there is
# no second parent and the comparison would measure the wrong commit.
- name: Build
run: just build release
- name: Run benchmarks
run: |
if [ -n "${{ inputs.baseline_ref }}" ]; then
git rev-parse --verify --quiet HEAD^2 >/dev/null || {
echo "::error::HEAD is not a merge, so ${{ inputs.baseline_ref }} is not the branch point"
exit 1
}
just bench-against ${{ inputs.baseline_ref }} "$RUNNER_TEMP/baseline-guests"
else
just bench-ci main
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: benchmarks_${{ runner.os }}_${{ inputs.hypervisor }}${{ inputs.mshv_kernel != '' && format('-{0}', inputs.mshv_kernel) || '' }}_${{ inputs.cpu_vendor }}
path: ./target/criterion/
if-no-files-found: error
# The longest GitHub keeps an artifact, so that a run stays readable
# for as long as the history it contributes to.
retention-days: 90