Add GNU/Hurd support #3334
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@v3 | |
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.48] | |
include: | |
- build: stable | |
os: ubuntu-latest | |
rust: stable | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
- build: 1.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
env: | |
# -D warnings is commented out in our install-rust action; re-add it here. | |
# In theory we should add --cfg criterion here, but criterion doesn't compile under Rust 1.48. | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: ${{ matrix.rust }} | |
- 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.48' | |
run: rustup target add x86_64-unknown-fuchsia | |
- if: matrix.rust == '1.48' | |
run: rustup target add x86_64-fuchsia | |
- name: Install cross-compilation tools | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu gcc-arm-linux-gnueabi musl-tools | |
- name: Use specific dependency versions for Rust 1.48 compatibility. | |
if: matrix.rust == '1.48' | |
run: | | |
cargo update --package=once_cell --precise 1.14.0 | |
cargo update --package=flate2 --precise=1.0.25 | |
cargo update --package=tempfile --precise=3.6.0 | |
- 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 --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.48' | |
run: cargo check --workspace --release -vv --target=x86_64-unknown-fuchsia --features=all-apis --all-targets | |
- if: matrix.rust == '1.48' | |
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=aarch64-unknown-linux-gnu --features=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 | |
# Omit --all-targets for WASI until all the dev-dependencies support WASI | |
# on stable. | |
- if: matrix.rust != '1.48' | |
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 | |
steps: | |
- uses: actions/checkout@v3 | |
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 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@v3 | |
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@v3 | |
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 | |
# Omit --all-targets on gnu_ilp32 because dev-dependency tempfile depends on an older rustix | |
- run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --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 | |
# x86_64-uwp-windows-msvc isn't currently working. | |
#- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
env: | |
QEMU_BUILD_VERSION: 7.0.0 | |
strategy: | |
matrix: | |
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, ubuntu-1.48, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.48, i686-linux-1.48, aarch64-linux-1.48, riscv64-linux-1.48, s390x-linux-1.48, powerpc64le-linux-1.48, arm-linux-1.48, macos-latest, macos-11, windows, windows-2019] | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
- build: i686-linux-1.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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.48 | |
os: ubuntu-latest | |
rust: 1.48 | |
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-11 | |
os: macos-11 | |
rust: stable | |
- build: windows | |
os: windows-latest | |
rust: nightly | |
- build: windows-2019 | |
os: windows-2019 | |
rust: nightly | |
steps: | |
- uses: actions/checkout@v3 | |
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@v3 | |
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 | |
./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.48 compatibility. | |
if: matrix.rust == '1.48' | |
run: | | |
cargo update --package=once_cell --precise 1.14.0 | |
cargo update --package=flate2 --precise=1.0.25 | |
cargo update --package=tempfile --precise=3.6.0 | |
- run: | | |
# Run the tests, and check the prebuilt release libraries. | |
cargo test --verbose --features=all-impls,all-apis,cc --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
MACOSX_SDK_VERSION: 10.7 | |
if: matrix.rust != '1.48' | |
- run: | | |
# Run the tests with Rust 1.48, and check the prebuilt release libraries. | |
# Don't use all-impls because some of the impls have dependencies that | |
# don't support Rust 1.48. | |
cargo test --verbose --features=fs-err,all-apis,cc --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
MACOSX_SDK_VERSION: 10.7 | |
if: matrix.rust == '1.48' | |
- run: | | |
# Check the prebuilt debug libraries too. | |
cargo check --features=all-impls,all-apis,cc | |
env: | |
RUST_BACKTRACE: full | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
MACOSX_SDK_VERSION: 10.7 | |
if: matrix.rust != '1.48' | |
- run: | | |
# Check the prebuilt debug libraries with Rust 1.48 too. | |
# Don't use all-impls because some of the impls have dependencies that | |
# don't support Rust 1.48. | |
cargo check --features=fs-err,all-apis,cc | |
env: | |
RUST_BACKTRACE: full | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
MACOSX_SDK_VERSION: 10.7 | |
if: matrix.rust == '1.48' | |
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 | |
QEMU_BUILD_VERSION: 7.0.0 | |
steps: | |
- uses: actions/checkout@v3 | |
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@v3 | |
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 | |
./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-impls,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 | |
RUSTDOCFLAGS: --cfg rustix_use_experimental_asm | |
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUSTFLAGS: --cfg rustix_use_experimental_asm | |
QEMU_BUILD_VERSION: 7.0.0 | |
steps: | |
- uses: actions/checkout@v3 | |
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@v3 | |
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 | |
./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-impls,all-apis --release --workspace -- --nocapture | |
env: | |
RUST_BACKTRACE: full |