diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d0922862..97b3a4cd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -80,7 +80,38 @@ jobs: cargo lipo --verbose --all-features --features="async tokio/rt-multi-thread" - name: Abort on error if: ${{ failure() }} - run: echo "iOs build job failed" && false + run: echo "iOS build job failed" && false + + build_n_test_openharmony: + strategy: + matrix: + target: [aarch64-unknown-linux-ohos, armv7-unknown-linux-ohos, x86_64-unknown-linux-ohos] + fail-fast: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: openharmony-rs/setup-ohos-sdk@v0.1 + id: setup-ohos + with: + version: "5.0" + - name: Install ohrs and rust compiler for ohos target + if: ${{ !cancelled() }} + run: | + cargo install --locked ohrs + rustup target add ${{ matrix.target }} + - name: fmt & clippy + if: ${{ !cancelled() }} + run: | + ohrs cargo --disable-target -- fmt --all -- --check + ohrs cargo --disable-target -- clippy --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings + - name: Build + if: ${{ !cancelled() }} + run: | + ohrs cargo --disable-target -- rustc --target ${{matrix.target}} --verbose --all-features --features="async tokio/rt-multi-thread" --lib --crate-type=cdylib + - name: Abort on error + if: ${{ failure() }} + run: echo "OpenHarmony build job failed" && false semver: name: Check semver diff --git a/src/platform/posix/mod.rs b/src/platform/posix/mod.rs index 32cbaeb6..f943895c 100644 --- a/src/platform/posix/mod.rs +++ b/src/platform/posix/mod.rs @@ -15,11 +15,8 @@ //! POSIX compliant support. mod sockaddr; -#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))] -pub(crate) use sockaddr::sockaddr_union; - -#[cfg(any(target_os = "linux", target_os = "macos"))] -pub(crate) use sockaddr::ipaddr_to_sockaddr; +#[allow(unused_imports)] +pub(crate) use sockaddr::{ipaddr_to_sockaddr, sockaddr_union}; mod fd; pub(crate) use self::fd::Fd; diff --git a/src/platform/posix/sockaddr.rs b/src/platform/posix/sockaddr.rs index 625dc327..304f9819 100644 --- a/src/platform/posix/sockaddr.rs +++ b/src/platform/posix/sockaddr.rs @@ -60,7 +60,7 @@ fn rs_addr_to_sockaddr(addr: std::net::SocketAddr) -> sockaddr_union { /// # Safety /// Fill the `addr` with the `src_addr` and `src_port`, the `size` should be the size of overwriting -#[cfg(any(target_os = "linux", target_os = "macos"))] +#[allow(dead_code)] pub(crate) unsafe fn ipaddr_to_sockaddr( src_addr: T, src_port: u16,