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