| branches: |
| 6 | - dev |
| 7 | paths-ignore: |
| 8 | - '**.md' |
| 9 | - '.github/**' |
| 10 | - '!.github/workflows/debug.yml' |
| 11 |
| 12 | jobs: |
| 13 | check: |
| 14 | name: Check Access |
| 15 | runs-on: ubuntu-latest |
| 16 | steps: |
| 17 | - name: "Check access" |
| 18 | uses: "lannonbr/repo-permission-check-action@2.0.0" |
| 19 | with: |
| 20 | permission: "write" |
| 21 | env: |
| 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | ffmpeg: |
| 24 | name: Native Build (FFmpeg) |
| 25 | runs-on: ubuntu-latest |
| 26 | needs: check |
| 27 | steps: |
| 28 | - name: Checkout |
| 29 | uses: actions/checkout@v2 |
| 30 | - name: Fetch Status |
| 31 | run: | |
| 32 | sed -i 's/\/\///g' settings.gradle |
| 33 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 34 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 35 | - name: FFmpeg Cache |
| 36 | id: cache |
| 37 | uses: actions/cache@v2 |
| 38 | with: |
| 39 | path: | |
| 40 | TMessagesProj/jni/ffmpeg/build |
| 41 | TMessagesProj/jni/libvpx/build |
| 42 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 43 | - name: Set up JDK 17 |
| 44 | uses: actions/setup-java@v3 |
| 45 | if: steps.cache.outputs.cache-hit != 'true' |
| 46 | with: |
| 47 | java-version: '17' |
| 48 | distribution: 'temurin' |
| 49 | - name: Setup Android SDK Tools |
| 50 | uses: android-actions/setup-android@v3 |
| 51 | if: steps.cache.outputs.cache-hit != 'true' |
| 52 | - name: Install NDK |
| 53 | if: steps.cache.outputs.cache-hit != 'true' |
| 54 | run: | |
| 55 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 56 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 57 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 58 | - name: Native Build |
| 59 | if: steps.cache.outputs.cache-hit != 'true' |
| 60 | run: | |
| 61 | sudo apt-get install yasm -y |
| 62 | ./run init libs libvpx |
| 63 | ./run init libs ffmpeg |
| 64 | boringssl: |
| 65 | name: Native Build (BoringSSL) |
| 66 | runs-on: ubuntu-latest |
| 67 | needs: check |
| 68 | steps: |
| 69 | - name: Checkout |
| 70 | uses: actions/checkout@v2 |
| 71 | - name: Fetch Status |
| 72 | run: | |
| 73 | sed -i 's/\/\///g' settings.gradle |
| 74 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 75 | - name: BoringSSL Cache |
| 76 | id: cache |
| 77 | uses: actions/cache@v2 |
| 78 | with: |
| 79 | path: | |
| 80 | TMessagesProj/jni/boringssl/build |
| 81 | key: ${{ hashFiles('boringssl_status') }} |
| 82 | - name: Set up JDK 17 |
| 83 | uses: actions/setup-java@v3 |
| 84 | if: steps.cache.outputs.cache-hit != 'true' |
| 85 | with: |
| 86 | java-version: '17' |
| 87 | distribution: 'temurin' |
| 88 | - name: Setup Android SDK Tools |
| 89 | uses: android-actions/setup-android@v3 |
| 90 | if: steps.cache.outputs.cache-hit != 'true' |
| 91 | - name: Install NDK |
| 92 | if: steps.cache.outputs.cache-hit != 'true' |
| 93 | run: | |
| 94 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 95 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 96 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 97 | - name: Native Build |
| 98 | if: steps.cache.outputs.cache-hit != 'true' |
| 99 | run: | |
| 100 | ./run init action boringssl |
| 101 | ./run init libs boringssl |
| 102 | native: |
| 103 | name: Native Build (Telegram) |
| 104 | runs-on: ubuntu-latest |
| 105 | needs: |
| 106 | - ffmpeg |
| 107 | - boringssl |
| 108 | strategy: |
| 109 | matrix: |
| 110 | flavor: |
| 111 | - armeabi-v7a |
| 112 | - arm64-v8a |
| 113 | steps: |
| 114 | - name: Checkout |
| 115 | uses: actions/checkout@v2 |
| 116 | - name: Fetch Status |
| 117 | run: | |
| 118 | sed -i 's/\/\///g' settings.gradle |
| 119 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 120 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 121 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 122 | - name: Native Cache |
| 123 | id: cache |
| 124 | uses: actions/cache@v2 |
| 125 | with: |
| 126 | path: | |
| 127 | TMessagesProj/src/main/libs |
| 128 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 129 | - name: Checkout Library |
| 130 | if: steps.cache.outputs.cache-hit != 'true' |
| 131 | run: | |
| 132 | git submodule update --init 'TMessagesProj/jni/*' |
| 133 | - name: FFmpeg Cache |
| 134 | uses: actions/cache@v2 |
| 135 | if: steps.cache.outputs.cache-hit != 'true' |
| 136 | with: |
| 137 | path: | |
| 138 | TMessagesProj/jni/ffmpeg/build |
| 139 | TMessagesProj/jni/libvpx/build |
| 140 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 141 | - name: BoringSSL Cache |
| 142 | uses: actions/cache@v2 |
| 143 | if: steps.cache.outputs.cache-hit != 'true' |
| 144 | with: |
| 145 | path: | |
| 146 | TMessagesProj/jni/boringssl/build |
| 147 | key: ${{ hashFiles('boringssl_status') }} |
| 148 | - name: Set up JDK 17 |
| 149 | uses: actions/setup-java@v3 |
| 150 | if: steps.cache.outputs.cache-hit != 'true' |
| 151 | with: |
| 152 | java-version: '17' |
| 153 | distribution: 'temurin' |
| 154 | - name: Setup Android SDK Tools |
| 155 | uses: android-actions/setup-android@v3 |
| 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" | 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: Fix BoringSSL |
| 164 | if: steps.cache.outputs.cache-hit != 'true' |
| 165 | run: | |
| 166 | cd TMessagesProj/jni |
| 167 | ./patch_boringssl.sh |
| 168 | - name: Native Build |
| 169 | if: steps.cache.outputs.cache-hit != 'true' |
| 170 | run: | |
| 171 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 172 | ./run libs native |
| 173 | build: |
| 174 | name: Gradle Build |
| 175 | runs-on: ubuntu-latest |
| 176 | needs: |
| 177 | - native |
| 178 | strategy: |
| 179 | matrix: |
| 180 | flavor: |
| 181 | # - FullRelease |
| 182 | - MiniRelease |
| 183 | - MiniReleaseNoGcm |
| 184 | steps: |
| 185 | - name: Checkout |
| 186 | uses: actions/checkout@v2 |
| 187 | - name: Set up JDK 17 |
| 188 | uses: actions/setup-java@v3 |
| 189 | with: |
| 190 | java-version: '17' |
| 191 | distribution: 'temurin' |
| 192 | - name: Setup Android SDK Tools |
| 193 | uses: android-actions/setup-android@v3 |
| 194 | - name: Install NDK |
| 195 | run: | |
| 196 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 197 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 198 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 199 | - name: Fetch Status |
| 200 | run: | |
| 201 | sed -i 's/\/\///g' settings.gradle |
| 202 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 203 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 204 | - name: Native Cache (armeabi-v7a) |
| 205 | uses: actions/cache@v2 |
| 206 | with: |
| 207 | path: | |
| 208 | TMessagesProj/src/main/libs |
| 209 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 210 | - name: Native Cache (arm64-v8a) |
| 211 | uses: actions/cache@v2 |
| 212 | with: |
| 213 | path: | |
| 214 | TMessagesProj/src/main/libs |
| 215 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 216 | - name: Configure Gradle |
| 217 | run: | |
| 218 | sed -i -e "s/16384/6144/g" gradle.properties |
| 219 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 220 | - name: Gradle cache |
| 221 | uses: actions/cache@v2 |
| 222 | with: |
| 223 | path: ~/.gradle |
| 224 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 225 | - name: Debug Build |
| 226 | run: | |
| 227 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 228 | export DEBUG_BUILD=true |
| 229 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 230 |
| 231 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 232 | APK=$(dirname $APK) |
| 233 | echo "APK=$APK" >> $GITHUB_ENV |
| 234 | - uses: actions/upload-artifact@v2 |
| 235 | with: |
| 236 | name: ${{ matrix.flavor }} |
| 237 | path: ${{ env.APK }} |
| 238 | # build-nogcm: |
| 239 | # name: Gradle Build (nogcm) |
| 240 | # runs-on: ubuntu-latest |
| 241 | # needs: |
| 242 | # - native |
| 243 | # - v2ray |
| 244 | # - shadowsocks |
| 245 | # - shadowsocksr |
| 246 | # - build |
| 247 | # strategy: |
| 248 | # matrix: |
| 249 | # flavor: |
| 250 | # - FullReleaseNoGcm |
| 251 | # - MiniReleaseNoGcm |
| 252 | # steps: |
| 253 | # - name: Checkout |
| 254 | # uses: actions/checkout@v2 |
| 255 | # - name: Setup Android SDK Tools |
| 256 | # uses: android-actions/setup-android@v2 |
| 257 | # - name: Install NDK |
| 258 | # run: | |
| 259 | # echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 260 | # echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 261 | # echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 262 | # - name: Fetch Status |
| 263 | # run: | |
| 264 | # sed -i 's/\/\///g' settings.gradle |
| 265 | # git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 266 | # git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 267 | # git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 268 | # git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 269 | # git submodule status v2ray > v2ray_status |
| 270 | # - name: Native Cache (armeabi-v7a) |
| 271 | # uses: actions/cache@v2 |
| 272 | # with: |
| 273 | # path: | |
| 274 | # TMessagesProj/src/main/libs |
| 275 | # key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 276 | # - name: Native Cache (arm64-v8a) |
| 277 | # uses: actions/cache@v2 |
| 278 | # with: |
| 279 | # path: | |
| 280 | # TMessagesProj/src/main/libs |
| 281 | # key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 282 | # - name: V2ray Cache |
| 283 | # uses: actions/cache@v2 |
| 284 | # with: |
| 285 | # path: | |
| 286 | # TMessagesProj/libs/libv2ray.aar |
| 287 | # key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 288 | # - name: Shadowsocks Cache |
| 289 | # uses: actions/cache@v2 |
| 290 | # with: |
| 291 | # path: | |
| 292 | # TMessagesProj/libs/ss-rust-release.aar |
| 293 | # key: ${{ hashFiles('shadowsocks_status') }} |
| 294 | # - name: ShadowsocksR Cache |
| 295 | # uses: actions/cache@v2 |
| 296 | # with: |
| 297 | # path: | |
| 298 | # TMessagesProj/libs/ssr-libev-release.aar |
| 299 | # key: ${{ hashFiles('shadowsocksr_status') }} |
| 300 | # - name: Configure Gradle |
| 301 | # run: | |
| 302 | # sed -i -e "s/16384/6144/g" gradle.properties |
| 303 | # echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 304 | # - name: Gradle cache |
| 305 | # uses: actions/cache@v2 |
| 306 | # with: |
| 307 | # path: ~/.gradle |
| 308 | # key: gradle-${{ hashFiles('**/*.gradle') }} |
| 309 | # - name: Debug Build |
| 310 | # run: | |
| 311 | # export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 312 | # export DEBUG_BUILD=true |
| 313 | # ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 314 | # |
| 315 | # APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 316 | # APK=$(dirname $APK) |
| 317 | # echo "APK=$APK" >> $GITHUB_ENV |
| 318 | # - uses: actions/upload-artifact@v2 |
| 319 | # with: |
| 320 | # name: ${{ matrix.flavor }} |
| 321 | # path: ${{ env.APK }} |
| 322 | upload: |
| 323 | name: Upload debug |
| 324 | runs-on: ubuntu-latest |
| 325 | if: ${{ !contains(github.event.head_commit.message, 'bump version') }} |
| 326 | needs: |
| 327 | - build |
| 328 | # - build-nogcm |
| 329 | - telegram-bot-api |
| 330 | steps: |
| 331 | - name: Donwload Artifacts |
| 332 | uses: actions/download-artifact@v2 |
| 333 | with: |
| 334 | path: artifacts |
| 335 | - name: Download Telegram Bot API Binary |
| 336 | uses: actions/download-artifact@master |
| 337 | with: |
| 338 | name: telegram-bot-api-binary |
| 339 | path: . |
| 340 | - name: Send to Telegram |
| 341 | run: | |
| 342 | chmod +x telegram-bot-api-binary |
| 343 | function start() { |
| 344 | ./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & |
| 345 | } |
| 346 | start |
| 347 | curl http://127.0.0.1:8081/ || start |
| 348 | curl http://127.0.0.1:8081/ || start |
| 349 | curl http://127.0.0.1:8081/ || start |
| 350 | # send release via telegram bot api |
| 351 | export mini64=$(find artifacts -name "*arm64-v8a.apk") |
| 352 | export mini32=$(find artifacts -name "*armeabi-v7a.apk") |
| 353 | # export full64=$(find artifacts -name "*full-arm64-v8a.apk") |
| 354 | # export full32=$(find artifacts -name "*full-armeabi-v7a.apk") |
| 355 | export mini64nogcm=$(find artifacts -name "*arm64-v8aNoGcm.apk") |
| 356 | export mini32nogcm=$(find artifacts -name "*armeabi-v7aNoGcm.apk") |
| 357 | # export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk") |
| 358 | # export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk") |
| 359 |
| 360 | echo $mini64 |
| 361 | echo $mini32 |
| 362 | # echo $full64 |
| 363 | # echo $full32 |
| 364 | echo $mini64nogcm |
| 365 | echo $mini32nogcm |
| 366 | # echo $full64nogcm |
| 367 | # echo $full32nogcm |
| 368 |
| 369 | curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk1=@"${mini64}" --form apk2=@"${mini32}" --form apk3=@"${mini64nogcm}" --form apk4=@"${mini32nogcm}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk1\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk2\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk3\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk4\",\"caption\": \"Test version, ${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --verbose >/dev/null |
| 370 |
| 371 | pkill telegram-bot |
| 372 | telegram-bot-api: |
| 373 | name: Telegram Bot API |
| 374 | runs-on: ubuntu-latest |
| 375 | steps: |
| 376 | - name: Checkout |
| 377 | uses: actions/checkout@v2 |
| 378 | - name: Clone Telegram Bot API |
| 379 | run: | |
| 380 | git clone --recursive https://github.com/tdlib/telegram-bot-api.git |
| 381 | git status telegram-bot-api >> telegram-bot-api-status |
| 382 | - name: Cache Bot API Binary |
| 383 | id: cache-bot-api |
| 384 | uses: actions/cache@v2 |
| 385 | with: |
| 386 | path: telegram-bot-api-binary |
| 387 | key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} |
| 388 | - name: Compile Telegram Bot API |
| 389 | if: steps.cache-bot-api.outputs.cache-hit != 'true' |
| 390 | run: | |
| 391 | sudo apt-get update |
| 392 | sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ |
| 393 | cd telegram-bot-api |
| 394 | rm -rf build |
| 395 | mkdir build |
| 396 | cd build |
| 397 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. |
| 398 | cmake --build . --target install -j$(nproc) |
| 399 | cd ../.. |
| 400 | ls -l telegram-bot-api/bin/telegram-bot-api* |
| 401 | cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary |
| 402 | - name: Upload Binary |
| 403 | uses: actions/upload-artifact@master |
| 404 | with: |
| 405 | name: telegram-bot-api-binary |
| 406 | path: telegram-bot-api-binary |
| 407 |