Skip to content

chore: Add native library deploy workflow. #59

chore: Add native library deploy workflow.

chore: Add native library deploy workflow. #59

Workflow file for this run

---
name: deploy
on:
push:
branches: [master]
pull_request:
branches: [master]
# Cancel old builds when pushing new commits.
concurrency:
group: deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux:
name: Linux
strategy:
matrix:
arch: [aarch64, x86_64]
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache built binaries
id: cache
uses: actions/cache@v4
with:
path: |
_build
_git
_install
key: ${{ github.job }}-${{ matrix.arch }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends
yasm
- name: Build binaries
run: |
if [ -d _install/host ]; then
echo "Not rebuilding dependencies"
touch _install/host/.stamp
touch _install/host/*.stamp
fi
scripts/build-host -j "$(nproc)" \
lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h \
lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h \
lib/src/main/cpp/ToxCrypto/generated/im_tox_tox4j_impl_jni_ToxCryptoJni.h
- name: Build host tools tarball
run: tar -zcf _install/host.tar.gz _install/host
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.arch }}
path: _install/host.tar.gz
if-no-files-found: error
android:
name: Android
needs: [linux]
strategy:
matrix:
abi: [arm64-v8a, armeabi-v7a, x86_64, x86]
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: linux-x86_64
- name: Extract artifact
run: |
tar -zxf host.tar.gz
rm host.tar.gz
- name: Cache built binaries
id: cache
uses: actions/cache@v4
with:
path: |
_git
_install
key: ${{ github.job }}-${{ matrix.abi }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends
yasm
- name: Build Android JNI
run: |
if [ -d _install/*android* ]; then
echo "Not rebuilding dependencies"
touch _install/*android*/.stamp
touch _install/*android*/*.stamp
fi
scripts/build-android.sh ${{ matrix.abi }} -j "$(nproc)"
macos:
name: macOS
strategy:
matrix:
arch: [arm64, x86_64]
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache built binaries
id: cache
uses: actions/cache@v4
with:
path: |
_build
_git
_install
key: ${{ github.job }}-${{ matrix.arch }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: brew install autoconf automake libtool yasm
- name: Build binaries
run: |
if [ -d _install/host ]; then
echo "Not rebuilding dependencies"
touch _install/host/.stamp
touch _install/host/*.stamp
fi
scripts/build-host -j "$(sysctl -n hw.logicalcpu)"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.arch }}
path: _install/host
if-no-files-found: error