| branches: |
| 6 | - dev |
| 7 | paths-ignore: |
| 8 | - '**.md' |
| 9 | - '.github/**' |
| 10 | - '!.github/workflows/debug.yml' |
| 11 | pull_request: |
| 12 | branches: |
| 13 | - dev |
| 14 | workflow_dispatch: |
| 15 | inputs: |
| 16 | artifacts: |
| 17 | description: 'y, if need artifacts' |
| 18 | required: false |
| 19 |
| 20 | jobs: |
| 21 | ffmpeg: |
| 22 | name: Native Build (FFmpeg) |
| 23 | runs-on: ubuntu-latest |
| 24 | steps: |
| 25 | - name: Checkout |
| 26 | uses: actions/checkout@v2 |
| 27 | - name: Fetch Status |
| 28 | run: git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 29 | - name: FFmpeg Cache |
| 30 | id: cache |
| 31 | uses: actions/cache@v2 |
| 32 | with: |
| 33 | path: | |
| 34 | TMessagesProj/jni/ffmpeg/build |
| 35 | key: ${{ hashFiles('ffmpeg_status', 'TMessagesProj/jni/*_ffmpeg.sh') }} |
| 36 | - name: Setup Android SDK Tools |
| 37 | uses: android-actions/setup-android@v2 |
| 38 | if: steps.cache.outputs.cache-hit != 'true' |
| 39 | - name: Install NDK |
| 40 | if: steps.cache.outputs.cache-hit != 'true' |
| 41 | run: | |
| 42 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 43 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 44 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 45 | - name: Native Build |
| 46 | if: steps.cache.outputs.cache-hit != 'true' |
| 47 | run: | |
| 48 | ./run init libs ffmpeg |
| 49 | boringssl: |
| 50 | name: Native Build (BoringSSL) |
| 51 | runs-on: ubuntu-latest |
| 52 | steps: |
| 53 | - name: Checkout |
| 54 | uses: actions/checkout@v2 |
| 55 | - name: Fetch Status |
| 56 | run: git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 57 | - name: BoringSSL Cache |
| 58 | id: cache |
| 59 | uses: actions/cache@v2 |
| 60 | with: |
| 61 | path: | |
| 62 | TMessagesProj/jni/boringssl/build |
| 63 | key: ${{ hashFiles('boringssl_status') }} |
| 64 | - name: Setup Android SDK Tools |
| 65 | uses: android-actions/setup-android@v2 |
| 66 | if: steps.cache.outputs.cache-hit != 'true' |
| 67 | - name: Install NDK |
| 68 | if: steps.cache.outputs.cache-hit != 'true' |
| 69 | run: | |
| 70 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 71 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 72 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 73 | - name: Native Build |
| 74 | if: steps.cache.outputs.cache-hit != 'true' |
| 75 | run: | |
| 76 | ./run init action boringssl |
| 77 | ./run init libs boringssl |
| 78 | native: |
| 79 | name: Native Build (Telegram) |
| 80 | runs-on: ubuntu-latest |
| 81 | needs: |
| 82 | - ffmpeg |
| 83 | - boringssl |
| 84 | strategy: |
| 85 | matrix: |
| 86 | flavor: |
| 87 | - armeabi-v7a |
| 88 | - arm64-v8a |
| 89 | - x86 |
| 90 | - x86_64 |
| 91 | steps: |
| 92 | - name: Checkout |
| 93 | uses: actions/checkout@v2 |
| 94 | - name: Fetch Status |
| 95 | run: | |
| 96 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 97 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 98 | - name: Native Cache |
| 99 | id: cache |
| 100 | uses: actions/cache@v2 |
| 101 | with: |
| 102 | path: | |
| 103 | TMessagesProj/src/main/libs |
| 104 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 105 | - name: Checkout Library |
| 106 | if: steps.cache.outputs.cache-hit != 'true' |
| 107 | run: | |
| 108 | git submodule update --init 'TMessagesProj/jni/*' |
| 109 | - name: FFmpeg Cache |
| 110 | uses: actions/cache@v2 |
| 111 | if: steps.cache.outputs.cache-hit != 'true' |
| 112 | with: |
| 113 | path: | |
| 114 | TMessagesProj/jni/ffmpeg/build |
| 115 | key: ${{ hashFiles('ffmpeg_status', 'TMessagesProj/jni/*_ffmpeg.sh') }} |
| 116 | - name: BoringSSL Cache |
| 117 | uses: actions/cache@v2 |
| 118 | if: steps.cache.outputs.cache-hit != 'true' |
| 119 | with: |
| 120 | path: | |
| 121 | TMessagesProj/jni/boringssl/build |
| 122 | key: ${{ hashFiles('boringssl_status') }} |
| 123 | - name: Setup Android SDK Tools |
| 124 | uses: android-actions/setup-android@v2 |
| 125 | if: steps.cache.outputs.cache-hit != 'true' |
| 126 | - name: Install NDK |
| 127 | if: steps.cache.outputs.cache-hit != 'true' |
| 128 | run: | |
| 129 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 130 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 131 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 132 | - name: Fix BoringSSL |
| 133 | if: steps.cache.outputs.cache-hit != 'true' |
| 134 | run: | |
| 135 | cd TMessagesProj/jni |
| 136 | ./patch_boringssl.sh |
| 137 | - name: Native Build (libvpx) |
| 138 | if: (matrix.flavor == 'x86' || matrix.flavor == 'x86_64') && steps.cache.outputs.cache-hit != 'true' |
| 139 | run: | |
| 140 | sudo apt-get install yasm -y |
| 141 | ./run init libs libvpx_x86 |
| 142 | - name: Native Build |
| 143 | if: steps.cache.outputs.cache-hit != 'true' |
| 144 | run: | |
| 145 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 146 | ./run libs native |
| 147 | v2ray: |
| 148 | name: Native Build (V2ray) |
| 149 | runs-on: ubuntu-latest |
| 150 | steps: |
| 151 | - name: Checkout |
| 152 | uses: actions/checkout@v2 |
| 153 | - name: Fetch Status |
| 154 | run: git submodule status v2ray > v2ray_status |
| 155 | - name: V2ray Cache |
| 156 | id: cache |
| 157 | uses: actions/cache@v2 |
| 158 | with: |
| 159 | path: | |
| 160 | TMessagesProj/libs/libv2ray.aar |
| 161 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 162 | - name: Setup Android SDK Tools |
| 163 | uses: android-actions/setup-android@v2 |
| 164 | if: steps.cache.outputs.cache-hit != 'true' |
| 165 | - name: Install NDK |
| 166 | if: steps.cache.outputs.cache-hit != 'true' |
| 167 | run: | |
| 168 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 169 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 170 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 171 | - name: Install Golang |
| 172 | uses: actions/setup-go@v2 |
| 173 | if: steps.cache.outputs.cache-hit != 'true' |
| 174 | with: |
| 175 | go-version: 1.16 |
| 176 | - name: Native Build |
| 177 | if: steps.cache.outputs.cache-hit != 'true' |
| 178 | run: ./run libs v2ray |
| 179 | shadowsocks: |
| 180 | name: Native Build (Shadowsocks) |
| 181 | runs-on: ubuntu-latest |
| 182 | steps: |
| 183 | - name: Checkout |
| 184 | uses: actions/checkout@v2 |
| 185 | - name: Fetch Status |
| 186 | run: git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 187 | - name: Shadowsocks Cache |
| 188 | id: cache |
| 189 | uses: actions/cache@v2 |
| 190 | with: |
| 191 | path: | |
| 192 | TMessagesProj/libs/ss-rust-release.aar |
| 193 | key: ${{ hashFiles('shadowsocks_status') }} |
| 194 | - name: Setup Android SDK Tools |
| 195 | uses: android-actions/setup-android@v2 |
| 196 | if: steps.cache.outputs.cache-hit != 'true' |
| 197 | - name: Install NDK |
| 198 | if: steps.cache.outputs.cache-hit != 'true' |
| 199 | run: | |
| 200 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 201 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 202 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 203 | - name: Install Rust |
| 204 | if: steps.cache.outputs.cache-hit != 'true' |
| 205 | run: ./run init action shadowsocks |
| 206 | - name: Native Build |
| 207 | if: steps.cache.outputs.cache-hit != 'true' |
| 208 | run: ./run libs shadowsocks |
| 209 | shadowsocksr: |
| 210 | name: Native Build (ShadowsocksR) |
| 211 | runs-on: ubuntu-latest |
| 212 | steps: |
| 213 | - name: Checkout |
| 214 | uses: actions/checkout@v2 |
| 215 | - name: Fetch Status |
| 216 | run: git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 217 | - name: ShadowsocksR Cache |
| 218 | id: cache |
| 219 | uses: actions/cache@v2 |
| 220 | with: |
| 221 | path: | |
| 222 | TMessagesProj/libs/ssr-libev-release.aar |
| 223 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 224 | - name: Setup Android SDK Tools |
| 225 | uses: android-actions/setup-android@v2 |
| 226 | if: steps.cache.outputs.cache-hit != 'true' |
| 227 | - name: Install NDK |
| 228 | if: steps.cache.outputs.cache-hit != 'true' |
| 229 | run: | |
| 230 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 231 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 232 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 233 | - name: Native Build |
| 234 | if: steps.cache.outputs.cache-hit != 'true' |
| 235 | run: ./run libs ssr |
| 236 | build: |
| 237 | name: Gradle Build |
| 238 | runs-on: ubuntu-latest |
| 239 | needs: |
| 240 | - native |
| 241 | - v2ray |
| 242 | - shadowsocks |
| 243 | - shadowsocksr |
| 244 | strategy: |
| 245 | matrix: |
| 246 | flavor: |
| 247 | - MiniRelease |
| 248 | - MiniReleaseNoGcm |
| 249 | - FullRelease |
| 250 | - FullReleaseNoGcm |
| 251 | steps: |
| 252 | - name: Checkout |
| 253 | uses: actions/checkout@v2 |
| 254 | - name: Setup Android SDK Tools |
| 255 | uses: android-actions/setup-android@v2 |
| 256 | - name: Fetch Status |
| 257 | run: | |
| 258 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 259 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 260 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 261 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 262 | git submodule status v2ray > v2ray_status |
| 263 | - name: Native Cache (armeabi-v7a) |
| 264 | uses: actions/cache@v2 |
| 265 | with: |
| 266 | path: | |
| 267 | TMessagesProj/src/main/libs |
| 268 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 269 | - name: Native Cache (arm64-v8a) |
| 270 | uses: actions/cache@v2 |
| 271 | with: |
| 272 | path: | |
| 273 | TMessagesProj/src/main/libs |
| 274 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 275 | - name: Native Cache (x86) |
| 276 | uses: actions/cache@v2 |
| 277 | with: |
| 278 | path: | |
| 279 | TMessagesProj/src/main/libs |
| 280 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86 |
| 281 | - name: Native Cache (x86_64) |
| 282 | uses: actions/cache@v2 |
| 283 | with: |
| 284 | path: | |
| 285 | TMessagesProj/src/main/libs |
| 286 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86_64 |
| 287 | - name: V2ray Cache |
| 288 | uses: actions/cache@v2 |
| 289 | with: |
| 290 | path: | |
| 291 | TMessagesProj/libs/libv2ray.aar |
| 292 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 293 | - name: Shadowsocks Cache |
| 294 | uses: actions/cache@v2 |
| 295 | with: |
| 296 | path: | |
| 297 | TMessagesProj/libs/ss-rust-release.aar |
| 298 | key: ${{ hashFiles('shadowsocks_status') }} |
| 299 | - name: ShadowsocksR Cache |
| 300 | uses: actions/cache@v2 |
| 301 | with: |
| 302 | path: | |
| 303 | TMessagesProj/libs/ssr-libev-release.aar |
| 304 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 305 | - name: Configure Gradle |
| 306 | run: | |
| 307 | sed -i -e "s/16384/6144/g" gradle.properties |
| 308 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 309 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 310 | - name: Gradle cache |
| 311 | uses: actions/cache@v2 |
| 312 | with: |
| 313 | path: ~/.gradle |
| 314 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 315 | - name: Debug Build |
| 316 | run: | |
| 317 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 318 | export DEBUG_BUILD=true |
| 319 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 320 |
| 321 | echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')" >> $GITHUB_ENV |
| 322 | echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*armeabi*.apk')" >> $GITHUB_ENV |
| 323 | echo "APK_FILE_X86=$(find TMessagesProj/build/outputs/apk -name '*x86-*.apk')" >> $GITHUB_ENV |
| 324 | echo "APK_FILE_X64=$(find TMessagesProj/build/outputs/apk -name '*x86_64*.apk')" >> $GITHUB_ENV |
| 325 | - uses: actions/upload-artifact@v2 |
| 326 | if: github.event.inputs.artifacts == 'y' |
| 327 | name: Upload apk (arm64-v8a) |
| 328 | with: |
| 329 | name: NekoX-${{ matrix.flavor }}-arm64-v8a |
| 330 | path: ${{ env.APK_FILE }} |
| 331 | - uses: actions/upload-artifact@v2 |
| 332 | if: github.event.inputs.artifacts == 'y' |
| 333 | name: Upload apk (armeabi-v7a) |
| 334 | with: |
| 335 | name: NekoX-${{ matrix.flavor }}-armeabi-v7a |
| 336 | path: ${{ env.APK_FILE_ARMV7 }} |
| 337 | - uses: actions/upload-artifact@v2 |
| 338 | if: github.event.inputs.artifacts == 'y' |
| 339 | name: Upload apk (x86_64) |
| 340 | with: |
| 341 | name: NekoX-${{ matrix.flavor }}-x86_64 |
| 342 | path: ${{ env.APK_FILE_X64 }} |
| 343 | - uses: actions/upload-artifact@v2 |
| 344 | if: github.event.inputs.artifacts == 'y' |
| 345 | name: Upload apk (x86) |
| 346 | with: |
| 347 | name: NekoX-${{ matrix.flavor }}-x86 |
| 348 | path: ${{ env.APK_FILE_X86 }} |
| 349 |
| 350 | build-dev: |
| 351 | name: Gradle Build |
| 352 | runs-on: ubuntu-latest |
| 353 | needs: |
| 354 | - native |
| 355 | - v2ray |
| 356 | - telegram-bot-api |
| 357 | steps: |
| 358 | - name: Checkout |
| 359 | uses: actions/checkout@v2 |
| 360 | - name: Setup Android SDK Tools |
| 361 | uses: android-actions/setup-android@v2 |
| 362 | - name: Fetch Status |
| 363 | run: | |
| 364 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 365 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 366 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 367 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 368 | git submodule status v2ray > v2ray_status |
| 369 | - name: Native Cache (arm64-v8a) |
| 370 | uses: actions/cache@v2 |
| 371 | with: |
| 372 | path: | |
| 373 | TMessagesProj/src/main/libs |
| 374 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 375 | - name: V2ray Cache |
| 376 | uses: actions/cache@v2 |
| 377 | with: |
| 378 | path: | |
| 379 | TMessagesProj/libs/libv2ray.aar |
| 380 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 381 | - name: Configure Gradle |
| 382 | run: | |
| 383 | sed -i -e "s/16384/6144/g" gradle.properties |
| 384 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 385 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 386 | - name: Gradle cache |
| 387 | uses: actions/cache@v2 |
| 388 | with: |
| 389 | path: ~/.gradle |
| 390 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 391 | - name: Download Telegram Bot API Binary |
| 392 | uses: actions/download-artifact@master |
| 393 | with: |
| 394 | name: telegram-bot-api-binary |
| 395 | path: . |
| 396 | - name: Debug Build |
| 397 | run: | |
| 398 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 399 | export DEBUG_BUILD=true |
| 400 | export NATIVE_TARGET=arm64-v8a |
| 401 | ./gradlew TMessagesProj:assembleMiniRelease |
| 402 | - name: Send Build |
| 403 | run: | |
| 404 | chmod +x telegram-bot-api-binary |
| 405 | ./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null & |
| 406 | apk=$(find TMessagesProj/build/outputs/apk/mini/release -name '*arm64-v8a*.apk' | head -n 1) |
| 407 | curl http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendDocument \ |
| 408 | -X POST \ |
| 409 | -F chat_id="${{ secrets.HELPER_BOT_TARGET }}" \ |
| 410 | -F document="@$apk" \ |
| 411 | -F caption="$GITHUB_SHA" \ |
| 412 | --silent --show-error --fail >/dev/null |
| 413 | pkill telegram-bot |
| 414 |
| 415 | telegram-bot-api: |
| 416 | name: Telegram Bot API |
| 417 | runs-on: ubuntu-latest |
| 418 | steps: |
| 419 | - name: Checkout |
| 420 | uses: actions/checkout@v2 |
| 421 | - name: Clone Telegram Bot API |
| 422 | run: | |
| 423 | git clone --recursive https://github.com/tdlib/telegram-bot-api.git |
| 424 | git status telegram-bot-api >> telegram-bot-api-status |
| 425 | - name: Cache Bot API Binary |
| 426 | id: cache-bot-api |
| 427 | uses: actions/cache@v2 |
| 428 | with: |
| 429 | path: telegram-bot-api-binary |
| 430 | key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} |
| 431 | - name: Compile Telegram Bot API |
| 432 | if: steps.cache-bot-api.outputs.cache-hit != 'true' |
| 433 | run: | |
| 434 | sudo apt-get update |
| 435 | sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ |
| 436 | cd telegram-bot-api |
| 437 | rm -rf build |
| 438 | mkdir build |
| 439 | cd build |
| 440 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. |
| 441 | cmake --build . --target install -j$(nproc) |
| 442 | cd ../.. |
| 443 | ls -l telegram-bot-api/bin/telegram-bot-api* |
| 444 | cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary |
| 445 | - name: Upload Binary |
| 446 | uses: actions/upload-artifact@master |
| 447 | with: |
| 448 | name: telegram-bot-api-binary |
| 449 | path: telegram-bot-api-binary |