Files
idevice/.github/workflows/ci.yml
2025-08-12 10:06:06 -06:00

242 lines
6.7 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
jobs:
macos:
name: macOS Build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- 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 && 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
- name: Install build dependencies
run: |
sudo apt-get update && sudo apt-get install -y build-essential cmake
- 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
# 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 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-c-examples-windows
path: ffi\examples\build\bin\*
- 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