Merge pull request #27 from flub/cross-fixes

Fix android build and add more CI
main
shellrow 2 years ago committed by GitHub
commit 4c48f345a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      .github/workflows/ci.yml
  2. 2
      src/interface/android.rs

@ -12,5 +12,53 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Run rustfmt - name: Run rustfmt
run: cargo fmt --all --check run: cargo fmt --all --check
check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@master
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- uses: swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check
cross:
name: Cross compile
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- i686-unknown-linux-gnu
- armv7-linux-androideabi
- aarch64-linux-android
steps:
- uses: actions/checkout@master
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- uses: swatinem/rust-cache@v2
- name: Install cross
run: cargo install cross
- name: Rust check
run: cross check --target ${{ matrix.target }}

@ -13,7 +13,7 @@ pub fn get_libc_ifaddrs() -> Option<(
fn load_symbol<T>(sym: &'static str) -> Option<T> { fn load_symbol<T>(sym: &'static str) -> Option<T> {
const LIB_NAME: &str = "libc.so"; const LIB_NAME: &str = "libc.so";
match dlopen::raw::Library::open(LIB_NAME) { match dlopen2::raw::Library::open(LIB_NAME) {
Ok(lib) => match unsafe { lib.symbol::<T>(sym) } { Ok(lib) => match unsafe { lib.symbol::<T>(sym) } {
Ok(val) => Some(val), Ok(val) => Some(val),
Err(err) => { Err(err) => {

Loading…
Cancel
Save