feat(ci): add windows + macos build (#105)
* feat(ci): add windows + macos build
This commit is contained in:
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[target.aarch64-apple-darwin]
|
||||
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
|
||||
10
.github/workflows/rust-build.yml
vendored
10
.github/workflows/rust-build.yml
vendored
@@ -10,9 +10,13 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
name: "build-release"
|
||||
runs-on: ubuntu-latest
|
||||
build:
|
||||
name: "Build on ${{ matrix.os }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build project
|
||||
|
||||
73
.github/workflows/rust-release.yml
vendored
73
.github/workflows/rust-release.yml
vendored
@@ -4,46 +4,101 @@ on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
release-linux:
|
||||
name: Linux - Build and Publish
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Set up Rust"
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: "Install dependencies"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y rpm
|
||||
cargo install cargo-deb
|
||||
cargo install cargo-generate-rpm
|
||||
|
||||
- name: "Publish crates"
|
||||
- name: Publish crates
|
||||
run: |
|
||||
cargo publish -p adb_client --token ${CRATES_IO_TOKEN}
|
||||
cargo publish -p adb_cli --token ${CRATES_IO_TOKEN}
|
||||
env:
|
||||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
|
||||
- name: "build-release"
|
||||
- name: Build release
|
||||
run: cargo build --all-features --release
|
||||
|
||||
- name: "Build DEB package"
|
||||
- name: Rename binary
|
||||
run: mv target/release/adb_cli target/release/adb_cli-linux
|
||||
|
||||
- name: Build DEB package
|
||||
run: cargo deb -p adb_cli
|
||||
|
||||
- name: "Build RPM package"
|
||||
- name: Build RPM package
|
||||
run: cargo generate-rpm -p adb_cli
|
||||
|
||||
- name: "Publish GitHub artefacts"
|
||||
- name: Upload Linux artifacts
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
target/debian/*.deb
|
||||
target/generate-rpm/*.rpm
|
||||
target/release/adb_cli
|
||||
target/release/adb_cli-linux
|
||||
|
||||
release-macos:
|
||||
name: macOS - Build Binary
|
||||
runs-on: macos-13
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Build release
|
||||
run: cargo build --all-features --release
|
||||
|
||||
- name: Rename binary
|
||||
run: mv target/release/adb_cli target/release/adb_cli-macos
|
||||
|
||||
- name: Upload macOS binary
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: target/release/adb_cli-macos
|
||||
|
||||
release-windows:
|
||||
name: Windows - Build Binary
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Build release
|
||||
run: cargo build --all-features --release
|
||||
|
||||
- name: Rename binary
|
||||
run: Rename-Item -Path target/release/adb_cli.exe -NewName adb_cli-windows.exe
|
||||
|
||||
- name: Upload Windows binary
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: target/release/adb_cli-windows.exe
|
||||
|
||||
@@ -10,7 +10,10 @@ mod utils;
|
||||
use adb_client::{
|
||||
ADBDeviceExt, ADBServer, ADBServerDevice, ADBTcpDevice, ADBUSBDevice, MDNSDiscoveryService,
|
||||
};
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
use adb_termios::ADBTermios;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use handlers::{handle_emulator_commands, handle_host_commands, handle_local_commands};
|
||||
@@ -104,7 +107,7 @@ fn main() -> Result<()> {
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
{
|
||||
device.shell(std::io::stdin(), std::io::stdout())?;
|
||||
device.shell(&mut std::io::stdin(), Box::new(std::io::stdout()))?;
|
||||
}
|
||||
} else {
|
||||
let commands: Vec<&str> = commands.iter().map(|v| v.as_str()).collect();
|
||||
|
||||
@@ -21,7 +21,7 @@ name = "stub_gen"
|
||||
[dependencies]
|
||||
adb_client = { path = "../adb_client" }
|
||||
anyhow = { version = "1.0.95" }
|
||||
pyo3 = { version = "0.23.4", features = [
|
||||
pyo3 = { version = "0.24.1", features = [
|
||||
"abi3-py37",
|
||||
"anyhow",
|
||||
"extension-module",
|
||||
|
||||
Reference in New Issue
Block a user