Skip to content

fix: open Termux app info page instead of Termux settings #71

fix: open Termux app info page instead of Termux settings

fix: open Termux app info page instead of Termux settings #71

Workflow file for this run

name: CI Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
desktop: ${{ steps.filter.outputs.desktop }}
android: ${{ steps.filter.outputs.android }}
ios: ${{ steps.filter.outputs.ios }}
version: ${{ steps.ver.outputs.version }}
sha: ${{ steps.sha.outputs.sha }}
steps:
- uses: actions/checkout@v4
- name: Get version
id: ver
run: echo "version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')" >> "$GITHUB_OUTPUT"
- name: Get short SHA
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'crates/hostsync-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
desktop:
- 'crates/hostsync-desktop/**'
android:
- 'mobile/android/**'
ios:
- 'mobile/ios/**'
test:
name: Test
needs: changes
if: needs.changes.outputs.core == 'true' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.android == 'true' || needs.changes.outputs.ios == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace
- run: cargo clippy --workspace -- -D warnings
build-desktop:
name: Desktop ${{ matrix.name }}
needs: [changes, test]
if: needs.changes.outputs.core == 'true' || needs.changes.outputs.desktop == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: hostsync
cross: false
- name: linux-arm64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: hostsync
cross: true
- name: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
artifact: hostsync.exe
cross: false
- name: windows-arm64
os: windows-latest
target: aarch64-pc-windows-msvc
artifact: hostsync.exe
cross: false
- name: macos-x64
os: macos-latest
target: x86_64-apple-darwin
artifact: hostsync
cross: false
- name: macos-arm64
os: macos-latest
target: aarch64-apple-darwin
artifact: hostsync
cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
- name: Build
run: cargo build --release --target ${{ matrix.target }} -p hostsync-desktop
- name: Strip (Unix)
if: runner.os != 'Windows' && !matrix.cross
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact }}
- name: Strip (Linux cross)
if: matrix.cross
run: aarch64-linux-gnu-strip target/${{ matrix.target }}/release/${{ matrix.artifact }}
- name: Create macOS .app bundle
if: runner.os == 'macOS'
run: |
APP="HostSync.app"
VER="${{ needs.changes.outputs.version }}"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp target/${{ matrix.target }}/release/${{ matrix.artifact }} "$APP/Contents/MacOS/hostsync"
sed "s/1.0.0/$VER/g" crates/hostsync-desktop/Info.plist > "$APP/Contents/Info.plist"
codesign --force --deep -s - "$APP"
- name: Create macOS .dmg
if: runner.os == 'macOS'
run: |
mkdir -p dmg-staging
cp -r HostSync.app dmg-staging/
ln -s /Applications dmg-staging/Applications
hdiutil create -volname "HostSync" -srcfolder dmg-staging -ov -format UDZO "HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}-${{ matrix.name }}.dmg"
- uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: hostsync-${{ matrix.name }}
path: HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}-${{ matrix.name }}.dmg
- uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: hostsync-${{ matrix.name }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact }}
- name: Package Windows installer
id: windows-installer
if: runner.os == 'Windows'
shell: pwsh
run: |
$Version = "${{ needs.changes.outputs.version }}"
cargo install cargo-packager --version 0.11.8 --locked
./scripts/package-windows-installer.ps1 `
-Version $Version `
-Target "${{ matrix.target }}" `
-OutDirSuffix "${{ matrix.name }}" `
-OutputName "HostSync-${Version}-${{ needs.changes.outputs.sha }}-${{ matrix.name }}-setup.exe"
- uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: hostsync-${{ matrix.name }}-installer
path: ${{ steps.windows-installer.outputs.installer_path }}
build-android:
name: Android APK
needs: [changes, test]
if: needs.changes.outputs.core == 'true' || needs.changes.outputs.android == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Build Rust .so for all Android ABIs
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android
- uses: Swatinem/rust-cache@v2
with:
key: android
- run: cargo install cargo-ndk
- name: Build Rust native libraries
run: cargo ndk -t arm64-v8a -t armeabi-v7a -t x86_64 -t x86 -o mobile/android/app/src/main/jniLibs build --release -p hostsync-core
# Build APK with Gradle
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build APK
working-directory: mobile/android
run: |
# Ensure debug keystore exists for signing
mkdir -p ~/.android
if [ ! -f ~/.android/debug.keystore ]; then
keytool -genkey -v -keystore ~/.android/debug.keystore \
-storepass android -alias androiddebugkey -keypass android \
-keyalg RSA -keysize 2048 -validity 10000 \
-dname "CN=Android Debug,O=Android,C=US"
fi
gradle assembleRelease --no-daemon
- name: Rename APK
run: |
mv mobile/android/app/build/outputs/apk/release/app-release.apk HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}.apk 2>/dev/null || \
mv mobile/android/app/build/outputs/apk/release/app-release-unsigned.apk HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}.apk
- uses: actions/upload-artifact@v4
with:
name: android-apk
path: HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}.apk
build-ios:
name: iOS IPA
needs: [changes, test]
if: needs.changes.outputs.core == 'true' || needs.changes.outputs.ios == 'true'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
# Build Rust .a for iOS
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios
- uses: Swatinem/rust-cache@v2
with:
key: ios
- name: Build Rust static libraries
run: |
cargo build --release --target aarch64-apple-ios -p hostsync-core
cargo build --release --target aarch64-apple-ios-sim -p hostsync-core
cargo build --release --target x86_64-apple-ios -p hostsync-core
# Copy device .a into Xcode project directory
- name: Place static library
run: cp target/aarch64-apple-ios/release/libhostsync_core.a mobile/ios/
# Build with xcodebuild (no codesign)
- name: Build iOS app
working-directory: mobile/ios
run: |
xcodebuild -project HostSync.xcodeproj \
-scheme HostSync \
-configuration Release \
-sdk iphoneos \
-archivePath build/HostSync.xcarchive \
archive \
CODE_SIGN_IDENTITY="-" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
# Package IPA
- name: Create IPA
run: |
cd mobile/ios/build/HostSync.xcarchive/Products/Applications
mkdir Payload
cp -r HostSync.app Payload/
zip -r ../../../../HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}.ipa Payload
- uses: actions/upload-artifact@v4
with:
name: ios-ipa
path: mobile/ios/HostSync-${{ needs.changes.outputs.version }}-${{ needs.changes.outputs.sha }}.ipa
# Also upload universal sim lib for developers
- name: Create universal sim library
run: |
lipo -create \
target/aarch64-apple-ios-sim/release/libhostsync_core.a \
target/x86_64-apple-ios/release/libhostsync_core.a \
-output libhostsync_core-ios-sim-universal.a
- uses: actions/upload-artifact@v4
with:
name: ios-sim-universal
path: libhostsync_core-ios-sim-universal.a
pre-release:
name: Pre-release
needs: [changes, build-desktop, build-android, build-ios]
if: |
always() &&
github.event_name == 'push' && github.ref == 'refs/heads/main' &&
(needs.build-desktop.result == 'success' || needs.build-android.result == 'success' || needs.build-ios.result == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate tag
id: tag
run: echo "tag=nightly-$(date +'%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT"
- name: Package artifacts
env:
VER: ${{ needs.changes.outputs.version }}
SHA: ${{ needs.changes.outputs.sha }}
run: |
cd artifacts
for dir in hostsync-linux-*; do
[ -d "$dir" ] && chmod +x "$dir/hostsync" && tar czf "HostSync-${VER}-${SHA}-${dir#hostsync-}.tar.gz" -C "$dir" hostsync
done
- name: Create Pre-release
uses: softprops/action-gh-release@v2
env:
VER: ${{ needs.changes.outputs.version }}
SHA: ${{ needs.changes.outputs.sha }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: "Pre-release ${{ steps.tag.outputs.tag }}"
prerelease: true
generate_release_notes: true
files: |
artifacts/HostSync-${{ env.VER }}-${{ env.SHA }}-linux-x64.tar.gz
artifacts/HostSync-${{ env.VER }}-${{ env.SHA }}-linux-arm64.tar.gz
artifacts/hostsync-windows-x64-installer/HostSync-${{ env.VER }}-${{ env.SHA }}-windows-x64-setup.exe
artifacts/hostsync-windows-arm64-installer/HostSync-${{ env.VER }}-${{ env.SHA }}-windows-arm64-setup.exe
artifacts/hostsync-macos-x64/HostSync-${{ env.VER }}-${{ env.SHA }}-macos-x64.dmg
artifacts/hostsync-macos-arm64/HostSync-${{ env.VER }}-${{ env.SHA }}-macos-arm64.dmg
artifacts/android-apk/HostSync-${{ env.VER }}-${{ env.SHA }}.apk
artifacts/ios-ipa/HostSync-${{ env.VER }}-${{ env.SHA }}.ipa