Skip to content

Commit 97ed455

Browse files
authored
Fix CI caching and parameterize workflows by arch for future aarch64 (#1597)
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 9d5c2f4 commit 97ed455

13 files changed

Lines changed: 131 additions & 102 deletions

.github/workflows/CreateRelease.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ jobs:
7676
strategy:
7777
fail-fast: true
7878
matrix:
79+
arch: [X64]
7980
hypervisor: ['hyperv-ws2025', mshv3, kvm]
80-
cpu: [amd, intel]
81+
cpu_vendor: [amd, intel]
8182
uses: ./.github/workflows/dep_benchmarks.yml
8283
secrets: inherit
8384
with:
8485
hypervisor: ${{ matrix.hypervisor }}
85-
cpu: ${{ matrix.cpu }}
86+
cpu_vendor: ${{ matrix.cpu_vendor }}
87+
arch: ${{ matrix.arch }}
8688
permissions:
8789
contents: read
8890

.github/workflows/DailyBenchmarks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ jobs:
4545
strategy:
4646
fail-fast: true
4747
matrix:
48+
arch: [X64]
4849
hypervisor: ['hyperv-ws2025', mshv3, kvm]
49-
cpu: [amd, intel]
50+
cpu_vendor: [amd, intel]
5051
uses: ./.github/workflows/dep_benchmarks.yml
5152
secrets: inherit
5253
with:
5354
hypervisor: ${{ matrix.hypervisor }}
54-
cpu: ${{ matrix.cpu }}
55+
cpu_vendor: ${{ matrix.cpu_vendor }}
56+
arch: ${{ matrix.arch }}
5557
baseline_run_id: ${{ needs.find-baseline.outputs.run-id }}
5658
retention_days: 90
5759

.github/workflows/Fuzzing.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ jobs:
1919

2020
fuzzing:
2121
needs: build-guests
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
target: ['fuzz_host_print', 'fuzz_guest_call', 'fuzz_host_call', 'fuzz_guest_estimate_trace_event', 'fuzz_guest_trace']
2226
uses: ./.github/workflows/dep_fuzzing.yml
2327
with:
24-
targets: '["fuzz_host_print", "fuzz_guest_call", "fuzz_host_call", "fuzz_guest_estimate_trace_event", "fuzz_guest_trace"]' # Pass as a JSON array
28+
target: ${{ matrix.target }}
29+
arch: X64
2530
max_total_time: 18000 # 5 hours in seconds
2631
secrets: inherit
2732

.github/workflows/PrimeCaches.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,26 @@ defaults:
2828
shell: bash
2929

3030
jobs:
31-
# Populate v0-rust-guests-{debug,release}-Linux-x64 caches.
31+
# Populate guest caches (key guests-{arch}-{config}) for both architectures.
3232
guests:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36+
arch: [X64, arm64]
3637
config: [debug, release]
3738
uses: ./.github/workflows/dep_build_guests.yml
3839
secrets: inherit
3940
with:
40-
arch: X64
41+
arch: ${{ matrix.arch }}
4142
config: ${{ matrix.config }}
4243

4344
# Populate v0-rust-code-checks-{linux,windows} caches.
4445
code-checks:
4546
uses: ./.github/workflows/dep_code_checks.yml
4647
secrets: inherit
4748

48-
# Populate v0-rust-{Linux,Windows}-{hypervisor}-{debug,release} caches used
49-
# by dep_build_test.yml. Linux is primed once per hypervisor because the kvm
49+
# Populate the host caches (key {arch}-{os}-{hypervisor}-{config}) used by
50+
# dep_build_test.yml. Linux is primed once per hypervisor because the kvm
5051
# pools run Ubuntu and the mshv3 pools run Azure Linux 3, and we want each
5152
# distro to restore a cache produced under its own libc. Only the host
5253
# dependency graph is built here, no tests are run.
@@ -55,28 +56,41 @@ jobs:
5556
fail-fast: false
5657
matrix:
5758
include:
58-
- hypervisor: kvm
59+
- arch: X64
60+
hypervisor: kvm
5961
config: debug
60-
- hypervisor: kvm
62+
- arch: X64
63+
hypervisor: kvm
6164
config: release
62-
- hypervisor: mshv3
65+
- arch: X64
66+
hypervisor: mshv3
6367
config: debug
64-
- hypervisor: mshv3
68+
- arch: X64
69+
hypervisor: mshv3
6570
config: release
66-
- hypervisor: hyperv-ws2025
71+
- arch: X64
72+
hypervisor: hyperv-ws2025
6773
config: debug
68-
- hypervisor: hyperv-ws2025
74+
- arch: X64
75+
hypervisor: hyperv-ws2025
76+
config: release
77+
- arch: arm64
78+
hypervisor: kvm
79+
config: debug
80+
- arch: arm64
81+
hypervisor: kvm
6982
config: release
7083
timeout-minutes: ${{ fromJSON(vars.PRIME_CACHES_JOB_TIMEOUT || '30') }}
71-
runs-on: ${{ fromJson(
72-
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId=prime-cache-{2}-{3}-{4}-{5}-{6}"]',
73-
matrix.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
74-
matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
75-
matrix.hypervisor,
76-
matrix.config,
77-
github.run_id,
78-
github.run_number,
79-
github.run_attempt)) }}
84+
runs-on: ${{ fromJson(matrix.arch == 'X64'
85+
&& format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId=prime-cache-{2}-{3}-{4}-{5}-{6}"]',
86+
matrix.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
87+
matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
88+
matrix.hypervisor,
89+
matrix.config,
90+
github.run_id,
91+
github.run_number,
92+
github.run_attempt)
93+
|| '["self-hosted", "Linux", "arm64", "kvm", "ubuntu-24.04"]') }}
8094
steps:
8195
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
8296

@@ -94,7 +108,7 @@ jobs:
94108
- name: Rust cache
95109
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
96110
with:
97-
shared-key: "${{ runner.os }}-${{ matrix.hypervisor }}-${{ matrix.config }}"
111+
shared-key: "${{ matrix.arch }}-${{ runner.os }}-${{ matrix.hypervisor }}-${{ matrix.config }}"
98112
cache-on-failure: "true"
99113
# Only save on main as caches are not shared across branches.
100114
# https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache

.github/workflows/RustNightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ jobs:
2929
fail-fast: true
3030
matrix:
3131
hypervisor: [kvm, mshv3]
32-
cpu: [amd, intel]
32+
cpu_vendor: [amd, intel]
3333
config: [debug, release]
3434
runs-on: ${{ fromJson(
3535
format('["self-hosted", "Linux", "X64", "1ES.Pool=hld-{0}-{1}", "JobId=musl-{2}-{3}-{4}-{5}"]',
3636
matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
37-
matrix.cpu,
37+
matrix.cpu_vendor,
3838
matrix.config,
3939
github.run_id,
4040
github.run_number,

.github/workflows/ValidatePullRequest.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,26 @@ jobs:
9494
fail-fast: true
9595
matrix:
9696
hypervisor: ['hyperv-ws2025', mshv3, kvm]
97-
cpu: [amd, intel, apple]
97+
cpu_vendor: [amd, intel, apple]
9898
arch: [X64, arm64]
9999
config: [debug, release]
100100
exclude:
101-
- cpu: apple
101+
- cpu_vendor: apple
102102
hypervisor: hyperv-ws2025
103-
- cpu: apple
103+
- cpu_vendor: apple
104104
hypervisor: mshv3
105-
- cpu: amd
105+
- cpu_vendor: amd
106106
arch: arm64
107-
- cpu: intel
107+
- cpu_vendor: intel
108108
arch: arm64
109-
- cpu: apple
109+
- cpu_vendor: apple
110110
arch: X64
111111
uses: ./.github/workflows/dep_build_test.yml
112112
secrets: inherit
113113
with:
114114
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
115115
hypervisor: ${{ matrix.hypervisor }}
116-
cpu: ${{ matrix.cpu }}
116+
cpu_vendor: ${{ matrix.cpu_vendor }}
117117
arch: ${{ matrix.arch }}
118118
config: ${{ matrix.config }}
119119

@@ -130,26 +130,26 @@ jobs:
130130
fail-fast: true
131131
matrix:
132132
hypervisor: ['hyperv-ws2025', mshv3, kvm]
133-
cpu: [amd, intel, apple]
133+
cpu_vendor: [amd, intel, apple]
134134
arch: [X64, arm64]
135135
config: [debug, release]
136136
exclude:
137-
- cpu: apple
137+
- cpu_vendor: apple
138138
hypervisor: hyperv-ws2025
139-
- cpu: apple
139+
- cpu_vendor: apple
140140
hypervisor: mshv3
141-
- cpu: amd
141+
- cpu_vendor: amd
142142
arch: arm64
143-
- cpu: intel
143+
- cpu_vendor: intel
144144
arch: arm64
145-
- cpu: apple
145+
- cpu_vendor: apple
146146
arch: X64
147147
uses: ./.github/workflows/dep_run_examples.yml
148148
secrets: inherit
149149
with:
150150
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
151151
hypervisor: ${{ matrix.hypervisor }}
152-
cpu: ${{ matrix.cpu }}
152+
cpu_vendor: ${{ matrix.cpu_vendor }}
153153
arch: ${{ matrix.arch }}
154154
config: ${{ matrix.config }}
155155

.github/workflows/dep_benchmarks.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
22

3-
# Reusable workflow to run benchmarks on a single hypervisor/cpu combination.
3+
# Reusable workflow to run benchmarks on a single hypervisor/cpu_vendor combination.
44
#
55
# Baseline comparison:
66
# The workflow supports two mutually exclusive ways to load a baseline for
@@ -20,7 +20,7 @@
2020
#
2121
# Artifact upload:
2222
# Benchmark results are always uploaded as workflow artifacts named
23-
# benchmarks_<OS>_<hypervisor>_<cpu>. The retention_days input controls
23+
# benchmarks_<OS>_<hypervisor>_<cpu_vendor>. The retention_days input controls
2424
# how long they are kept (default: 5 days).
2525

2626
name: Run Benchmarks
@@ -37,8 +37,12 @@ on:
3737
description: Hypervisor for this run (passed from caller matrix)
3838
required: true
3939
type: string
40-
cpu:
41-
description: CPU architecture for the build (passed from caller matrix)
40+
cpu_vendor:
41+
description: CPU vendor for the build, amd or intel (passed from caller matrix)
42+
required: true
43+
type: string
44+
arch:
45+
description: CPU architecture for the build, X64 or arm64 (passed from caller matrix)
4246
required: true
4347
type: string
4448
baseline_tag:
@@ -72,14 +76,15 @@ jobs:
7276
run-benchmarks:
7377
if: ${{ inputs.docs_only == 'false' }}
7478
timeout-minutes: ${{ fromJSON(vars.BENCHMARKS_JOB_TIMEOUT || '60') }}
75-
runs-on: ${{ fromJson(
76-
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}", "JobId=run-benchmarks-{3}-{4}-{5}"]',
77-
inputs.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
78-
inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && 'azlinux3-mshv' || inputs.hypervisor,
79-
inputs.cpu,
80-
github.run_id,
81-
github.run_number,
82-
github.run_attempt)) }}
79+
runs-on: ${{ fromJson(inputs.arch == 'X64'
80+
&& format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}", "JobId=run-benchmarks-{3}-{4}-{5}"]',
81+
inputs.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
82+
inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && 'azlinux3-mshv' || inputs.hypervisor,
83+
inputs.cpu_vendor,
84+
github.run_id,
85+
github.run_number,
86+
github.run_attempt)
87+
|| '["self-hosted", "Linux", "arm64", "kvm", "ubuntu-24.04"]') }}
8388
steps:
8489
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
8590

@@ -97,19 +102,19 @@ jobs:
97102
- name: Rust cache
98103
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
99104
with:
100-
shared-key: "${{ runner.os }}-${{ inputs.hypervisor }}-release"
105+
shared-key: "${{ inputs.arch }}-${{ runner.os }}-${{ inputs.hypervisor }}-release"
101106
save-if: "false"
102107

103108
- name: Download Rust guests
104109
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
105110
with:
106-
name: rust-guests-X64-release
111+
name: rust-guests-${{ inputs.arch }}-release
107112
path: src/tests/rust_guests/bin/release/
108113

109114
- name: Download C guests
110115
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
111116
with:
112-
name: c-guests-X64-release
117+
name: c-guests-${{ inputs.arch }}-release
113118
path: src/tests/c_guests/bin/release/
114119

115120
- name: Build
@@ -119,15 +124,15 @@ jobs:
119124
if: ${{ inputs.baseline_run_id != '' }}
120125
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
121126
with:
122-
name: benchmarks_${{ runner.os }}_${{ inputs.hypervisor }}_${{ inputs.cpu }}
127+
name: benchmarks_${{ runner.os }}_${{ inputs.hypervisor }}_${{ inputs.cpu_vendor }}
123128
path: ./target/criterion/
124129
run-id: ${{ inputs.baseline_run_id }}
125130
github-token: ${{ secrets.GITHUB_TOKEN }}
126131
continue-on-error: true
127132

128133
- name: Download baseline from release
129134
if: ${{ inputs.baseline_run_id == '' }}
130-
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu }} ${{ inputs.baseline_tag }}
135+
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu_vendor }} ${{ inputs.baseline_tag }}
131136
env:
132137
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133138
continue-on-error: true
@@ -137,7 +142,7 @@ jobs:
137142

138143
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
139144
with:
140-
name: benchmarks_${{ runner.os }}_${{ inputs.hypervisor }}_${{ inputs.cpu }}
145+
name: benchmarks_${{ runner.os }}_${{ inputs.hypervisor }}_${{ inputs.cpu_vendor }}
141146
path: ./target/criterion/
142147
if-no-files-found: error
143148
retention-days: ${{ inputs.retention_days }}

.github/workflows/dep_build_guests.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,13 @@ jobs:
3333
build-guests:
3434
if: ${{ inputs.docs_only == 'false' }}
3535
timeout-minutes: ${{ fromJSON(vars.BUILD_GUESTS_JOB_TIMEOUT || '15') }}
36-
runs-on: ${{ fromJson(
37-
format('["self-hosted", "Linux", "{0}", "{1}" {2}]',
38-
inputs.arch,
39-
inputs.arch == 'X64' && '1ES.Pool=hld-kvm-amd' || 'ubuntu-24.04',
40-
inputs.arch == 'X64' && format(', "JobId=build-guests-{0}-{1}-{2}-{3}"',
41-
inputs.config,
42-
github.run_id,
43-
github.run_number,
44-
github.run_attempt)
45-
|| ''
46-
)) }}
36+
runs-on: ${{ fromJson(inputs.arch == 'X64'
37+
&& format('["self-hosted", "Linux", "X64", "1ES.Pool=hld-kvm-amd", "JobId=build-guests-{0}-{1}-{2}-{3}"]',
38+
inputs.config,
39+
github.run_id,
40+
github.run_number,
41+
github.run_attempt)
42+
|| '["self-hosted", "Linux", "arm64", "ubuntu-24.04"]') }}
4743
steps:
4844
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4945

@@ -128,8 +124,9 @@ jobs:
128124
retention-days: 1
129125
if-no-files-found: error
130126

127+
# The .wasm is arch-independent, so upload it once from X64 only.
131128
- name: Upload bindgen-test-cases.wasm
132-
if: inputs.config == 'debug'
129+
if: inputs.config == 'debug' && inputs.arch == 'X64'
133130
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
134131
with:
135132
name: bindgen-test-cases-wasm

0 commit comments

Comments
 (0)