1name: CI 2 3on: 4 push: 5 branches: 6 - main 7 pull_request: 8 workflow_dispatch: 9 10jobs: 11 rustfmt: 12 name: Rustfmt 13 runs-on: ubuntu-latest 14 steps: 15 - uses: actions/checkout@v3 16 with: 17 submodules: true 18 - uses: ./.github/actions/install-rust 19 with: 20 toolchain: stable 21 - run: cargo fmt --all -- --check 22 23 check: 24 name: Check 25 runs-on: ${{ matrix.os }} 26 strategy: 27 matrix: 28 build: [stable, nightly, 1.48] 29 include: 30 - build: stable 31 os: ubuntu-latest 32 rust: stable 33 - build: nightly 34 os: ubuntu-latest 35 rust: nightly 36 - build: 1.48 37 os: ubuntu-latest 38 rust: 1.48 39 40 env: 41 # -D warnings is commented out in our install-rust action; re-add it here. 42 # In theory we should add --cfg criterion here, but criterion doesn't compile under Rust 1.48. 43 RUSTFLAGS: -D warnings 44 steps: 45 - uses: actions/checkout@v3 46 with: 47 submodules: true 48 - uses: ./.github/actions/install-rust 49 with: 50 toolchain: ${{ matrix.rust }} 51 52 - run: > 53 rustup target add 54 x86_64-unknown-linux-musl 55 x86_64-unknown-linux-gnux32 56 x86_64-linux-android 57 i686-linux-android 58 x86_64-apple-darwin 59 x86_64-unknown-freebsd 60 x86_64-unknown-netbsd 61 x86_64-unknown-illumos 62 i686-unknown-linux-gnu 63 i686-unknown-linux-musl 64 wasm32-unknown-emscripten 65 aarch64-unknown-linux-gnu 66 aarch64-unknown-linux-musl 67 powerpc64le-unknown-linux-gnu 68 armv5te-unknown-linux-gnueabi 69 s390x-unknown-linux-gnu 70 arm-linux-androideabi 71 sparc64-unknown-linux-gnu 72 sparcv9-sun-solaris 73 aarch64-linux-android 74 aarch64-apple-ios 75 wasm32-wasi 76 - if: matrix.rust != '1.48' 77 run: rustup target add x86_64-unknown-fuchsia 78 - if: matrix.rust == '1.48' 79 run: rustup target add x86_64-fuchsia 80 81 - name: Install cross-compilation tools 82 run: | 83 set -ex 84 sudo apt-get update 85 sudo apt-get install -y gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi musl-tools 86 87 - name: Use specific dependency versions for Rust 1.48 compatibility. 88 if: matrix.rust == '1.48' 89 run: | 90 cargo update --package=once_cell --precise 1.14.0 91 cargo update --package=tempfile --precise=3.4.0 92 cargo update --package=io-lifetimes --precise 1.0.6 93 cargo update --package=flate2 --precise=1.0.25 94 for crate in test-crates/*; do 95 cd $crate 96 cargo update --package=io-lifetimes --precise 1.0.6 97 cd - >/dev/null 98 done 99 cargo update --package=tempfile --precise=3.6.0 100 101 - run: cargo check --workspace --release -vv --all-targets 102 - run: cargo check --workspace --release -vv --features=all-apis --all-targets 103 - run: cargo check --workspace --release -vv --features=use-libc,all-apis --all-targets 104 - run: cargo check --workspace --release -vv --target=aarch64-linux-android --all-targets 105 - run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-musl --features=all-apis --all-targets 106 - run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-musl --features=use-libc,all-apis --all-targets 107 - run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-gnux32 --features=all-apis --all-targets 108 - run: cargo check --workspace --release -vv --target=x86_64-linux-android --features=all-apis --all-targets 109 - run: cargo check --workspace --release -vv --target=i686-linux-android --features=all-apis --all-targets 110 - run: cargo check --workspace --release -vv --target=x86_64-apple-darwin --features=all-apis --all-targets 111 - run: cargo check --workspace --release -vv --target=x86_64-unknown-freebsd --features=all-apis --all-targets 112 - run: cargo check --workspace --release -vv --target=x86_64-unknown-netbsd --features=all-apis --all-targets 113 - if: matrix.rust != '1.48' 114 run: cargo check --workspace --release -vv --target=x86_64-unknown-fuchsia --features=all-apis --all-targets 115 - if: matrix.rust == '1.48' 116 run: cargo check --workspace --release -vv --target=x86_64-fuchsia --features=all-apis --all-targets 117 - run: cargo check --workspace --release -vv --target=x86_64-unknown-illumos --features=all-apis --all-targets 118 - run: cargo check --workspace --release -vv --target=i686-unknown-linux-gnu --features=all-apis --all-targets 119 - run: cargo check --workspace --release -vv --target=i686-unknown-linux-musl --features=all-apis --all-targets 120 - run: cargo check --workspace --release -vv --target=i686-unknown-linux-musl --features=use-libc,all-apis --all-targets 121 - run: cargo check --workspace --release -vv --target=wasm32-unknown-emscripten --features=all-apis --all-targets 122 - run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-gnu --features=all-apis --all-targets 123 - run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-musl --features=all-apis --all-targets 124 - run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-musl --features=use-libc,all-apis --all-targets 125 - run: cargo check --workspace --release -vv --target=powerpc64le-unknown-linux-gnu --features=all-apis --all-targets 126 - run: cargo check --workspace --release -vv --target=armv5te-unknown-linux-gnueabi --features=all-apis --all-targets 127 - run: cargo check --workspace --release -vv --target=s390x-unknown-linux-gnu --features=all-apis --all-targets 128 - run: cargo check --workspace --release -vv --target=arm-linux-androideabi --features=all-apis --all-targets 129 - run: cargo check --workspace --release -vv --target=sparc64-unknown-linux-gnu --features=all-apis --all-targets 130 - run: cargo check --workspace --release -vv --target=sparcv9-sun-solaris --features=all-apis --all-targets 131 - run: cargo check --workspace --release -vv --target=aarch64-apple-ios --features=all-apis --all-targets 132 - run: cargo check --workspace --release -vv --target=aarch64-linux-android --features=all-apis --all-targets 133 # Omit --all-targets for WASI until all the dev-dependencies support WASI 134 # on stable. 135 - if: matrix.rust != '1.48' 136 run: cargo check --workspace --release -vv --target=wasm32-wasi --features=all-apis 137 138 check_no_default_features: 139 name: Check --no-default-features 140 runs-on: ${{ matrix.os }} 141 strategy: 142 matrix: 143 build: [nightly] 144 include: 145 - build: nightly 146 os: ubuntu-latest 147 rust: nightly 148 149 env: 150 # -D warnings is commented out in our install-rust action; re-add it here. 151 RUSTFLAGS: -D warnings 152 steps: 153 - uses: actions/checkout@v3 154 with: 155 submodules: true 156 - uses: ./.github/actions/install-rust 157 with: 158 toolchain: ${{ matrix.rust }} 159 - run: cargo check --workspace --release --no-default-features -vv 160 - run: cargo check --workspace --release --no-default-features --features all-apis -vv 161 162 check_nightly: 163 name: Check nightly-only targets 164 runs-on: ${{ matrix.os }} 165 strategy: 166 matrix: 167 build: [nightly] 168 include: 169 - build: nightly 170 os: ubuntu-latest 171 rust: nightly 172 173 steps: 174 - uses: actions/checkout@v3 175 with: 176 submodules: true 177 - uses: ./.github/actions/install-rust 178 with: 179 toolchain: ${{ matrix.rust }} 180 - run: > 181 rustup target add 182 x86_64-unknown-redox 183 wasm32-wasi 184 thumbv7neon-unknown-linux-gnueabihf 185 - run: cargo check --workspace --release -vv --target=x86_64-unknown-redox --features=all-apis 186 - run: cargo check --workspace --release -vv --target=wasm32-wasi --features=all-apis 187 - run: cargo check --workspace --release -vv --target=thumbv7neon-unknown-linux-gnueabihf --features=all-apis 188 189 check_tier3: 190 name: Check selected Tier 3 platforms 191 runs-on: ${{ matrix.os }} 192 strategy: 193 matrix: 194 build: [nightly] 195 include: 196 - build: nightly 197 os: ubuntu-latest 198 rust: nightly 199 200 steps: 201 - uses: actions/checkout@v3 202 with: 203 submodules: true 204 - uses: ./.github/actions/install-rust 205 with: 206 toolchain: ${{ matrix.rust }} 207 env: 208 # See the comments in the libc crate 209 RUSTFLAGS: -A improper_ctypes_definitions --cfg criterion 210 - run: rustup component add rust-src 211 - run: cargo check -Z build-std --target x86_64-unknown-openbsd --all-targets --features=all-apis 212 - run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis 213 - run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis 214 - run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis 215 - run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis 216 # Omit --all-targets on gnu_ilp32 because dev-dependency tempfile depends on an older rustix 217 - run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --features=all-apis 218 # Omit --all-targets on haiku because not all the tests build yet. 219 - run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis 220 # x86_64-uwp-windows-msvc isn't currently working. 221 #- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis 222 223 test: 224 name: Test 225 runs-on: ${{ matrix.os }} 226 env: 227 QEMU_BUILD_VERSION: 7.0.0 228 strategy: 229 matrix: 230 build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, s390x-linux, arm-linux, ubuntu-stable, ubuntu-1.48, i686-linux-stable, aarch64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.48, i686-linux-1.48, aarch64-linux-1.48, s390x-linux-1.48, powerpc64le-linux-1.48, arm-linux-1.48, macos-latest, macos-11, windows, windows-2019] 231 include: 232 - build: ubuntu 233 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 234 rust: nightly 235 - build: ubuntu-20.04 236 os: ubuntu-20.04 237 rust: nightly 238 - build: i686-linux 239 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 240 rust: nightly 241 target: i686-unknown-linux-gnu 242 gcc_package: gcc-i686-linux-gnu 243 gcc: i686-linux-gnu-gcc 244 libc_package: libc-dev-i386-cross 245 - build: aarch64-linux 246 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 247 rust: nightly 248 target: aarch64-unknown-linux-gnu 249 gcc_package: gcc-aarch64-linux-gnu 250 gcc: aarch64-linux-gnu-gcc 251 qemu: qemu-aarch64 252 qemu_args: -L /usr/aarch64-linux-gnu 253 qemu_target: aarch64-linux-user 254 - build: powerpc64le-linux 255 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 256 rust: nightly 257 target: powerpc64le-unknown-linux-gnu 258 gcc_package: gcc-powerpc64le-linux-gnu 259 gcc: powerpc64le-linux-gnu-gcc 260 qemu: qemu-ppc64le 261 qemu_args: -L /usr/powerpc64le-linux-gnu 262 qemu_target: ppc64le-linux-user 263 - build: s390x-linux 264 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 265 rust: nightly 266 target: s390x-unknown-linux-gnu 267 gcc_package: gcc-s390x-linux-gnu 268 gcc: s390x-linux-gnu-gcc 269 qemu: qemu-s390x 270 qemu_args: -L /usr/s390x-linux-gnu 271 qemu_target: s390x-linux-user 272 - build: arm-linux 273 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 274 rust: nightly 275 target: armv5te-unknown-linux-gnueabi 276 gcc_package: gcc-arm-linux-gnueabi 277 gcc: arm-linux-gnueabi-gcc 278 qemu: qemu-arm 279 qemu_args: -L /usr/arm-linux-gnueabi 280 qemu_target: arm-linux-user 281 - build: ubuntu-stable 282 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 283 rust: stable 284 - build: i686-linux-stable 285 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 286 rust: stable 287 target: i686-unknown-linux-gnu 288 gcc_package: gcc-i686-linux-gnu 289 gcc: i686-linux-gnu-gcc 290 libc_package: libc-dev-i386-cross 291 - build: aarch64-linux-stable 292 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 293 rust: stable 294 target: aarch64-unknown-linux-gnu 295 gcc_package: gcc-aarch64-linux-gnu 296 gcc: aarch64-linux-gnu-gcc 297 qemu: qemu-aarch64 298 qemu_args: -L /usr/aarch64-linux-gnu 299 qemu_target: aarch64-linux-user 300 - build: s390x-linux-stable 301 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 302 rust: stable 303 target: s390x-unknown-linux-gnu 304 gcc_package: gcc-s390x-linux-gnu 305 gcc: s390x-linux-gnu-gcc 306 qemu: qemu-s390x 307 qemu_args: -L /usr/s390x-linux-gnu 308 qemu_target: s390x-linux-user 309 - build: powerpc64le-linux-stable 310 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 311 rust: stable 312 target: powerpc64le-unknown-linux-gnu 313 gcc_package: gcc-powerpc64le-linux-gnu 314 gcc: powerpc64le-linux-gnu-gcc 315 qemu: qemu-ppc64le 316 qemu_args: -L /usr/powerpc64le-linux-gnu 317 qemu_target: ppc64le-linux-user 318 - build: arm-linux-stable 319 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 320 rust: stable 321 target: armv5te-unknown-linux-gnueabi 322 gcc_package: gcc-arm-linux-gnueabi 323 gcc: arm-linux-gnueabi-gcc 324 qemu: qemu-arm 325 qemu_args: -L /usr/arm-linux-gnueabi 326 qemu_target: arm-linux-user 327 - build: ubuntu-1.48 328 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 329 rust: 1.48 330 - build: i686-linux-1.48 331 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 332 rust: 1.48 333 target: i686-unknown-linux-gnu 334 gcc_package: gcc-i686-linux-gnu 335 gcc: i686-linux-gnu-gcc 336 libc_package: libc-dev-i386-cross 337 - build: aarch64-linux-1.48 338 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 339 rust: 1.48 340 target: aarch64-unknown-linux-gnu 341 gcc_package: gcc-aarch64-linux-gnu 342 gcc: aarch64-linux-gnu-gcc 343 qemu: qemu-aarch64 344 qemu_args: -L /usr/aarch64-linux-gnu 345 qemu_target: aarch64-linux-user 346 - build: s390x-linux-1.48 347 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 348 rust: 1.48 349 target: s390x-unknown-linux-gnu 350 gcc_package: gcc-s390x-linux-gnu 351 gcc: s390x-linux-gnu-gcc 352 qemu: qemu-s390x 353 qemu_args: -L /usr/s390x-linux-gnu 354 qemu_target: s390x-linux-user 355 - build: powerpc64le-linux-1.48 356 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 357 rust: 1.48 358 target: powerpc64le-unknown-linux-gnu 359 gcc_package: gcc-powerpc64le-linux-gnu 360 gcc: powerpc64le-linux-gnu-gcc 361 qemu: qemu-ppc64le 362 qemu_args: -L /usr/powerpc64le-linux-gnu 363 qemu_target: ppc64le-linux-user 364 - build: arm-linux-1.48 365 os: ubuntu-20.04 # TODO: remove pin when fixed (#483) 366 rust: 1.48 367 target: armv5te-unknown-linux-gnueabi 368 gcc_package: gcc-arm-linux-gnueabi 369 gcc: arm-linux-gnueabi-gcc 370 qemu: qemu-arm 371 qemu_args: -L /usr/arm-linux-gnueabi 372 qemu_target: arm-linux-user 373 - build: macos-latest 374 os: macos-latest 375 rust: stable 376 - build: macos-11 377 os: macos-11 378 rust: stable 379 - build: windows 380 os: windows-latest 381 rust: nightly 382 - build: windows-2019 383 os: windows-2019 384 rust: nightly 385 steps: 386 - uses: actions/checkout@v3 387 with: 388 submodules: true 389 - uses: ./.github/actions/install-rust 390 with: 391 toolchain: ${{ matrix.rust }} 392 393 - name: Configure Cargo target 394 run: | 395 echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV 396 rustup target add ${{ matrix.target }} 397 if: matrix.target != '' 398 399 - uses: actions/cache@v3 400 with: 401 path: ${{ runner.tool_cache }}/qemu 402 key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched 403 if: matrix.target != '' && matrix.os == 'ubuntu-20.04' # TODO: remove pin when fixed (#483) 404 405 - name: Install cross-compilation tools 406 run: | 407 set -ex 408 sudo apt-get update 409 sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build 410 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 411 echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV 412 if: matrix.gcc_package != '' && matrix.os == 'ubuntu-20.04' # TODO: remove pin when fixed (#483) 413 414 - name: Install cross-compilation libraries 415 run: | 416 set -ex 417 sudo apt-get update 418 sudo apt-get install -y ${{ matrix.libc_package }} 419 if: matrix.libc_package != '' && matrix.os == 'ubuntu-20.04' # TODO: remove pin when fixed (#483) 420 421 - name: Install qemu 422 run: | 423 set -ex 424 425 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 426 echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV 427 428 # Download and build qemu from source since the most recent release is 429 # way faster at arm emulation than the current version github actions' 430 # ubuntu image uses. Disable as much as we can to get it to build 431 # quickly. 432 cd 433 curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - 434 cd qemu-$QEMU_BUILD_VERSION 435 patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch 436 patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch 437 patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch 438 ./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs 439 ninja -C build install 440 if: matrix.qemu != '' && matrix.os == 'ubuntu-20.04' # TODO: remove pin when fixed (#483) 441 442 - name: Use specific dependency versions for Rust 1.48 compatibility. 443 if: matrix.rust == '1.48' 444 run: | 445 cargo update --package=once_cell --precise 1.14.0 446 cargo update --package=tempfile --precise=3.4.0 447 cargo update --package=io-lifetimes --precise 1.0.6 448 cargo update --package=flate2 --precise=1.0.25 449 for crate in test-crates/*; do 450 cd $crate 451 cargo update --package=io-lifetimes --precise 1.0.6 452 cd - >/dev/null 453 done 454 cargo update --package=tempfile --precise=3.6.0 455 456 - run: | 457 # Run the tests, and check the prebuilt release libraries. 458 cargo test --verbose --features=all-impls,all-apis,cc --release --workspace -- --nocapture 459 env: 460 RUST_BACKTRACE: full 461 if: matrix.rust != '1.48' 462 463 - run: | 464 # Run the tests with Rust 1.48, and check the prebuilt release libraries. 465 # Don't use all-impls because some of the impls have dependencies that 466 # don't support Rust 1.48. 467 cargo test --verbose --features=fs-err,all-apis,cc --release --workspace -- --nocapture 468 env: 469 RUST_BACKTRACE: full 470 if: matrix.rust == '1.48' 471 472 - run: | 473 # Check the prebuilt debug libraries too. 474 cargo check --features=all-impls,all-apis,cc 475 env: 476 RUST_BACKTRACE: full 477 if: matrix.rust != '1.48' 478 479 - run: | 480 # Check the prebuilt debug libraries with Rust 1.48 too. 481 # Don't use all-impls because some of the impls have dependencies that 482 # don't support Rust 1.48. 483 cargo check --features=fs-err,all-apis,cc 484 env: 485 RUST_BACKTRACE: full 486 if: matrix.rust == '1.48' 487 488 test_use_libc: 489 name: Test use-libc 490 runs-on: ${{ matrix.os }} 491 strategy: 492 matrix: 493 build: [ubuntu, i686-linux, aarch64-linux, powerpc64le-linux, arm-linux] 494 include: 495 - build: ubuntu 496 os: ubuntu-latest 497 rust: stable 498 - build: i686-linux 499 os: ubuntu-latest 500 rust: stable 501 target: i686-unknown-linux-gnu 502 gcc_package: gcc-i686-linux-gnu 503 gcc: i686-linux-gnu-gcc 504 libc_package: libc-dev-i386-cross 505 - build: aarch64-linux 506 os: ubuntu-latest 507 rust: stable 508 target: aarch64-unknown-linux-gnu 509 gcc_package: gcc-aarch64-linux-gnu 510 gcc: aarch64-linux-gnu-gcc 511 qemu: qemu-aarch64 512 qemu_args: -L /usr/aarch64-linux-gnu 513 qemu_target: aarch64-linux-user 514 - build: powerpc64le-linux 515 os: ubuntu-latest 516 rust: stable 517 target: powerpc64le-unknown-linux-gnu 518 gcc_package: gcc-powerpc64le-linux-gnu 519 gcc: powerpc64le-linux-gnu-gcc 520 qemu: qemu-ppc64le 521 qemu_args: -L /usr/powerpc64le-linux-gnu 522 qemu_target: ppc64le-linux-user 523 - build: arm-linux 524 os: ubuntu-latest 525 rust: stable 526 target: armv7-unknown-linux-gnueabihf 527 gcc_package: gcc-arm-linux-gnueabihf 528 gcc: arm-linux-gnueabihf-gcc 529 qemu: qemu-arm 530 qemu_args: -L /usr/arm-linux-gnueabihf 531 qemu_target: arm-linux-user 532 env: 533 # -D warnings is commented out in our install-rust action; re-add it here. 534 RUSTFLAGS: -D warnings 535 QEMU_BUILD_VERSION: 7.0.0 536 steps: 537 - uses: actions/checkout@v3 538 with: 539 submodules: true 540 - uses: ./.github/actions/install-rust 541 with: 542 toolchain: ${{ matrix.rust }} 543 544 - name: Configure Cargo target 545 run: | 546 echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV 547 rustup target add ${{ matrix.target }} 548 if: matrix.target != '' 549 550 - uses: actions/cache@v3 551 with: 552 path: ${{ runner.tool_cache }}/qemu 553 key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched 554 if: matrix.target != '' && matrix.os == 'ubuntu-latest' 555 556 - name: Install cross-compilation tools 557 run: | 558 set -ex 559 sudo apt-get update 560 sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build 561 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 562 echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV 563 if: matrix.gcc_package != '' && matrix.os == 'ubuntu-latest' 564 565 - name: Install cross-compilation libraries 566 run: | 567 set -ex 568 sudo apt-get update 569 sudo apt-get install -y ${{ matrix.libc_package }} 570 if: matrix.libc_package != '' && matrix.os == 'ubuntu-latest' 571 572 - name: Install qemu 573 run: | 574 set -ex 575 576 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 577 echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV 578 579 # Download and build qemu from source since the most recent release is 580 # way faster at arm emulation than the current version github actions' 581 # ubuntu image uses. Disable as much as we can to get it to build 582 # quickly. 583 cd 584 curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - 585 cd qemu-$QEMU_BUILD_VERSION 586 patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch 587 patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch 588 patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch 589 ./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs 590 ninja -C build install 591 if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' 592 593 - run: | 594 cargo test --verbose --features=use-libc,all-impls,all-apis --release --workspace -- --nocapture 595 env: 596 RUST_BACKTRACE: full 597 598 test_rustix_use_experimental_asm: 599 name: Test rustix_use_experimental_asm 600 runs-on: ${{ matrix.os }} 601 strategy: 602 matrix: 603 build: [powerpc64le-linux] 604 include: 605 - build: powerpc64le-linux 606 os: ubuntu-latest 607 rust: nightly 608 target: powerpc64le-unknown-linux-gnu 609 gcc_package: gcc-powerpc64le-linux-gnu 610 gcc: powerpc64le-linux-gnu-gcc 611 qemu: qemu-ppc64le 612 qemu_args: -L /usr/powerpc64le-linux-gnu 613 qemu_target: ppc64le-linux-user 614 env: 615 # -D warnings is commented out in our install-rust action; re-add it here. 616 RUSTFLAGS: --cfg rustix_use_experimental_asm -D warnings 617 RUSTDOCFLAGS: --cfg rustix_use_experimental_asm 618 CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUSTFLAGS: --cfg rustix_use_experimental_asm 619 QEMU_BUILD_VERSION: 7.0.0 620 steps: 621 - uses: actions/checkout@v3 622 with: 623 submodules: true 624 - uses: ./.github/actions/install-rust 625 with: 626 toolchain: ${{ matrix.rust }} 627 628 - name: Configure Cargo target 629 run: | 630 echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV 631 rustup target add ${{ matrix.target }} 632 if: matrix.target != '' 633 634 - uses: actions/cache@v3 635 with: 636 path: ${{ runner.tool_cache }}/qemu 637 key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched 638 if: matrix.target != '' && matrix.os == 'ubuntu-latest' 639 640 - name: Install cross-compilation tools 641 run: | 642 set -ex 643 sudo apt-get update 644 sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build 645 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 646 echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV 647 if: matrix.gcc_package != '' && matrix.os == 'ubuntu-latest' 648 649 - name: Install cross-compilation libraries 650 run: | 651 set -ex 652 sudo apt-get update 653 sudo apt-get install -y ${{ matrix.libc_package }} 654 if: matrix.libc_package != '' && matrix.os == 'ubuntu-latest' 655 656 - name: Install qemu 657 run: | 658 set -ex 659 660 upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') 661 echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV 662 663 # Download and build qemu from source since the most recent release is 664 # way faster at arm emulation than the current version github actions' 665 # ubuntu image uses. Disable as much as we can to get it to build 666 # quickly. 667 cd 668 curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - 669 cd qemu-$QEMU_BUILD_VERSION 670 patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch 671 patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch 672 patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch 673 ./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs 674 ninja -C build install 675 if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' 676 677 - run: | 678 cargo test --verbose --features=all-impls,all-apis --release --workspace -- --nocapture 679 env: 680 RUST_BACKTRACE: full 681