mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-05-17 20:20:34 +00:00
294 lines
8.2 KiB
YAML
294 lines
8.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
tags: ['v*.*.*']
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
macos:
|
|
name: macOS Build
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: "true"
|
|
|
|
- name: Install just
|
|
run: |
|
|
brew install just
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: macos-cargo-${{ hashFiles('**/Cargo.lock', 'justfile') }}
|
|
restore-keys: macos-cargo-
|
|
|
|
- name: Install rustup targets
|
|
run: |
|
|
rustup target add aarch64-apple-ios && \
|
|
rustup target add x86_64-apple-ios && \
|
|
rustup target add aarch64-apple-ios-sim && \
|
|
rustup target add aarch64-apple-darwin && \
|
|
rustup target add x86_64-apple-darwin && \
|
|
rustup target add aarch64-apple-ios-macabi && \
|
|
rustup target add x86_64-apple-ios-macabi && \
|
|
cargo install --force --locked bindgen-cli
|
|
|
|
- name: Build all Apple targets and examples/tools
|
|
run: |
|
|
just macos-ci-check
|
|
|
|
- name: Upload static libraries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libidevice-macos-a
|
|
path: |
|
|
target/*apple*/release/libidevice_ffi.a
|
|
|
|
- name: Upload macOS+iOS XCFramework
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-xcframework
|
|
path: swift/bundle.zip
|
|
|
|
- name: Upload C examples/tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-c-examples-macos
|
|
path: ffi/examples/build/bin/*
|
|
|
|
- name: Upload C++ examples/tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-cpp-examples-macos
|
|
path: cpp/examples/build/bin/*
|
|
|
|
- name: Stage Rust tools (arm64)
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist/arm64
|
|
find target/release -maxdepth 1 -type f -exec sh -c '
|
|
for f in "$@"; do
|
|
if file "$f" | grep -Eq "Mach-O .* executable|ELF .* executable"; then
|
|
cp "$f" dist/arm64/
|
|
fi
|
|
done
|
|
' sh {} +
|
|
|
|
- name: Upload Rust tools (arm64)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-tools-macos-arm
|
|
path: dist/arm64/*
|
|
if-no-files-found: error
|
|
|
|
- name: Stage Rust tools (x64)
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist/x64
|
|
find target/x86_64-apple-darwin/release -maxdepth 1 -type f -exec sh -c '
|
|
for f in "$@"; do
|
|
if file "$f" | grep -Eq "Mach-O .* executable|ELF .* executable"; then
|
|
cp "$f" dist/x64/
|
|
fi
|
|
done
|
|
' sh {} +
|
|
|
|
- name: Upload Rust tools (x64)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-tools-macos-intel
|
|
path: dist/x64/*
|
|
if-no-files-found: error
|
|
|
|
linux:
|
|
name: Linux Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: "true"
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y \
|
|
build-essential \
|
|
cmake \
|
|
libavahi-client-dev \
|
|
libavahi-common-dev \
|
|
pkg-config
|
|
|
|
- name: Install just
|
|
run: |
|
|
curl -sL https://just.systems/install.sh | bash -s -- --to ~/.cargo/bin
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: linux-cargo-${{ hashFiles('**/Cargo.lock', 'justfile') }}
|
|
restore-keys: linux-cargo-
|
|
|
|
- name: Build Rust and examples/tools
|
|
run: |
|
|
just ci-check
|
|
|
|
- name: Upload static library
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libidevice-linux-a
|
|
path: target/release/libidevice_ffi.a
|
|
|
|
- name: Upload headers
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-headers
|
|
path: ffi/idevice.h
|
|
|
|
- name: Upload C examples/tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-c-examples-linux
|
|
path: ffi/examples/build/bin/*
|
|
|
|
- name: Upload C++ examples/tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-cpp-examples-linux
|
|
path: cpp/examples/build/bin/*
|
|
|
|
- name: Stage Rust tools (linux)
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
find target/release -maxdepth 1 -type f -exec sh -c '
|
|
for f in "$@"; do
|
|
if file "$f" | grep -Eq "ELF .* executable"; then
|
|
cp "$f" dist/
|
|
fi
|
|
done
|
|
' sh {} +
|
|
|
|
- name: Upload Rust tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-tools-linux
|
|
path: dist/*
|
|
if-no-files-found: error
|
|
|
|
windows:
|
|
name: Windows Build
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: "true"
|
|
|
|
# Install Rust (adds cargo/rustc to PATH)
|
|
- name: Install Rust (stable)
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
|
|
# Use Scoop to install just (reuse your existing scoop setup)
|
|
- uses: MinoruSekine/setup-scoop@v4.0.2
|
|
with:
|
|
buckets: main extras
|
|
apps: just doxygen plantuml
|
|
|
|
# (Paranoid) ensure shims and cargo bin are on PATH for subsequent steps
|
|
- name: Ensure tools on PATH
|
|
shell: pwsh
|
|
run: |
|
|
echo "$env:USERPROFILE\scoop\shims" >> $env:GITHUB_PATH
|
|
echo "$env:USERPROFILE\.cargo\bin" >> $env:GITHUB_PATH
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~\AppData\Local\cargo\registry
|
|
~\AppData\Local\cargo\git
|
|
target
|
|
key: windows-cargo-${{ hashFiles('**/Cargo.lock', 'justfile') }}
|
|
restore-keys: windows-cargo-
|
|
|
|
- name: Build Rust and examples/tools
|
|
run: just windows-ci-check
|
|
|
|
- name: Upload static library
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libidevice-windows-a
|
|
path: target\release\idevice_ffi.lib
|
|
|
|
- name: Upload C++ examples/tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-cpp-examples-windows
|
|
path: cpp\examples\build\bin\*
|
|
|
|
- name: Stage Rust tools (windows)
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path dist | Out-Null
|
|
Get-ChildItem target\release\*.exe -File | Copy-Item -Destination dist
|
|
|
|
- name: Upload Rust tools
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: idevice-tools-windows
|
|
path: dist\*.exe
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
name: Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [macos, linux, windows]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Download tool artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
pattern: idevice-tools-*
|
|
|
|
- name: Download xcframework
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: idevice-xcframework
|
|
path: artifacts/idevice-xcframework
|
|
|
|
- name: Package release archives
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p release
|
|
tag="${GITHUB_REF_NAME}"
|
|
for dir in artifacts/idevice-tools-*; do
|
|
name="$(basename "$dir")"
|
|
(cd "$dir" && zip -r "${GITHUB_WORKSPACE}/release/${name}-${tag}.zip" .)
|
|
done
|
|
cp artifacts/idevice-xcframework/bundle.zip "release/idevice-xcframework-${tag}.zip"
|
|
ls -la release
|
|
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: release/*
|
|
fail_on_unmatched_files: true
|
|
generate_release_notes: true
|