Skip to content

Commit d376433

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

File tree

3 files changed

+78
-38
lines changed

3 files changed

+78
-38
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]
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: 44 additions & 38 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,13 +52,8 @@ 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"]',
4459
(matrix.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
@@ -63,27 +78,20 @@ 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 }} ${{ inputs.target_triple }}
82+
just clippy-guests ${{ inputs.config }}
6883
6984
- name: clippy exhaustive check
7085
if: ${{ (runner.os == 'Linux' )}}
7186
run: |
72-
just clippy-exhaustive ${{ matrix.config }}
87+
just clippy-exhaustive ${{ inputs.config }} ${{ inputs.target_triple }}
7388
7489
- name: Verify MSRV
7590
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common
7691

7792
build:
7893
if: ${{ inputs.docs_only == 'false' }}
7994
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-
8795
runs-on: ${{ fromJson(
8896
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]',
8997
(matrix.hypervisor == 'hyperv' || matrix.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
@@ -112,79 +120,77 @@ jobs:
112120
- name: Build and move Rust guests
113121
run: |
114122
# 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 }}
123+
just build-rust-guests ${{ inputs.config }}
124+
just move-rust-guests ${{ inputs.config }}
117125
118126
- name: Build c guests
119127
run: |
120128
# 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 }}
129+
just build-c-guests ${{ inputs.config }}
130+
just move-c-guests ${{ inputs.config }}
131+
123132
- name: Build
124-
run: just build ${{ matrix.config }}
133+
run: just build ${{ inputs.config }} ${{ inputs.target_triple }}
125134

126135
- name: Run Rust tests
127136
env:
128137
CARGO_TERM_COLOR: always
129138
run: |
130139
# with default features
131-
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
140+
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
132141
133142
# 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' }}
143+
just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }} ${{ inputs.target_triple }}
135144
136145
# 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
146+
just check ${{ inputs.target_triple }}
141147
142148
# without any features
143-
just test-compilation-no-default-features ${{ matrix.config }}
149+
just test-compilation-no-default-features ${{ inputs.config }} ${{ inputs.target_triple }}
144150
145151
# One of the examples is flaky on Windows GH runners, so this allows us to disable it for now
146152
- name: Run Rust examples - windows
147153
if: ${{ (runner.os == 'Windows') }}
148154
env:
149155
CARGO_TERM_COLOR: always
150156
RUST_LOG: debug
151-
run: just run-rust-examples ${{ matrix.config }}
157+
run: just run-rust-examples ${{ inputs.config }}
152158

153159
- name: Run Rust examples - linux
154-
if: ${{ (runner.os != 'Windows') }}
160+
if: false
155161
env:
156162
CARGO_TERM_COLOR: always
157163
RUST_LOG: debug
158-
run: just run-rust-examples-linux ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
164+
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
159165

160166
- name: Run Rust Gdb tests - linux
161167
if: runner.os == 'Linux'
162168
env:
163169
CARGO_TERM_COLOR: always
164170
RUST_LOG: debug
165-
run: just test-rust-gdb-debugging ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
171+
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
166172

167173
- name: Run Rust Crashdump tests
168174
env:
169175
CARGO_TERM_COLOR: always
170176
RUST_LOG: debug
171-
run: just test-rust-crashdump ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
177+
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
172178

173179
- name: Run Rust Tracing tests - linux
174180
if: runner.os == 'Linux'
175181
env:
176182
CARGO_TERM_COLOR: always
177183
RUST_LOG: debug
178-
run: just test-rust-tracing ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
184+
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
179185

180186
- name: Download benchmarks from "latest"
181-
run: just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu}} dev-latest # compare to prerelease
187+
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu}} dev-latest # compare to prerelease
182188
env:
183189
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184190
continue-on-error: true
185-
if: ${{ matrix.config == 'release' }}
191+
if: ${{ inputs.config == 'release' && inputs.target_triple == '' }}
186192

187193
- name: Run benchmarks
188194
run: |
189-
just bench-ci main ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
190-
if: ${{ matrix.config == 'release' }}
195+
just bench-ci main ${{ inputs.hypervisor == 'mshv' && 'mshv2' || ''}}
196+
if: ${{ inputs.config == 'release' && inputs.target_triple == '' }}

0 commit comments

Comments
 (0)