Skip to content

Commit 8a07e3c

Browse files
committed
Use cross-rs to build musl
Signed-off-by: James Sturtevant <[email protected]>
1 parent f75e6ce commit 8a07e3c

File tree

5 files changed

+123
-77
lines changed

5 files changed

+123
-77
lines changed

.github/workflows/dep_rust.yml

Lines changed: 24 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,67 @@ 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
144+
TARGET_TRIPLE: ${{ inputs.target_triple }}
138145
run: |
139146
# with default features
140-
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
147+
just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
141148
142149
# 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 }}
150+
just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
144151
145152
# make sure certain cargo features compile
146-
just check ${{ inputs.target_triple }}
153+
just check
147154
148155
# without any features
149-
just test-compilation-no-default-features ${{ inputs.config }} ${{ inputs.target_triple }}
156+
just test-compilation-no-default-features ${{ inputs.config }}
150157
151158
# One of the examples is flaky on Windows GH runners, so this allows us to disable it for now
152159
- name: Run Rust examples - windows
153160
if: ${{ (runner.os == 'Windows') }}
154161
env:
155162
CARGO_TERM_COLOR: always
156163
RUST_LOG: debug
164+
TARGET_TRIPLE: ${{ inputs.target_triple }}
157165
run: just run-rust-examples ${{ inputs.config }}
158166

167+
159168
- name: Run Rust examples - linux
160169
if: false
161170
env:
162171
CARGO_TERM_COLOR: always
163172
RUST_LOG: debug
164-
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
173+
TARGET_TRIPLE: ${{ inputs.target_triple }}
174+
run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
165175

166176
- name: Run Rust Gdb tests - linux
167177
if: runner.os == 'Linux'
168178
env:
169179
CARGO_TERM_COLOR: always
170180
RUST_LOG: debug
171-
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
181+
TARGET_TRIPLE: ${{ inputs.target_triple }}
182+
run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
172183

173184
- name: Run Rust Crashdump tests
174185
env:
175186
CARGO_TERM_COLOR: always
176187
RUST_LOG: debug
177-
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
188+
TARGET_TRIPLE: ${{ inputs.target_triple }}
189+
run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
178190

179191
- name: Run Rust Tracing tests - linux
180192
if: runner.os == 'Linux'
181193
env:
182194
CARGO_TERM_COLOR: always
183195
RUST_LOG: debug
184-
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} ${{ inputs.target_triple }}
196+
TARGET_TRIPLE: ${{ inputs.target_triple }}
197+
run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}}
185198

186199
- name: Download benchmarks from "latest"
187200
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)