| 6 | branches: |
| 7 | - dev |
| 8 | paths-ignore: |
| 9 | - '**.md' |
| 10 | - '.github/**' |
| 11 |
| 12 | jobs: |
| 13 | ffmpeg: |
| 14 | name: Native Build (FFmpeg) |
| 15 | runs-on: ndk21 |
| 16 | steps: |
| 17 | - name: Checkout |
| 18 | uses: actions/checkout@v4 |
| 19 | - name: Fetch Status |
| 20 | run: | |
| 21 | sed -i 's/\/\///g' settings.gradle |
| 22 |
| 23 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 24 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 25 | - name: FFmpeg Cache |
| 26 | id: cache |
| 27 | uses: actions/cache@v4 |
| 28 | with: |
| 29 | path: | |
| 30 | TMessagesProj/jni/ffmpeg/build |
| 31 | TMessagesProj/jni/libvpx/build |
| 32 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 33 | - name: Set up Python 3.12 |
| 34 | uses: actions/setup-python@v5 |
| 35 | if: steps.cache.outputs.cache-hit != 'true' |
| 36 | with: |
| 37 | python-version: '3.12' |
| 38 | - name: Install NDK |
| 39 | if: steps.cache.outputs.cache-hit != 'true' |
| 40 | run: | |
| 41 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 42 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 43 | - name: Native Build |
| 44 | if: steps.cache.outputs.cache-hit != 'true' |
| 45 | run: | |
| 46 | ./run init action ffmpeg |
| 47 | ./run init libs libvpx |
| 48 | ./run init libs ffmpeg |
| 49 | boringssl: |
| 50 | name: Native Build (BoringSSL) |
| 51 | runs-on: ndk21 |
| 52 | steps: |
| 53 | - name: Checkout |
| 54 | uses: actions/checkout@v4 |
| 55 | - name: Fetch Status |
| 56 | run: | |
| 57 | sed -i 's/\/\///g' settings.gradle |
| 58 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 59 | - name: BoringSSL Cache |
| 60 | id: cache |
| 61 | uses: actions/cache@v4 |
| 62 | with: |
| 63 | path: | |
| 64 | TMessagesProj/jni/boringssl/build |
| 65 | key: ${{ hashFiles('boringssl_status') }} |
| 66 | - name: Install NDK |
| 67 | if: steps.cache.outputs.cache-hit != 'true' |
| 68 | run: | |
| 69 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 70 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 71 | - name: Native Build |
| 72 | if: steps.cache.outputs.cache-hit != 'true' |
| 73 | run: | |
| 74 | apt install golang -y |
| 75 | ./run init action boringssl |
| 76 | ./run init libs boringssl |
| 77 | native: |
| 78 | name: Native Build (Telegram) |
| 79 | runs-on: ndk21 |
| 80 | needs: |
| 81 | - ffmpeg |
| 82 | - boringssl |
| 83 | strategy: |
| 84 | matrix: |
| 85 | flavor: |
| 86 | - armeabi-v7a |
| 87 | - arm64-v8a |
| 88 | steps: |
| 89 | - name: Checkout |
| 90 | uses: actions/checkout@v4 |
| 91 | - name: Fetch Status |
| 92 | run: | |
| 93 | sed -i 's/\/\///g' settings.gradle |
| 94 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 95 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 96 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 97 | - name: Native Cache |
| 98 | id: cache |
| 99 | uses: actions/cache@v4 |
| 100 | with: |
| 101 | path: | |
| 102 | TMessagesProj/src/main/libs |
| 103 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 104 | - name: Checkout Library |
| 105 | if: steps.cache.outputs.cache-hit != 'true' |
| 106 | run: | |
| 107 | git submodule update --init 'TMessagesProj/jni/*' |
| 108 | - name: FFmpeg Cache |
| 109 | uses: actions/cache@v4 |
| 110 | if: steps.cache.outputs.cache-hit != 'true' |
| 111 | with: |
| 112 | path: | |
| 113 | TMessagesProj/jni/ffmpeg/build |
| 114 | TMessagesProj/jni/libvpx/build |
| 115 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 116 | - name: BoringSSL Cache |
| 117 | uses: actions/cache@v4 |
| 118 | if: steps.cache.outputs.cache-hit != 'true' |
| 119 | with: |
| 120 | path: | |
| 121 | TMessagesProj/jni/boringssl/build |
| 122 | key: ${{ hashFiles('boringssl_status') }} |
| 123 | - name: Install NDK |
| 124 | if: steps.cache.outputs.cache-hit != 'true' |
| 125 | run: | |
| 126 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 127 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 128 | - name: Fix BoringSSL |
| 129 | if: steps.cache.outputs.cache-hit != 'true' |
| 130 | run: | |
| 131 | cd TMessagesProj/jni |
| 132 | ./patch_boringssl.sh |
| 133 | - name: Native Build |
| 134 | if: steps.cache.outputs.cache-hit != 'true' |
| 135 | run: | |
| 136 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 137 | ./run libs native |
| 138 | build: |
| 139 | name: Gradle Build |
| 140 | runs-on: ndk21 |
| 141 | needs: |
| 142 | - native |
| 143 | steps: |
| 144 | - name: Checkout |
| 145 | uses: actions/checkout@v4 |
| 146 | - name: Install NDK |
| 147 | run: | |
| 148 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 149 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 150 | - name: Fetch Status |
| 151 | run: | |
| 152 | sed -i 's/\/\///g' settings.gradle |
| 153 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 154 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 155 | - name: Native Cache (armeabi-v7a) |
| 156 | uses: actions/cache@v4 |
| 157 | with: |
| 158 | path: | |
| 159 | TMessagesProj/src/main/libs |
| 160 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 161 | - name: Native Cache (arm64-v8a) |
| 162 | uses: actions/cache@v4 |
| 163 | with: |
| 164 | path: | |
| 165 | TMessagesProj/src/main/libs |
| 166 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 167 | - name: Configure Gradle |
| 168 | run: | |
| 169 | sed -i -e "s/16384/6144/g" gradle.properties |
| 170 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 171 | - name: Gradle cache |
| 172 | uses: actions/cache@v4 |
| 173 | with: |
| 174 | path: ~/.gradle |
| 175 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 176 | - name: Debug Build |
| 177 | run: | |
| 178 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 179 | ./gradlew TMessagesProj:assembleRelease |
| 180 |
| 181 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 182 | APK=$(dirname $APK) |
| 183 | echo "APK=$APK" >> $GITHUB_ENV |
| 184 | - uses: actions/upload-artifact@v3 |
| 185 | with: |
| 186 | name: Release |
| 187 | path: ${{ env.APK }} |
| 188 | upload: |
| 189 | name: Upload debug |
| 190 | if: github.event.inputs.upload != 'y' |
| 191 | runs-on: ndk21 |
| 192 | needs: |
| 193 | - build |
| 194 | steps: |
| 195 | - name: Checkout |
| 196 | uses: actions/checkout@v4 |
| 197 | - name: Donwload Artifacts |
| 198 | uses: actions/download-artifact@v3 |
| 199 | with: |
| 200 | path: artifacts |
| 201 | - name: Set up Python |
| 202 | uses: actions/setup-python@v5 |
| 203 | with: |
| 204 | python-version: 3.12 |
| 205 | - name: Send to Telegram |
| 206 | run: | |
| 207 | # send release via telegram bot api |
| 208 | export mini64=$(find artifacts -name "*arm64-v8a.apk") |
| 209 | export mini32=$(find artifacts -name "*armeabi-v7a.apk") |
| 210 |
| 211 | echo $mini64 |
| 212 | echo $mini32 |
| 213 |
| 214 | python -m pip install -r bin/scripts/requirements.txt |
| 215 | git log -1 --pretty=format:"%s%n%n%b" > artifacts/caption.txt |
| 216 | python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} test |
| 217 |