@@ -273,48 +273,22 @@ jobs:
273
273
- uses : ./.github/actions/install-rust
274
274
with :
275
275
toolchain : ${{ matrix.rust }}
276
+ - uses : ./.github/workflows/cross.yml
277
+ with :
278
+ os : ${{ matrix.os }
279
+ target : ${{ matrix.target }}
280
+ libc_package : ${{ matrix.libc_package }}
281
+ gcc_package : ${{ matrix.gcc_package }}
282
+ gcc : ${{ matrix.gcc }}
283
+ qemu : ${{ matrix.qemu }}
284
+ qemu_target : ${{ matrix.qemu_target }}
276
285
277
286
- name : Configure Cargo target
278
287
run : |
279
288
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
280
289
rustup target add ${{ matrix.target }}
281
290
if : matrix.target != ''
282
291
283
- - name : Install cross-compilation tools
284
- run : |
285
- set -ex
286
- sudo apt-get update
287
- sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build
288
- upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
289
- echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
290
- if : matrix.gcc_package != '' && matrix.os == 'ubuntu-latest'
291
-
292
- - name : Install cross-compilation libraries
293
- run : |
294
- set -ex
295
- sudo apt-get update
296
- sudo apt-get install -y ${{ matrix.libc_package }}
297
- if : matrix.libc_package != '' && matrix.os == 'ubuntu-latest'
298
-
299
- - name : Install qemu
300
- run : |
301
- set -ex
302
- # Download and build qemu from source since the most recent release is
303
- # way faster at arm emulation than the current version github actions'
304
- # ubuntu image uses. Disable as much as we can to get it to build
305
- # quickly.
306
- cd
307
- curl https://download.qemu.org/qemu-6.1.0.tar.xz | tar xJf -
308
- cd qemu-6.1.0
309
- ./configure --target-list=${{ matrix.qemu_target }} --prefix=$HOME/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
310
- make -j$(nproc) install
311
-
312
- # Configure Cargo for cross compilation and tell it how it can run
313
- # cross executables
314
- upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
315
- echo CARGO_TARGET_${upcase}_RUNNER=$HOME/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV
316
- if : matrix.qemu != '' && matrix.os == 'ubuntu-latest'
317
-
318
292
- run : |
319
293
# Run the tests, and check the prebuilt release libraries.
320
294
cargo test --verbose --features=all-impls,procfs,cc --release --workspace -- --nocapture
@@ -391,48 +365,22 @@ jobs:
391
365
- uses : ./.github/actions/install-rust
392
366
with :
393
367
toolchain : ${{ matrix.rust }}
368
+ - uses : ./.github/workflows/cross.yml
369
+ with :
370
+ os : ${{ matrix.os }
371
+ target : ${{ matrix.target }}
372
+ libc_package : ${{ matrix.libc_package }}
373
+ gcc_package : ${{ matrix.gcc_package }}
374
+ gcc : ${{ matrix.gcc }}
375
+ qemu : ${{ matrix.qemu }}
376
+ qemu_target : ${{ matrix.qemu_target }}
394
377
395
378
- name : Configure Cargo target
396
379
run : |
397
380
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
398
381
rustup target add ${{ matrix.target }}
399
382
if : matrix.target != ''
400
383
401
- - name : Install cross-compilation tools
402
- run : |
403
- set -ex
404
- sudo apt-get update
405
- sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build
406
- upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
407
- echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
408
- if : matrix.gcc_package != '' && matrix.os == 'ubuntu-latest'
409
-
410
- - name : Install cross-compilation libraries
411
- run : |
412
- set -ex
413
- sudo apt-get update
414
- sudo apt-get install -y ${{ matrix.libc_package }}
415
- if : matrix.libc_package != '' && matrix.os == 'ubuntu-latest'
416
-
417
- - name : Install qemu
418
- run : |
419
- set -ex
420
- # Download and build qemu from source since the most recent release is
421
- # way faster at arm emulation than the current version github actions'
422
- # ubuntu image uses. Disable as much as we can to get it to build
423
- # quickly.
424
- cd
425
- curl https://download.qemu.org/qemu-6.1.0.tar.xz | tar xJf -
426
- cd qemu-6.1.0
427
- ./configure --target-list=${{ matrix.qemu_target }} --prefix=$HOME/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
428
- make -j$(nproc) install
429
-
430
- # Configure Cargo for cross compilation and tell it how it can run
431
- # cross executables
432
- upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
433
- echo CARGO_TARGET_${upcase}_RUNNER=$HOME/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV
434
- if : matrix.qemu != '' && matrix.os == 'ubuntu-latest'
435
-
436
384
- run : |
437
385
cargo test --verbose --features=all-impls,procfs --release --workspace -- --nocapture
438
386
env:
0 commit comments