|
| 1 | +--- |
| 2 | + name: deploy |
| 3 | + |
| 4 | + on: |
| 5 | + push: |
| 6 | + branches: [master] |
| 7 | + pull_request: |
| 8 | + branches: [master] |
| 9 | + |
| 10 | + # Cancel old builds when pushing new commits. |
| 11 | + concurrency: |
| 12 | + group: deploy-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | + jobs: |
| 16 | + linux: |
| 17 | + name: Linux |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + arch: [aarch64, x86_64] |
| 21 | + runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - name: Cache built binaries |
| 26 | + id: cache |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + _build |
| 31 | + _git |
| 32 | + _install |
| 33 | + key: ${{ github.job }}-${{ matrix.arch }} |
| 34 | + - name: Install dependencies |
| 35 | + if: steps.cache.outputs.cache-hit != 'true' |
| 36 | + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends |
| 37 | + yasm |
| 38 | + - name: Build binaries |
| 39 | + run: | |
| 40 | + if [ -d _install/host ]; then |
| 41 | + echo "Not rebuilding dependencies" |
| 42 | + touch _install/host/.stamp |
| 43 | + touch _install/host/*.stamp |
| 44 | + fi |
| 45 | + scripts/build-host -j "$(nproc)" \ |
| 46 | + lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h \ |
| 47 | + lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h \ |
| 48 | + lib/src/main/cpp/ToxCrypto/generated/im_tox_tox4j_impl_jni_ToxCryptoJni.h |
| 49 | + - name: Build host tools tarball |
| 50 | + run: tar -zcf _install/host.tar.gz _install/host |
| 51 | + - name: Upload artifact |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: ${{ github.job }}-${{ matrix.arch }} |
| 55 | + path: _install/host.tar.gz |
| 56 | + if-no-files-found: error |
| 57 | + |
| 58 | + android: |
| 59 | + name: Android |
| 60 | + needs: [linux] |
| 61 | + strategy: |
| 62 | + matrix: |
| 63 | + abi: [arm64-v8a, armeabi-v7a, x86_64, x86] |
| 64 | + runs-on: ubuntu-24.04 |
| 65 | + steps: |
| 66 | + - name: Checkout code |
| 67 | + uses: actions/checkout@v4 |
| 68 | + - name: Download artifact |
| 69 | + uses: actions/download-artifact@v4 |
| 70 | + with: |
| 71 | + name: linux-x86_64 |
| 72 | + - name: Extract artifact |
| 73 | + run: | |
| 74 | + tar -zxf host.tar.gz |
| 75 | + rm host.tar.gz |
| 76 | + - name: Cache built binaries |
| 77 | + id: cache |
| 78 | + uses: actions/cache@v4 |
| 79 | + with: |
| 80 | + path: | |
| 81 | + _git |
| 82 | + _install |
| 83 | + key: ${{ github.job }}-${{ matrix.abi }} |
| 84 | + - name: Install dependencies |
| 85 | + if: steps.cache.outputs.cache-hit != 'true' |
| 86 | + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends |
| 87 | + yasm |
| 88 | + - name: Build Android JNI |
| 89 | + run: | |
| 90 | + if [ -d _install/*android* ]; then |
| 91 | + echo "Not rebuilding dependencies" |
| 92 | + touch _install/*android*/.stamp |
| 93 | + touch _install/*android*/*.stamp |
| 94 | + fi |
| 95 | + scripts/build-android.sh ${{ matrix.abi }} -j "$(nproc)" |
| 96 | +
|
| 97 | + macos: |
| 98 | + name: macOS |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + arch: [arm64, x86_64] |
| 102 | + runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }} |
| 103 | + steps: |
| 104 | + - name: Checkout code |
| 105 | + uses: actions/checkout@v4 |
| 106 | + - name: Cache built binaries |
| 107 | + id: cache |
| 108 | + uses: actions/cache@v4 |
| 109 | + with: |
| 110 | + path: | |
| 111 | + _build |
| 112 | + _git |
| 113 | + _install |
| 114 | + key: ${{ github.job }}-${{ matrix.arch }} |
| 115 | + - name: Install dependencies |
| 116 | + if: steps.cache.outputs.cache-hit != 'true' |
| 117 | + run: brew install autoconf automake libtool yasm |
| 118 | + - name: Build binaries |
| 119 | + run: | |
| 120 | + if [ -d _install/host ]; then |
| 121 | + echo "Not rebuilding dependencies" |
| 122 | + touch _install/host/.stamp |
| 123 | + touch _install/host/*.stamp |
| 124 | + fi |
| 125 | + scripts/build-host -j "$(sysctl -n hw.logicalcpu)" |
| 126 | + - name: Upload artifact |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: ${{ github.job }}-${{ matrix.arch }} |
| 130 | + path: _install/host |
| 131 | + if-no-files-found: error |
0 commit comments