Skip to content

Merge pull request #87 from chenx97/libffi-sys/arch-mips-support #199

Merge pull request #87 from chenx97/libffi-sys/arch-mips-support

Merge pull request #87 from chenx97/libffi-sys/arch-mips-support #199

Workflow file for this run

name: Build & Test
on: [push, pull_request]
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
windows-msvc:
strategy:
fail-fast: false
matrix:
toolchain: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc]
channel: [1.48.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - ${{ matrix.target }} - ${{ matrix.channel }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test
windows-gnu:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - x86_64-pc-windows-gnu - ${{ matrix.channel }}
env:
RUST_BACKTRACE: 1
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
release: false
path-type: inherit
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-x86_64-pc-windows-gnu
target: x86_64-pc-windows-gnu
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
shell: msys2 {0}
run: |
cd libffi-sys-rs
cargo test
- name: Test libffi-rs
shell: msys2 {0}
run: |
cd libffi-rs
cargo test
macos:
strategy:
fail-fast: false
matrix:
# rust < 1.54 does not work on macos >= 12:
# https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20How.20can.20I.20fix.20Rust.201.2E53.2E0.20or.20earlier.20to.20run.20on.20macOS.2012.2E6.3F/near/299263887
# channel: [1.48.0, stable, beta, nightly]
channel: [stable, beta, nightly]
features: ["--no-default-features", "--features system"]
runs-on: macos-latest
name: macOS - ${{ matrix.channel }} ${{ matrix.features }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: brew install autoconf automake libtool libffi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-x86_64-apple-darwin
target: x86_64-apple-darwin
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test ${{ matrix.features }}
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test ${{ matrix.features }}
linux:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
features: ["--no-default-features", "--features system"]
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
exclude:
# Don't try to build with `--features system` when cross-compiling
# It's probably possible to make this work for some of these architectures
# (e.g. I got it working on my Ubuntu image for i686), but it complicates
# testing a bit
- target: i686-unknown-linux-gnu
features: "--features system"
- target: aarch64-unknown-linux-gnu
features: "--features system"
- target: armv7-unknown-linux-gnueabihf
features: "--features system"
- target: riscv64gc-unknown-linux-gnu
features: "--features system"
- target: s390x-unknown-linux-gnu
features: "--features system"
# 1.48.0 is too old for riscv64gc-unknown-linux-gnu
- target: riscv64gc-unknown-linux-gnu
channel: 1.48.0
runs-on: ubuntu-latest
name: Linux - ${{ matrix.channel }} ${{ matrix.features }} ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}
target: ${{ matrix.target }}
override: true
profile: minimal
default: true
- name: Set-up Cross Compiling
id: arch_attrs
run: |
# Get unique attributes for each architecture
if [ "${{ matrix.target }}" == "i686-unknown-linux-gnu" ]; then
GCC_ARCH=i686
ABI=gnu
elif [ "${{ matrix.target }}" == "powerpc64-unknown-linux-gnu" ]; then
GCC_ARCH=powerpc64
QEMU_ARCH=ppc64
ABI=gnu
elif [ "${{ matrix.target }}" == "powerpc64le-unknown-linux-gnu" ]; then
GCC_ARCH=powerpc64le
QEMU_ARCH=ppc64le
ABI=gnu
elif [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
GCC_ARCH=aarch64
QEMU_ARCH=aarch64
ABI=gnu
elif [ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]; then
GCC_ARCH=arm
QEMU_ARCH=arm
ABI=gnueabihf
elif [ "${{ matrix.target }}" == "riscv64gc-unknown-linux-gnu" ]; then
GCC_ARCH=riscv64
QEMU_ARCH=riscv64
ABI=gnu
elif [ "${{ matrix.target }}" == "s390x-unknown-linux-gnu" ]; then
GCC_ARCH=s390x
QEMU_ARCH=s390x
ABI=gnu
fi
# Install cross-compiler
sudo apt-get update
sudo apt-get install -y \
gcc-9-$(echo $GCC_ARCH | tr _ -)-linux-$ABI
# Convert target triple to uppercase and replace - with _
TARGET_TRIPLE=$(echo "${{ matrix.target }}" | tr - _)
TARGET_TRIPLE=${TARGET_TRIPLE^^}
CC=$GCC_ARCH-linux-$ABI-gcc-9
# Set cross-compiler as CC and set cargo target runner as qemu
echo "CC=$CC" >> $GITHUB_ENV
echo "CARGO_TARGET_${TARGET_TRIPLE}_LINKER=$CC" >> $GITHUB_ENV
# Don't need QEMU for i686
if [ "$QEMU_ARCH" != "" ]; then
sudo apt-get install -y qemu-user
echo "CARGO_TARGET_${TARGET_TRIPLE}_RUNNER=qemu-$QEMU_ARCH -L /usr/$GCC_ARCH-linux-$ABI/" >> $GITHUB_ENV
fi
if: ${{ 'x86_64-unknown-linux-gnu' != matrix.target }}
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}