Skip to content

Commit 32abdd6

Browse files
committed
Refactor dep_rust so it is re-usable in new nightly job
Signed-off-by: James Sturtevant <[email protected]>
1 parent 8356e44 commit 32abdd6

File tree

3 files changed

+96
-43
lines changed

3 files changed

+96
-43
lines changed

.github/workflows/RustNightly.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Nightly
4+
5+
on:
6+
workflow_dispatch:
7+
8+
jobs:
9+
musl:
10+
strategy:
11+
fail-fast: true
12+
matrix:
13+
hypervisor: [kvm, mshv3]
14+
cpu: [amd, intel]
15+
config: [debug, release]
16+
uses: ./.github/workflows/dep_rust.yml
17+
secrets: inherit
18+
with:
19+
hypervisor: ${{ matrix.hypervisor }}
20+
cpu: ${{ matrix.cpu }}
21+
config: ${{ matrix.config }}
22+
target_triple: x86_64-unknown-linux-musl
23+
24+
# TODO: using notification script
25+

.github/workflows/ValidatePullRequest.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,19 @@ jobs:
4444
rust:
4545
needs:
4646
- docs-pr
47+
strategy:
48+
fail-fast: true
49+
matrix:
50+
hypervisor: [hyperv, 'hyperv-ws2025', mshv, mshv3, kvm]
51+
cpu: [amd, intel]
52+
config: [debug, release]
4753
uses: ./.github/workflows/dep_rust.yml
4854
secrets: inherit
4955
with:
5056
docs_only: ${{needs.docs-pr.outputs.docs-only}}
57+
hypervisor: ${{ matrix.hypervisor }}
58+
cpu: ${{ matrix.cpu }}
59+
config: ${{ matrix.config }}
5160

5261
fuzzing:
5362
needs:

.github/workflows/dep_rust.yml

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ on:
1111
required: false
1212
type: string
1313
default: "false"
14+
target_triple:
15+
description: Target triple for cross-compilation
16+
required: false
17+
type: string
18+
default: ""
19+
hypervisor:
20+
description: Hypervisor for this run (passed from caller matrix)
21+
required: false
22+
type: string
23+
default: "kvm"
24+
config:
25+
description: Build configuration for this run (passed from caller matrix)
26+
required: false
27+
type: string
28+
default: "debug"
29+
cpu:
30+
description: CPU architecture for the build (passed from caller matrix)
31+
required: false
32+
type: string
33+
default: "amd"
1434

1535
env:
1636
CARGO_TERM_COLOR: always
@@ -32,17 +52,12 @@ defaults:
3252

3353
jobs:
3454
code-checks:
35-
if: ${{ inputs.docs_only == 'false' }}
55+
if: ${{ inputs.docs_only == 'false' && (inputs.hypervisor == 'hyperv-ws2025' || inputs.hypervisor == 'kvm') }}
3656
timeout-minutes: 60
37-
strategy:
38-
fail-fast: true
39-
matrix:
40-
hypervisor: ['hyperv-ws2025', kvm]
41-
config: [debug, release]
4257
runs-on: ${{ fromJson(
4358
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd"]',
44-
(matrix.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
45-
matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || 'kvm')) }}
59+
(inputs.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
60+
inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || 'kvm')) }}
4661
steps:
4762
- uses: actions/checkout@v5
4863

@@ -63,32 +78,29 @@ jobs:
6378
- name: clippy
6479
if: ${{ (runner.os == 'Windows' )}}
6580
run: |
66-
just clippy ${{ matrix.config }}
67-
just clippy-guests ${{ matrix.config }}
81+
just clippy ${{ inputs.config }}
82+
just clippy-guests ${{ inputs.config }}
83+
env:
84+
TARGET_TRIPLE: ${{ inputs.target_triple }}
6885

6986
- name: clippy exhaustive check
7087
if: ${{ (runner.os == 'Linux' )}}
7188
run: |
72-
just clippy-exhaustive ${{ matrix.config }}
89+
just clippy-exhaustive ${{ inputs.config }}
90+
env:
91+
TARGET_TRIPLE: ${{ inputs.target_triple }}
7392

7493
- name: Verify MSRV
7594
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common
7695

7796
build:
7897
if: ${{ inputs.docs_only == 'false' }}
7998
timeout-minutes: 60
80-
strategy:
81-
fail-fast: true
82-
matrix:
83-
hypervisor: [hyperv, 'hyperv-ws2025', mshv, mshv3, kvm] # hyperv is windows, mshv and kvm are linux
84-
cpu: [amd, intel]
85-
config: [debug, release]
86-
8799
runs-on: ${{ fromJson(
88100
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]',
89-
(matrix.hypervisor == 'hyperv' || matrix.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
90-
matrix.hypervisor == 'hyperv' && 'win2022' || matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
91-
matrix.cpu)) }}
101+
(inputs.hypervisor == 'hyperv' || inputs.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
102+
inputs.hypervisor == 'hyperv' && 'win2022' || inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && 'azlinux3-mshv' || inputs.hypervisor,
103+
inputs.cpu)) }}
92104
steps:
93105
- uses: actions/checkout@v5
94106

@@ -112,79 +124,86 @@ jobs:
112124
- name: Build and move Rust guests
113125
run: |
114126
# use these commands in favor of build-and-move-rust-guests to avoid building both configs
115-
just build-rust-guests ${{ matrix.config }}
116-
just move-rust-guests ${{ matrix.config }}
127+
just build-rust-guests ${{ inputs.config }}
128+
just move-rust-guests ${{ inputs.config }}
117129
118130
- name: Build c guests
119131
run: |
120132
# use these commands in favor of build-and-move-c-guests to avoid building both configs
121-
just build-c-guests ${{ matrix.config }}
122-
just move-c-guests ${{ matrix.config }}
133+
just build-c-guests ${{ inputs.config }}
134+
just move-c-guests ${{ inputs.config }}
135+
123136
- name: Build
124-
run: just build ${{ matrix.config }}
137+
run: just build ${{ inputs.config }}
138+
env:
139+
TARGET_TRIPLE: ${{ inputs.target_triple }}
125140

126141
- name: Run Rust tests
127142
env:
128143
CARGO_TERM_COLOR: always
144+
TARGET_TRIPLE: ${{ inputs.target_triple }}
129145
run: |
130146
# with default features
131-
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
147+
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
132148
133149
# with only one driver enabled (driver mshv/kvm feature is ignored on windows) + seccomp
134-
just test ${{ matrix.config }} seccomp,${{ matrix.hypervisor == 'mshv' && 'mshv2' || matrix.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
150+
just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
135151
136152
# make sure certain cargo features compile
137-
cargo check -p hyperlight-host --features crashdump
138-
cargo check -p hyperlight-host --features print_debug
139-
cargo check -p hyperlight-host --features gdb
140-
cargo check -p hyperlight-host --features trace_guest,unwind_guest,mem_profile
153+
just check
141154
142155
# without any features
143-
just test-compilation-no-default-features ${{ matrix.config }}
156+
just test-compilation-no-default-features ${{ inputs.config }}
144157
145158
# One of the examples is flaky on Windows GH runners, so this allows us to disable it for now
146159
- name: Run Rust examples - windows
147160
if: ${{ (runner.os == 'Windows') }}
148161
env:
149162
CARGO_TERM_COLOR: always
150163
RUST_LOG: debug
151-
run: just run-rust-examples ${{ matrix.config }}
164+
TARGET_TRIPLE: ${{ inputs.target_triple }}
165+
run: just run-rust-examples ${{ inputs.config }}
166+
152167

153168
- name: Run Rust examples - linux
154-
if: ${{ (runner.os != 'Windows') }}
169+
if: false
155170
env:
156171
CARGO_TERM_COLOR: always
157172
RUST_LOG: debug
158-
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
173+
TARGET_TRIPLE: ${{ inputs.target_triple }}
174+
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
159175

160176
- name: Run Rust Gdb tests - linux
161177
if: runner.os == 'Linux'
162178
env:
163179
CARGO_TERM_COLOR: always
164180
RUST_LOG: debug
165-
run: just test-rust-gdb-debugging ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
181+
TARGET_TRIPLE: ${{ inputs.target_triple }}
182+
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
166183

167184
- name: Run Rust Crashdump tests
168185
env:
169186
CARGO_TERM_COLOR: always
170187
RUST_LOG: debug
171-
run: just test-rust-crashdump ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
188+
TARGET_TRIPLE: ${{ inputs.target_triple }}
189+
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
172190

173191
- name: Run Rust Tracing tests - linux
174192
if: runner.os == 'Linux'
175193
env:
176194
CARGO_TERM_COLOR: always
177195
RUST_LOG: debug
178-
run: just test-rust-tracing ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
196+
TARGET_TRIPLE: ${{ inputs.target_triple }}
197+
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
179198

180199
- name: Download benchmarks from "latest"
181-
run: just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu}} dev-latest # compare to prerelease
200+
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu}} dev-latest # compare to prerelease
182201
env:
183202
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184203
continue-on-error: true
185-
if: ${{ matrix.config == 'release' }}
204+
if: ${{ inputs.config == 'release' && inputs.target_triple == '' }}
186205

187206
- name: Run benchmarks
188207
run: |
189-
just bench-ci main ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
190-
if: ${{ matrix.config == 'release' }}
208+
just bench-ci main ${{ inputs.hypervisor == 'mshv' && 'mshv2' || ''}}
209+
if: ${{ inputs.config == 'release' && inputs.target_triple == '' }}

0 commit comments

Comments
 (0)