Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add support for loongarch64-unknown-linux-gnu #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 16 additions & 60 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
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]
channel: [1.70.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - ${{ matrix.target }} - ${{ matrix.channel }}
env:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
channel: [1.70.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - x86_64-pc-windows-gnu - ${{ matrix.channel }}
env:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
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: [1.70.0, stable, beta, nightly]
channel: [stable, beta, nightly]
features: ["--no-default-features", "--features system"]
runs-on: macos-latest
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
channel: [1.70.0, stable, beta, nightly]
features: ["--no-default-features", "--features system"]
target:
- x86_64-unknown-linux-gnu
Expand All @@ -139,6 +139,7 @@ jobs:
- armv7-unknown-linux-gnueabihf
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- loongarch64-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
Expand All @@ -154,14 +155,17 @@ jobs:
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
- target: loongarch64-unknown-linux-gnu
features: "--features system"
# 1.70.0 is too old for loongarch64-unknown-linux-gnu
- target: loongarch64-unknown-linux-gnu
channel: 1.70.0

runs-on: ubuntu-latest
name: Linux - ${{ matrix.channel }} ${{ matrix.features }} ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
TEST_RUNNER: cargo
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -177,63 +181,15 @@ jobs:
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 }}
run: |
cargo install cross --git https://github.com/cross-rs/cross --rev 7a2b4e408a5b61a61cf08d88e484d57be7af6cd4 --locked
echo "TEST_RUNNER=cross" >> $GITHUB_ENV
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}
${{ env.TEST_RUNNER }} test --target ${{ matrix.target }} ${{ matrix.features }}
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}
${{ env.TEST_RUNNER }} test --target ${{ matrix.target }} ${{ matrix.features }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ libffi = { version = "2.0.0", features = ["system"] }
See [the `libffi-sys` documentation] for more information about how it
finds C libffi.

This crate supports Rust version 1.48 and later.
This crate supports Rust version 1.70 and later.

### Examples

Expand Down
2 changes: 1 addition & 1 deletion libffi-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ libffi = { version = "3.2.0", features = ["system"] }
See [the `libffi-sys` documentation] for more information about how it
finds C libffi.

This crate supports Rust version 1.48 and later.
This crate supports Rust version 1.70 and later.

### Examples

Expand Down
2 changes: 1 addition & 1 deletion libffi-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! See [the `libffi-sys` documentation] for more information about how it
//! finds C libffi.
//!
//! This crate supports Rust version 1.48 and later.
//! This crate supports Rust version 1.70 and later.
//!
//! # Organization
//!
Expand Down
Loading