| branches: |
| 6 | - dev |
| 7 | paths-ignore: |
| 8 | - '**.md' |
| 9 | - '.github/**' |
| 10 | - '!.github/workflows/debug.yml' |
| 11 |
| 12 | jobs: |
| 13 | ffmpeg: |
| 14 | name: Native Build (FFmpeg) |
| 15 | runs-on: ubuntu-latest |
| 16 | steps: |
| 17 | - name: Checkout |
| 18 | uses: actions/checkout@v2 |
| 19 | - name: Fetch Status |
| 20 | run: | |
| 21 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 22 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 23 | - name: FFmpeg Cache |
| 24 | id: cache |
| 25 | uses: actions/cache@v2 |
| 26 | with: |
| 27 | path: | |
| 28 | TMessagesProj/jni/ffmpeg/build |
| 29 | TMessagesProj/jni/libvpx/build |
| 30 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 31 | - name: Setup Android SDK Tools |
| 32 | uses: android-actions/setup-android@v2 |
| 33 | if: steps.cache.outputs.cache-hit != 'true' |
| 34 | - name: Install NDK |
| 35 | if: steps.cache.outputs.cache-hit != 'true' |
| 36 | run: | |
| 37 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 38 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 39 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 40 | - name: Native Build |
| 41 | if: steps.cache.outputs.cache-hit != 'true' |
| 42 | run: | |
| 43 | sudo apt-get install yasm -y |
| 44 | ./run init libs libvpx |
| 45 | ./run init libs ffmpeg |
| 46 | boringssl: |
| 47 | name: Native Build (BoringSSL) |
| 48 | runs-on: ubuntu-latest |
| 49 | steps: |
| 50 | - name: Checkout |
| 51 | uses: actions/checkout@v2 |
| 52 | - name: Fetch Status |
| 53 | run: git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 54 | - name: BoringSSL Cache |
| 55 | id: cache |
| 56 | uses: actions/cache@v2 |
| 57 | with: |
| 58 | path: | |
| 59 | TMessagesProj/jni/boringssl/build |
| 60 | key: ${{ hashFiles('boringssl_status') }} |
| 61 | - name: Setup Android SDK Tools |
| 62 | uses: android-actions/setup-android@v2 |
| 63 | if: steps.cache.outputs.cache-hit != 'true' |
| 64 | - name: Install NDK |
| 65 | if: steps.cache.outputs.cache-hit != 'true' |
| 66 | run: | |
| 67 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 68 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 69 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 70 | - name: Native Build |
| 71 | if: steps.cache.outputs.cache-hit != 'true' |
| 72 | run: | |
| 73 | ./run init action boringssl |
| 74 | ./run init libs boringssl |
| 75 | native: |
| 76 | name: Native Build (Telegram) |
| 77 | runs-on: ubuntu-latest |
| 78 | needs: |
| 79 | - ffmpeg |
| 80 | - boringssl |
| 81 | strategy: |
| 82 | matrix: |
| 83 | flavor: |
| 84 | - armeabi-v7a |
| 85 | - arm64-v8a |
| 86 | steps: |
| 87 | - name: Checkout |
| 88 | uses: actions/checkout@v2 |
| 89 | - name: Fetch Status |
| 90 | run: | |
| 91 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 92 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 93 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 94 | - name: Native Cache |
| 95 | id: cache |
| 96 | uses: actions/cache@v2 |
| 97 | with: |
| 98 | path: | |
| 99 | TMessagesProj/src/main/libs |
| 100 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 101 | - name: Checkout Library |
| 102 | if: steps.cache.outputs.cache-hit != 'true' |
| 103 | run: | |
| 104 | git submodule update --init 'TMessagesProj/jni/*' |
| 105 | - name: FFmpeg Cache |
| 106 | uses: actions/cache@v2 |
| 107 | if: steps.cache.outputs.cache-hit != 'true' |
| 108 | with: |
| 109 | path: | |
| 110 | TMessagesProj/jni/ffmpeg/build |
| 111 | TMessagesProj/jni/libvpx/build |
| 112 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 113 | - name: BoringSSL Cache |
| 114 | uses: actions/cache@v2 |
| 115 | if: steps.cache.outputs.cache-hit != 'true' |
| 116 | with: |
| 117 | path: | |
| 118 | TMessagesProj/jni/boringssl/build |
| 119 | key: ${{ hashFiles('boringssl_status') }} |
| 120 | - name: Setup Android SDK Tools |
| 121 | uses: android-actions/setup-android@v2 |
| 122 | if: steps.cache.outputs.cache-hit != 'true' |
| 123 | - name: Install NDK |
| 124 | if: steps.cache.outputs.cache-hit != 'true' |
| 125 | run: | |
| 126 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 127 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 128 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 129 | - name: Fix BoringSSL |
| 130 | if: steps.cache.outputs.cache-hit != 'true' |
| 131 | run: | |
| 132 | cd TMessagesProj/jni |
| 133 | ./patch_boringssl.sh |
| 134 | - name: Native Build |
| 135 | if: steps.cache.outputs.cache-hit != 'true' |
| 136 | run: | |
| 137 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 138 | ./run libs native |
| 139 | v2ray: |
| 140 | name: Native Build (V2ray) |
| 141 | runs-on: ubuntu-latest |
| 142 | steps: |
| 143 | - name: Checkout |
| 144 | uses: actions/checkout@v2 |
| 145 | - name: Fetch Status |
| 146 | run: git submodule status v2ray > v2ray_status |
| 147 | - name: V2ray Cache |
| 148 | id: cache |
| 149 | uses: actions/cache@v2 |
| 150 | with: |
| 151 | path: | |
| 152 | TMessagesProj/libs/libv2ray.aar |
| 153 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 154 | - name: Setup Android SDK Tools |
| 155 | uses: android-actions/setup-android@v2 |
| 156 | if: steps.cache.outputs.cache-hit != 'true' |
| 157 | - name: Install NDK |
| 158 | if: steps.cache.outputs.cache-hit != 'true' |
| 159 | run: | |
| 160 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 161 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 162 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 163 | - name: Install Golang |
| 164 | uses: actions/setup-go@v2 |
| 165 | if: steps.cache.outputs.cache-hit != 'true' |
| 166 | with: |
| 167 | go-version: 1.16 |
| 168 | - name: Native Build |
| 169 | if: steps.cache.outputs.cache-hit != 'true' |
| 170 | run: ./run libs v2ray |
| 171 | build: |
| 172 | name: Gradle Build |
| 173 | runs-on: ubuntu-latest |
| 174 | if: ${{ !contains(github.event.head_commit.message, 'bump version') }} |
| 175 | needs: |
| 176 | - native |
| 177 | - v2ray |
| 178 | steps: |
| 179 | - name: Checkout |
| 180 | uses: actions/checkout@v2 |
| 181 | - name: Setup Android SDK Tools |
| 182 | uses: android-actions/setup-android@v2 |
| 183 | - name: Fetch Status |
| 184 | run: | |
| 185 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 186 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 187 | git submodule status v2ray > v2ray_status |
| 188 | - name: Native Cache (armeabi-v7a) |
| 189 | uses: actions/cache@v2 |
| 190 | with: |
| 191 | path: | |
| 192 | TMessagesProj/src/main/libs |
| 193 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 194 | - name: Native Cache (arm64-v8a) |
| 195 | uses: actions/cache@v2 |
| 196 | with: |
| 197 | path: | |
| 198 | TMessagesProj/src/main/libs |
| 199 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 200 | - name: V2ray Cache |
| 201 | uses: actions/cache@v2 |
| 202 | with: |
| 203 | path: | |
| 204 | TMessagesProj/libs/libv2ray.aar |
| 205 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 206 | - name: Configure Gradle |
| 207 | run: | |
| 208 | sed -i -e "s/16384/6144/g" gradle.properties |
| 209 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 210 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 211 | - name: Gradle cache |
| 212 | uses: actions/cache@v2 |
| 213 | with: |
| 214 | path: ~/.gradle |
| 215 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 216 | - name: Debug Build |
| 217 | run: | |
| 218 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 219 | export DEBUG_BUILD=true |
| 220 | ./gradlew TMessagesProj:assembleMiniRelease |
| 221 |
| 222 | echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')" >> $GITHUB_ENV |
| 223 | echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*armeabi*.apk')" >> $GITHUB_ENV |
| 224 | - uses: actions/upload-artifact@v2 |
| 225 | name: Upload apk (arm64-v8a) |
| 226 | with: |
| 227 | name: Nagram-arm64-v8a |
| 228 | path: ${{ env.APK_FILE }} |
| 229 | - uses: actions/upload-artifact@v2 |
| 230 | name: Upload apk (armeabi-v7a) |
| 231 | with: |
| 232 | name: Nagram-armeabi-v7a |
| 233 | path: ${{ env.APK_FILE_ARMV7 }} |
| 234 |
| 235 | upload: |
| 236 | name: Upload to Telegram |
| 237 | runs-on: ubuntu-latest |
| 238 | needs: |
| 239 | - build |
| 240 | - telegram-bot-api |
| 241 | steps: |
| 242 | - name: Donwload Artifacts |
| 243 | uses: actions/download-artifact@v2 |
| 244 | with: |
| 245 | path: artifacts |
| 246 | - name: Download Telegram Bot API Binary |
| 247 | uses: actions/download-artifact@master |
| 248 | with: |
| 249 | name: telegram-bot-api-binary |
| 250 | path: . |
| 251 | - name: Send to Telegram |
| 252 | run: | |
| 253 | chmod +x telegram-bot-api-binary |
| 254 | ./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & |
| 255 | export mini64=$(find artifacts -name "*arm64-v8a*" | tail -n 1) |
| 256 | curl -L -X POST http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk=@"${mini64}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk\",\"caption\": \"Test version, ${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --show-error --fail >/dev/null |
| 257 | pkill telegram-bot |
| 258 | telegram-bot-api: |
| 259 | name: Telegram Bot API |
| 260 | runs-on: ubuntu-latest |
| 261 | steps: |
| 262 | - name: Checkout |
| 263 | uses: actions/checkout@v2 |
| 264 | - name: Clone Telegram Bot API |
| 265 | run: | |
| 266 | git clone --recursive https://github.com/tdlib/telegram-bot-api.git |
| 267 | git status telegram-bot-api >> telegram-bot-api-status |
| 268 | - name: Cache Bot API Binary |
| 269 | id: cache-bot-api |
| 270 | uses: actions/cache@v2 |
| 271 | with: |
| 272 | path: telegram-bot-api-binary |
| 273 | key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} |
| 274 | - name: Compile Telegram Bot API |
| 275 | if: steps.cache-bot-api.outputs.cache-hit != 'true' |
| 276 | run: | |
| 277 | sudo apt-get update |
| 278 | sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ |
| 279 | cd telegram-bot-api |
| 280 | rm -rf build |
| 281 | mkdir build |
| 282 | cd build |
| 283 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. |
| 284 | cmake --build . --target install -j$(nproc) |
| 285 | cd ../.. |
| 286 | ls -l telegram-bot-api/bin/telegram-bot-api* |
| 287 | cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary |
| 288 | - name: Upload Binary |
| 289 | uses: actions/upload-artifact@master |
| 290 | with: |
| 291 | name: telegram-bot-api-binary |
| 292 | path: telegram-bot-api-binary |
| 293 |