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