Skip to content

Commit

Permalink
ci: add android target (#640)
Browse files Browse the repository at this point in the history
* ci: add android target

* ci: use latest cross

* 更新 ci.yml

* 更新 ci.yml

* 更新 ci.yml

* up

* up

---------

Co-authored-by: dev0 <[email protected]>
  • Loading branch information
Itsusinn and ibigbug authored Nov 7, 2024
1 parent e47771c commit 67df0a6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ jobs:
cross: false
extra-args: -F "shadowsocks, tuic, onion"
rustflags: "-Ctarget-feature=+crt-static --cfg tokio_unstable"
# Android
- os: ubuntu-latest
target: aarch64-linux-android
cross: true
extra-args: -F "shadowsocks, tuic, onion"
- os: ubuntu-latest
target: armv7-linux-androideabi
cross: true
extra-args: -F "shadowsocks, tuic, onion"
- os: ubuntu-latest
target: x86_64-linux-android
cross: true
extra-args: -F "shadowsocks, tuic, onion"
- os: ubuntu-latest
target: i686-linux-android
cross: true
extra-args: -F "shadowsocks, tuic, onion"
# Linux mips: tier-3, pity
# Windows gnu: tokio dont work
# Windows aarch: todo
Expand Down Expand Up @@ -209,7 +226,11 @@ jobs:
toolchain: ${{ matrix.toolchain || 'nightly' }}
target: ${{ matrix.target }}
components: ${{ matrix.components || 'rustfmt, clippy' }}

- name: Install cross
if: ${{ matrix.cross }}
run: |
rm -f ~/.cargo/bin/cross*
cargo install cross --git https://github.com/cross-rs/cross
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand All @@ -231,7 +252,6 @@ jobs:
- name: Cargo fmt
uses: clechasseur/rs-cargo@v2
with:
use-cross: ${{ matrix.cross }}
command: fmt
args: --all -- --check
env:
Expand Down
4 changes: 2 additions & 2 deletions clash_lib/src/app/dns/resolver/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod enhanced;

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "android"))]
#[path = "system_linux.rs"]
mod system;
#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), not(target_os = "android")))]
#[path = "system_non_linux.rs"]
mod system;

Expand Down
4 changes: 2 additions & 2 deletions clash_lib/src/proxy/utils/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub async fn ping_pong_test(

let sess = Session {
destination: (
if cfg!(target_os = "linux") {
if cfg!(any(target_os = "linux", target_os = "android")) {
"127.0.0.1".to_owned()
} else {
"host.docker.internal".to_owned()
Expand Down Expand Up @@ -152,7 +152,7 @@ pub async fn ping_pong_udp_test(
.try_into()
.unwrap_or_else(|_| panic!(""));
let dst: SocksAddr = (
if cfg!(target_os = "linux") {
if cfg!(any(target_os = "linux", target_os = "android")) {
"127.0.0.1".to_owned()
} else {
"host.docker.internal".to_owned()
Expand Down

0 comments on commit 67df0a6

Please sign in to comment.