Skip to content

Commit 30385ce

Browse files
authored
ci: add openharmony ci (#103)
1 parent aab6d91 commit 30385ce

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

.github/workflows/rust.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,38 @@ jobs:
8080
cargo lipo --verbose --all-features --features="async tokio/rt-multi-thread"
8181
- name: Abort on error
8282
if: ${{ failure() }}
83-
run: echo "iOs build job failed" && false
83+
run: echo "iOS build job failed" && false
84+
85+
build_n_test_openharmony:
86+
strategy:
87+
matrix:
88+
target: [aarch64-unknown-linux-ohos, armv7-unknown-linux-ohos, x86_64-unknown-linux-ohos]
89+
fail-fast: false
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- uses: actions/checkout@v4
94+
- uses: openharmony-rs/[email protected]
95+
id: setup-ohos
96+
with:
97+
version: "5.0"
98+
- name: Install ohrs and rust compiler for ohos target
99+
if: ${{ !cancelled() }}
100+
run: |
101+
cargo install --locked ohrs
102+
rustup target add ${{ matrix.target }}
103+
- name: fmt & clippy
104+
if: ${{ !cancelled() }}
105+
run: |
106+
ohrs cargo --disable-target -- fmt --all -- --check
107+
ohrs cargo --disable-target -- clippy --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings
108+
- name: Build
109+
if: ${{ !cancelled() }}
110+
run: |
111+
ohrs cargo --disable-target -- rustc --target ${{matrix.target}} --verbose --all-features --features="async tokio/rt-multi-thread" --lib --crate-type=cdylib
112+
- name: Abort on error
113+
if: ${{ failure() }}
114+
run: echo "OpenHarmony build job failed" && false
84115

85116
semver:
86117
name: Check semver

src/platform/posix/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
//! POSIX compliant support.
1616
1717
mod sockaddr;
18-
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
19-
pub(crate) use sockaddr::sockaddr_union;
20-
21-
#[cfg(any(target_os = "linux", target_os = "macos"))]
22-
pub(crate) use sockaddr::ipaddr_to_sockaddr;
18+
#[allow(unused_imports)]
19+
pub(crate) use sockaddr::{ipaddr_to_sockaddr, sockaddr_union};
2320

2421
mod fd;
2522
pub(crate) use self::fd::Fd;

src/platform/posix/sockaddr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn rs_addr_to_sockaddr(addr: std::net::SocketAddr) -> sockaddr_union {
6060

6161
/// # Safety
6262
/// Fill the `addr` with the `src_addr` and `src_port`, the `size` should be the size of overwriting
63-
#[cfg(any(target_os = "linux", target_os = "macos"))]
63+
#[allow(dead_code)]
6464
pub(crate) unsafe fn ipaddr_to_sockaddr<T>(
6565
src_addr: T,
6666
src_port: u16,

0 commit comments

Comments
 (0)