Implement select
.
#4261
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: stable | |
- run: cargo fmt --all -- --check | |
check: | |
name: Check | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [stable, nightly, 1.63] | |
include: | |
- build: stable | |
os: ubuntu-latest | |
rust: stable | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
- build: 1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
env: | |
# -D warnings is commented out in our install-rust action; re-add it here. | |
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths --cfg criterion | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Use specific dependency versions for Rust 1.63 compatibility. | |
if: matrix.rust == '1.63' | |
run: | | |
cargo update --package=dashmap --precise 5.4.0 | |
cargo update --package=regex --precise=1.9.0 | |
cargo update --package=half --precise=2.2.1 | |
- run: > | |
rustup target add | |
x86_64-unknown-linux-musl | |
x86_64-unknown-linux-gnux32 | |
x86_64-linux-android | |
i686-linux-android | |
x86_64-apple-darwin | |
x86_64-unknown-freebsd | |
x86_64-unknown-netbsd | |
x86_64-unknown-illumos | |
i686-unknown-linux-gnu | |
i686-unknown-linux-musl | |
wasm32-unknown-emscripten | |
riscv64gc-unknown-linux-gnu | |
aarch64-unknown-linux-gnu | |
aarch64-unknown-linux-musl | |
powerpc64le-unknown-linux-gnu | |
armv5te-unknown-linux-gnueabi | |
s390x-unknown-linux-gnu | |
arm-linux-androideabi | |
sparc64-unknown-linux-gnu | |
sparcv9-sun-solaris | |
aarch64-linux-android | |
aarch64-apple-ios | |
wasm32-wasi | |
- if: matrix.rust != '1.63' | |
run: rustup target add x86_64-unknown-fuchsia | |
- if: matrix.rust == '1.63' | |
run: rustup target add x86_64-fuchsia | |
- run: cargo check --workspace --release -vv --all-targets | |
- run: cargo check --workspace --release -vv --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --features=use-libc,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --features=linux_latest,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-linux-android --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-musl --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-musl --features=use-libc,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-linux-gnux32 --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-linux-android --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=i686-linux-android --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-apple-darwin --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-freebsd --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-netbsd --features=all-apis --all-targets | |
- if: matrix.rust != '1.63' | |
run: cargo check --workspace --release -vv --target=x86_64-unknown-fuchsia --features=all-apis --all-targets | |
- if: matrix.rust == '1.63' | |
run: cargo check --workspace --release -vv --target=x86_64-fuchsia --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-illumos --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=i686-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=i686-unknown-linux-musl --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=i686-unknown-linux-musl --features=use-libc,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=wasm32-unknown-emscripten --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=riscv64gc-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=riscv64gc-unknown-linux-gnu --features=linux_latest,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-gnu --features=linux_latest,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-musl --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-unknown-linux-musl --features=use-libc,all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=powerpc64le-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=armv5te-unknown-linux-gnueabi --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=s390x-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=arm-linux-androideabi --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=sparc64-unknown-linux-gnu --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=sparcv9-sun-solaris --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-apple-ios --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=aarch64-linux-android --features=all-apis --all-targets | |
- run: cargo check --workspace --release -vv --target=wasm32-wasi --features=all-apis | |
check_no_default_features: | |
name: Check --no-default-features | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [nightly] | |
include: | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
env: | |
# -D warnings is commented out in our install-rust action; re-add it here. | |
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- run: cargo check --workspace --release --no-default-features -vv | |
- run: cargo check --workspace --release --no-default-features --features use-libc -vv | |
- run: cargo check --workspace --release --no-default-features --features all-apis -vv | |
- run: cargo check --workspace --release --no-default-features --features all-apis,use-libc -vv | |
- run: cargo check --workspace --release --no-default-features --features all-apis,alloc -vv | |
- run: cargo check --workspace --release --no-default-features --features all-apis,use-libc,alloc -vv | |
- run: cargo check --workspace --release --no-default-features --features time -vv | |
- run: cargo check --workspace --release --no-default-features --features time,use-libc -vv | |
- run: rustup component add rust-src | |
- run: cargo check --workspace --release --no-default-features --target=i686-unknown-linux-gnu -Zbuild-std -vv | |
check_nightly: | |
name: Check nightly-only targets | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [nightly] | |
include: | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- run: > | |
rustup target add | |
x86_64-unknown-redox | |
wasm32-wasi | |
thumbv7neon-unknown-linux-gnueabihf | |
- run: cargo check --workspace --release -vv --target=x86_64-unknown-redox --features=all-apis | |
- run: cargo check --workspace --release -vv --target=wasm32-wasi --features=all-apis | |
- run: cargo check --workspace --release -vv --target=thumbv7neon-unknown-linux-gnueabihf --features=all-apis | |
check_tier3: | |
name: Check selected Tier 3 platforms | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [nightly] | |
include: | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
env: | |
# See the comments in the libc crate | |
RUSTFLAGS: -A improper_ctypes_definitions --cfg criterion | |
- run: rustup component add rust-src | |
- run: cargo check -Z build-std --target x86_64-unknown-openbsd --all-targets --features=all-apis | |
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis | |
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis | |
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis | |
- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis | |
- run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --all-targets --features=all-apis | |
# Omit --all-targets on haiku because not all the tests build yet. | |
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis | |
- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis | |
# Temporarily disable riscv32imc-esp-espidf due to std using SOMAXCONN. | |
#- run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis | |
- run: cargo check -Z build-std --target=aarch64-unknown-nto-qnx710 --features=all-apis | |
- run: cargo check -Z build-std --target=x86_64-pc-nto-qnx710 --features=all-apis | |
# Temporarily disable --features=all-apis, which doesn't build yet. | |
- run: cargo check -Z build-std --target=armv6k-nintendo-3ds | |
# Temporarily disable armv7-sony-vita-newlibeabihf due to std using SOMAXCONN. | |
#- run: cargo check -Z build-std --target=armv7-sony-vita-newlibeabihf --features=all-apis | |
# `std` doesn't appear to build on AIX yet, so test in `no_std` mode. | |
- run: cargo check -Zbuild-std=core,alloc --target=powerpc64-ibm-aix --features=all-apis --no-default-features | |
- run: cargo check -Z build-std --target=mipsel-unknown-linux-gnu --features=all-apis | |
- run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis | |
- run: cargo check -Z build-std --target=powerpc64le-unknown-linux-musl --features=all-apis | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
env: | |
QEMU_BUILD_VERSION: 8.1.2 | |
# Enabling testing of experimental features. | |
RUSTFLAGS: --cfg rustix_use_experimental_features | |
strategy: | |
matrix: | |
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-12, windows, windows-2019, musl] | |
include: | |
- build: ubuntu | |
os: ubuntu-latest | |
rust: nightly | |
- build: ubuntu-20.04 | |
os: ubuntu-20.04 | |
rust: nightly | |
- build: i686-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: i686-unknown-linux-gnu | |
gcc_package: gcc-i686-linux-gnu | |
gcc: i686-linux-gnu-gcc | |
libc_package: libc-dev-i386-cross | |
- build: aarch64-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: aarch64-unknown-linux-gnu | |
gcc_package: gcc-aarch64-linux-gnu | |
gcc: aarch64-linux-gnu-gcc | |
qemu: qemu-aarch64 | |
qemu_args: -L /usr/aarch64-linux-gnu | |
qemu_target: aarch64-linux-user | |
- build: powerpc64le-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: powerpc64le-unknown-linux-gnu | |
gcc_package: gcc-powerpc64le-linux-gnu | |
gcc: powerpc64le-linux-gnu-gcc | |
qemu: qemu-ppc64le | |
qemu_args: -L /usr/powerpc64le-linux-gnu | |
qemu_target: ppc64le-linux-user | |
- build: riscv64-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: riscv64gc-unknown-linux-gnu | |
gcc_package: gcc-riscv64-linux-gnu | |
gcc: riscv64-linux-gnu-gcc | |
qemu: qemu-riscv64 | |
qemu_args: -L /usr/riscv64-linux-gnu | |
qemu_target: riscv64-linux-user | |
- build: s390x-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: s390x-unknown-linux-gnu | |
gcc_package: gcc-s390x-linux-gnu | |
gcc: s390x-linux-gnu-gcc | |
qemu: qemu-s390x | |
qemu_args: -L /usr/s390x-linux-gnu | |
qemu_target: s390x-linux-user | |
- build: arm-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: armv5te-unknown-linux-gnueabi | |
gcc_package: gcc-arm-linux-gnueabi | |
gcc: arm-linux-gnueabi-gcc | |
qemu: qemu-arm | |
qemu_args: -L /usr/arm-linux-gnueabi | |
qemu_target: arm-linux-user | |
- build: ubuntu-stable | |
os: ubuntu-latest | |
rust: stable | |
- build: i686-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: i686-unknown-linux-gnu | |
gcc_package: gcc-i686-linux-gnu | |
gcc: i686-linux-gnu-gcc | |
libc_package: libc-dev-i386-cross | |
- build: aarch64-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
gcc_package: gcc-aarch64-linux-gnu | |
gcc: aarch64-linux-gnu-gcc | |
qemu: qemu-aarch64 | |
qemu_args: -L /usr/aarch64-linux-gnu | |
qemu_target: aarch64-linux-user | |
- build: riscv64-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: riscv64gc-unknown-linux-gnu | |
gcc_package: gcc-riscv64-linux-gnu | |
gcc: riscv64-linux-gnu-gcc | |
qemu: qemu-riscv64 | |
qemu_args: -L /usr/riscv64-linux-gnu | |
qemu_target: riscv64-linux-user | |
- build: s390x-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: s390x-unknown-linux-gnu | |
gcc_package: gcc-s390x-linux-gnu | |
gcc: s390x-linux-gnu-gcc | |
qemu: qemu-s390x | |
qemu_args: -L /usr/s390x-linux-gnu | |
qemu_target: s390x-linux-user | |
- build: powerpc64le-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: powerpc64le-unknown-linux-gnu | |
gcc_package: gcc-powerpc64le-linux-gnu | |
gcc: powerpc64le-linux-gnu-gcc | |
qemu: qemu-ppc64le | |
qemu_args: -L /usr/powerpc64le-linux-gnu | |
qemu_target: ppc64le-linux-user | |
- build: arm-linux-stable | |
os: ubuntu-latest | |
rust: stable | |
target: armv5te-unknown-linux-gnueabi | |
gcc_package: gcc-arm-linux-gnueabi | |
gcc: arm-linux-gnueabi-gcc | |
qemu: qemu-arm | |
qemu_args: -L /usr/arm-linux-gnueabi | |
qemu_target: arm-linux-user | |
- build: ubuntu-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
- build: i686-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: i686-unknown-linux-gnu | |
gcc_package: gcc-i686-linux-gnu | |
gcc: i686-linux-gnu-gcc | |
libc_package: libc-dev-i386-cross | |
- build: aarch64-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: aarch64-unknown-linux-gnu | |
gcc_package: gcc-aarch64-linux-gnu | |
gcc: aarch64-linux-gnu-gcc | |
qemu: qemu-aarch64 | |
qemu_args: -L /usr/aarch64-linux-gnu | |
qemu_target: aarch64-linux-user | |
- build: riscv64-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: riscv64gc-unknown-linux-gnu | |
gcc_package: gcc-riscv64-linux-gnu | |
gcc: riscv64-linux-gnu-gcc | |
qemu: qemu-riscv64 | |
qemu_args: -L /usr/riscv64-linux-gnu | |
qemu_target: riscv64-linux-user | |
- build: s390x-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: s390x-unknown-linux-gnu | |
gcc_package: gcc-s390x-linux-gnu | |
gcc: s390x-linux-gnu-gcc | |
qemu: qemu-s390x | |
qemu_args: -L /usr/s390x-linux-gnu | |
qemu_target: s390x-linux-user | |
- build: powerpc64le-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: powerpc64le-unknown-linux-gnu | |
gcc_package: gcc-powerpc64le-linux-gnu | |
gcc: powerpc64le-linux-gnu-gcc | |
qemu: qemu-ppc64le | |
qemu_args: -L /usr/powerpc64le-linux-gnu | |
qemu_target: ppc64le-linux-user | |
- build: arm-linux-1.63 | |
os: ubuntu-latest | |
rust: 1.63 | |
target: armv5te-unknown-linux-gnueabi | |
gcc_package: gcc-arm-linux-gnueabi | |
gcc: arm-linux-gnueabi-gcc | |
qemu: qemu-arm | |
qemu_args: -L /usr/arm-linux-gnueabi | |
qemu_target: arm-linux-user | |
- build: macos-latest | |
os: macos-latest | |
rust: stable | |
- build: macos-12 | |
os: macos-12 | |
rust: stable | |
- build: windows | |
os: windows-latest | |
rust: nightly | |
- build: windows-2019 | |
os: windows-2019 | |
rust: nightly | |
- build: musl | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Configure Cargo target | |
run: | | |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV | |
rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ runner.tool_cache }}/qemu | |
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched | |
if: matrix.target != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation tools | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV | |
if: matrix.gcc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation libraries | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.libc_package }} | |
if: matrix.libc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install qemu | |
run: | | |
set -ex | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV | |
# See if qemu is already in the cache | |
if [ -f ${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ]; then | |
exit 0 | |
fi | |
# Download and build qemu from source since the most recent release is | |
# way faster at arm emulation than the current version github actions' | |
# ubuntu image uses. Disable as much as we can to get it to build | |
# quickly. | |
cd | |
curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - | |
cd qemu-$QEMU_BUILD_VERSION | |
patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/aarch64-o-largefile.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tcgets2-tcsets2.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tiocgsid.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/more-sockopts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/pidfd-open.patch | |
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs | |
ninja -C build install | |
if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' | |
- name: Use specific dependency versions for Rust 1.63 compatibility. | |
if: matrix.rust == '1.63' | |
run: | | |
cargo update --package=dashmap --precise 5.4.0 | |
cargo update --package=regex --precise=1.9.0 | |
cargo update --package=half --precise=2.2.1 | |
- run: | | |
cargo test --verbose --features=all-apis --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
MACOSX_SDK_VERSION: 10.7 | |
test_use_libc: | |
name: Test use-libc | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [ubuntu, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, arm-linux] | |
include: | |
- build: ubuntu | |
os: ubuntu-latest | |
rust: stable | |
- build: i686-linux | |
os: ubuntu-latest | |
rust: stable | |
target: i686-unknown-linux-gnu | |
gcc_package: gcc-i686-linux-gnu | |
gcc: i686-linux-gnu-gcc | |
libc_package: libc-dev-i386-cross | |
- build: aarch64-linux | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
gcc_package: gcc-aarch64-linux-gnu | |
gcc: aarch64-linux-gnu-gcc | |
qemu: qemu-aarch64 | |
qemu_args: -L /usr/aarch64-linux-gnu | |
qemu_target: aarch64-linux-user | |
- build: powerpc64le-linux | |
os: ubuntu-latest | |
rust: stable | |
target: powerpc64le-unknown-linux-gnu | |
gcc_package: gcc-powerpc64le-linux-gnu | |
gcc: powerpc64le-linux-gnu-gcc | |
qemu: qemu-ppc64le | |
qemu_args: -L /usr/powerpc64le-linux-gnu | |
qemu_target: ppc64le-linux-user | |
- build: riscv64-linux | |
os: ubuntu-latest | |
rust: stable | |
target: riscv64gc-unknown-linux-gnu | |
gcc_package: gcc-riscv64-linux-gnu | |
gcc: riscv64-linux-gnu-gcc | |
qemu: qemu-riscv64 | |
qemu_args: -L /usr/riscv64-linux-gnu | |
qemu_target: riscv64-linux-user | |
- build: arm-linux | |
os: ubuntu-latest | |
rust: stable | |
target: armv7-unknown-linux-gnueabihf | |
gcc_package: gcc-arm-linux-gnueabihf | |
gcc: arm-linux-gnueabihf-gcc | |
qemu: qemu-arm | |
qemu_args: -L /usr/arm-linux-gnueabihf | |
qemu_target: arm-linux-user | |
env: | |
# -D warnings is commented out in our install-rust action; re-add it here. | |
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths | |
QEMU_BUILD_VERSION: 8.1.2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Configure Cargo target | |
run: | | |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV | |
rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ runner.tool_cache }}/qemu | |
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched | |
if: matrix.target != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation tools | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV | |
if: matrix.gcc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation libraries | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.libc_package }} | |
if: matrix.libc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install qemu | |
run: | | |
set -ex | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV | |
# See if qemu is already in the cache | |
if [ -f ${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ]; then | |
exit 0 | |
fi | |
# Download and build qemu from source since the most recent release is | |
# way faster at arm emulation than the current version github actions' | |
# ubuntu image uses. Disable as much as we can to get it to build | |
# quickly. | |
cd | |
curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - | |
cd qemu-$QEMU_BUILD_VERSION | |
patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/aarch64-o-largefile.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tcgets2-tcsets2.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tiocgsid.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/more-sockopts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/pidfd-open.patch | |
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs | |
ninja -C build install | |
if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' | |
- run: | | |
cargo test --verbose --features=use-libc,all-apis --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full | |
test_rustix_use_experimental_asm: | |
name: Test rustix_use_experimental_asm | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [powerpc64le-linux] | |
include: | |
- build: powerpc64le-linux | |
os: ubuntu-latest | |
rust: nightly | |
target: powerpc64le-unknown-linux-gnu | |
gcc_package: gcc-powerpc64le-linux-gnu | |
gcc: powerpc64le-linux-gnu-gcc | |
qemu: qemu-ppc64le | |
qemu_args: -L /usr/powerpc64le-linux-gnu | |
qemu_target: ppc64le-linux-user | |
env: | |
# -D warnings is commented out in our install-rust action; re-add it here. | |
RUSTFLAGS: --cfg rustix_use_experimental_asm -D warnings -D elided-lifetimes-in-paths | |
RUSTDOCFLAGS: --cfg rustix_use_experimental_asm | |
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUSTFLAGS: --cfg rustix_use_experimental_asm | |
QEMU_BUILD_VERSION: 8.1.2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Configure Cargo target | |
run: | | |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV | |
rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ runner.tool_cache }}/qemu | |
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched | |
if: matrix.target != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation tools | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV | |
if: matrix.gcc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation libraries | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.libc_package }} | |
if: matrix.libc_package != '' && matrix.os == 'ubuntu-latest' | |
- name: Install qemu | |
run: | | |
set -ex | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ${{ matrix.qemu_args }} >> $GITHUB_ENV | |
# See if qemu is already in the cache | |
if [ -f ${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} ]; then | |
exit 0 | |
fi | |
# Download and build qemu from source since the most recent release is | |
# way faster at arm emulation than the current version github actions' | |
# ubuntu image uses. Disable as much as we can to get it to build | |
# quickly. | |
cd | |
curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - | |
cd qemu-$QEMU_BUILD_VERSION | |
patch -p1 < $GITHUB_WORKSPACE/ci/translate-errno.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/getsockopt-timeouts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/aarch64-o-largefile.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tcgets2-tcsets2.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/tiocgsid.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/more-sockopts.patch | |
patch -p1 < $GITHUB_WORKSPACE/ci/pidfd-open.patch | |
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs | |
ninja -C build install | |
if: matrix.qemu != '' && matrix.os == 'ubuntu-latest' | |
- run: | | |
cargo test --verbose --features=all-apis --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full |