Skip to content

Commit fb61d74

Browse files
committed
use cross-rs
Signed-off-by: James Sturtevant <[email protected]>
1 parent 53f4f46 commit fb61d74

File tree

5 files changed

+128
-77
lines changed

5 files changed

+128
-77
lines changed

.github/workflows/dep_rust.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ jobs:
7878
- name: clippy
7979
if: ${{ (runner.os == 'Windows' )}}
8080
run: |
81-
just clippy ${{ inputs.config }} ${{ inputs.target_triple }}
81+
just clippy ${{ inputs.config }}
8282
just clippy-guests ${{ inputs.config }}
83+
env:
84+
TARGET_TRIPLE: ${{ inputs.target_triple }}
8385

8486
- name: clippy exhaustive check
8587
if: ${{ (runner.os == 'Linux' )}}
8688
run: |
87-
just clippy-exhaustive ${{ inputs.config }} ${{ inputs.target_triple }}
89+
just clippy-exhaustive ${{ inputs.config }}
90+
env:
91+
TARGET_TRIPLE: ${{ inputs.target_triple }}
8892

8993
- name: Verify MSRV
9094
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common
@@ -130,58 +134,68 @@ jobs:
130134
just move-c-guests ${{ inputs.config }}
131135
132136
- name: Build
133-
run: just build ${{ inputs.config }} ${{ inputs.target_triple }}
137+
run: just build ${{ inputs.config }}
138+
env:
139+
TARGET_TRIPLE: ${{ inputs.target_triple }}
134140

135141
- name: Run Rust tests
136142
env:
137143
CARGO_TERM_COLOR: always
138144
run: |
139145
# with default features
140-
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
146+
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
141147
142148
# with only one driver enabled (driver mshv/kvm feature is ignored on windows) + seccomp
143-
just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }} ${{ inputs.target_triple }}
149+
just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
144150
145151
# make sure certain cargo features compile
146-
just check ${{ inputs.target_triple }}
152+
just check
147153
148154
# without any features
149-
just test-compilation-no-default-features ${{ inputs.config }} ${{ inputs.target_triple }}
155+
just test-compilation-no-default-features ${{ inputs.config }}
156+
env:
157+
TARGET_TRIPLE: ${{ inputs.target_triple }}
150158

151159
# One of the examples is flaky on Windows GH runners, so this allows us to disable it for now
152160
- name: Run Rust examples - windows
153161
if: ${{ (runner.os == 'Windows') }}
154162
env:
155163
CARGO_TERM_COLOR: always
156164
RUST_LOG: debug
165+
TARGET_TRIPLE: ${{ inputs.target_triple }}
157166
run: just run-rust-examples ${{ inputs.config }}
158167

168+
159169
- name: Run Rust examples - linux
160170
if: false
161171
env:
162172
CARGO_TERM_COLOR: always
163173
RUST_LOG: debug
164-
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
174+
TARGET_TRIPLE: ${{ inputs.target_triple }}
175+
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
165176

166177
- name: Run Rust Gdb tests - linux
167178
if: runner.os == 'Linux'
168179
env:
169180
CARGO_TERM_COLOR: always
170181
RUST_LOG: debug
171-
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
182+
TARGET_TRIPLE: ${{ inputs.target_triple }}
183+
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
172184

173185
- name: Run Rust Crashdump tests
174186
env:
175187
CARGO_TERM_COLOR: always
176188
RUST_LOG: debug
177-
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
189+
TARGET_TRIPLE: ${{ inputs.target_triple }}
190+
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
178191

179192
- name: Run Rust Tracing tests - linux
180193
if: runner.os == 'Linux'
181194
env:
182195
CARGO_TERM_COLOR: always
183196
RUST_LOG: debug
184-
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
197+
TARGET_TRIPLE: ${{ inputs.target_triple }}
198+
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
185199

186200
- name: Download benchmarks from "latest"
187201
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu}} dev-latest # compare to prerelease

Cross.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build]
2+
pre-build = [
3+
"apt-get update && apt-get -y install gdb"
4+
]
5+
6+
[build.env]
7+
passthrough = [
8+
"TARGET_TRIPLE", # Some tests invoke Cargo directly and need this to run correctly
9+
]

0 commit comments

Comments
 (0)