| 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' |
| 139 | run: | |
| 140 | - ./bin/init/libs/libvpx_x86.sh |
| 141 | - name: Native Build |
| 142 | if: steps.cache.outputs.cache-hit != 'true' |
| 143 | run: | |
| 144 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 145 | ./run libs native |
| 146 | v2ray: |
| 147 | name: Native Build (V2ray) |
| 148 | runs-on: ubuntu-latest |
| 149 | steps: |
| 150 | - name: Checkout |
| 151 | uses: actions/checkout@v2 |
| 152 | - name: Fetch Status |
| 153 | run: git submodule status v2ray > v2ray_status |
| 154 | - name: V2ray Cache |
| 155 | id: cache |
| 156 | uses: actions/cache@v2 |
| 157 | with: |
| 158 | path: | |
| 159 | TMessagesProj/libs/libv2ray.aar |
| 160 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 161 | - name: Setup Android SDK Tools |
| 162 | uses: android-actions/setup-android@v2 |
| 163 | if: steps.cache.outputs.cache-hit != 'true' |
| 164 | - name: Install NDK |
| 165 | if: steps.cache.outputs.cache-hit != 'true' |
| 166 | run: | |
| 167 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 168 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 169 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 170 | - name: Install Golang |
| 171 | uses: actions/setup-go@v2 |
| 172 | if: steps.cache.outputs.cache-hit != 'true' |
| 173 | with: |
| 174 | go-version: 1.16 |
| 175 | - name: Native Build |
| 176 | if: steps.cache.outputs.cache-hit != 'true' |
| 177 | run: ./run libs v2ray |
| 178 | shadowsocks: |
| 179 | name: Native Build (Shadowsocks) |
| 180 | runs-on: ubuntu-latest |
| 181 | steps: |
| 182 | - name: Checkout |
| 183 | uses: actions/checkout@v2 |
| 184 | - name: Fetch Status |
| 185 | run: git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 186 | - name: Shadowsocks Cache |
| 187 | id: cache |
| 188 | uses: actions/cache@v2 |
| 189 | with: |
| 190 | path: | |
| 191 | TMessagesProj/libs/ss-rust-release.aar |
| 192 | key: ${{ hashFiles('shadowsocks_status') }} |
| 193 | - name: Setup Android SDK Tools |
| 194 | uses: android-actions/setup-android@v2 |
| 195 | if: steps.cache.outputs.cache-hit != 'true' |
| 196 | - name: Install NDK |
| 197 | if: steps.cache.outputs.cache-hit != 'true' |
| 198 | run: | |
| 199 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 200 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 201 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 202 | - name: Install Rust |
| 203 | if: steps.cache.outputs.cache-hit != 'true' |
| 204 | run: ./run init action shadowsocks |
| 205 | - name: Native Build |
| 206 | if: steps.cache.outputs.cache-hit != 'true' |
| 207 | run: ./run libs shadowsocks |
| 208 | shadowsocksr: |
| 209 | name: Native Build (ShadowsocksR) |
| 210 | runs-on: ubuntu-latest |
| 211 | steps: |
| 212 | - name: Checkout |
| 213 | uses: actions/checkout@v2 |
| 214 | - name: Fetch Status |
| 215 | run: git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 216 | - name: ShadowsocksR Cache |
| 217 | id: cache |
| 218 | uses: actions/cache@v2 |
| 219 | with: |
| 220 | path: | |
| 221 | TMessagesProj/libs/ssr-libev-release.aar |
| 222 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 223 | - name: Setup Android SDK Tools |
| 224 | uses: android-actions/setup-android@v2 |
| 225 | if: steps.cache.outputs.cache-hit != 'true' |
| 226 | - name: Install NDK |
| 227 | if: steps.cache.outputs.cache-hit != 'true' |
| 228 | run: | |
| 229 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 230 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 231 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 232 | - name: Native Build |
| 233 | if: steps.cache.outputs.cache-hit != 'true' |
| 234 | run: ./run libs ssr |
| 235 | build: |
| 236 | name: Gradle Build |
| 237 | runs-on: ubuntu-latest |
| 238 | needs: |
| 239 | - native |
| 240 | - v2ray |
| 241 | - shadowsocks |
| 242 | - shadowsocksr |
| 243 | strategy: |
| 244 | matrix: |
| 245 | flavor: |
| 246 | - MiniRelease |
| 247 | - MiniReleaseNoGcm |
| 248 | - FullRelease |
| 249 | - FullReleaseNoGcm |
| 250 | steps: |
| 251 | - name: Checkout |
| 252 | uses: actions/checkout@v2 |
| 253 | - name: Setup Android SDK Tools |
| 254 | uses: android-actions/setup-android@v2 |
| 255 | - name: Fetch Status |
| 256 | run: | |
| 257 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 258 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 259 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 260 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 261 | git submodule status v2ray > v2ray_status |
| 262 | - name: Native Cache (armeabi-v7a) |
| 263 | uses: actions/cache@v2 |
| 264 | with: |
| 265 | path: | |
| 266 | TMessagesProj/src/main/libs |
| 267 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 268 | - name: Native Cache (arm64-v8a) |
| 269 | uses: actions/cache@v2 |
| 270 | with: |
| 271 | path: | |
| 272 | TMessagesProj/src/main/libs |
| 273 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 274 | - name: Native Cache (x86) |
| 275 | uses: actions/cache@v2 |
| 276 | with: |
| 277 | path: | |
| 278 | TMessagesProj/src/main/libs |
| 279 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86 |
| 280 | - name: Native Cache (x86_64) |
| 281 | uses: actions/cache@v2 |
| 282 | with: |
| 283 | path: | |
| 284 | TMessagesProj/src/main/libs |
| 285 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86_64 |
| 286 | - name: V2ray Cache |
| 287 | uses: actions/cache@v2 |
| 288 | with: |
| 289 | path: | |
| 290 | TMessagesProj/libs/libv2ray.aar |
| 291 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 292 | - name: Shadowsocks Cache |
| 293 | uses: actions/cache@v2 |
| 294 | with: |
| 295 | path: | |
| 296 | TMessagesProj/libs/ss-rust-release.aar |
| 297 | key: ${{ hashFiles('shadowsocks_status') }} |
| 298 | - name: ShadowsocksR Cache |
| 299 | uses: actions/cache@v2 |
| 300 | with: |
| 301 | path: | |
| 302 | TMessagesProj/libs/ssr-libev-release.aar |
| 303 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 304 | - name: Configure Gradle |
| 305 | run: | |
| 306 | sed -i -e "s/16384/6144/g" gradle.properties |
| 307 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 308 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 309 | - name: Gradle cache |
| 310 | uses: actions/cache@v2 |
| 311 | with: |
| 312 | path: ~/.gradle |
| 313 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 314 | - name: Debug Build |
| 315 | run: | |
| 316 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 317 | export DEBUG_BUILD=true |
| 318 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 319 |
| 320 | echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')" >> $GITHUB_ENV |
| 321 | echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*armeabi*.apk')" >> $GITHUB_ENV |
| 322 | echo "APK_FILE_X86=$(find TMessagesProj/build/outputs/apk -name '*x86-*.apk')" >> $GITHUB_ENV |
| 323 | echo "APK_FILE_X64=$(find TMessagesProj/build/outputs/apk -name '*x86_64*.apk')" >> $GITHUB_ENV |
| 324 | - uses: actions/upload-artifact@v2 |
| 325 | if: github.event.inputs.artifacts == 'y' |
| 326 | name: Upload apk (arm64-v8a) |
| 327 | with: |
| 328 | name: NekoX-${{ matrix.flavor }}-arm64-v8a |
| 329 | path: ${{ env.APK_FILE }} |
| 330 | - uses: actions/upload-artifact@v2 |
| 331 | if: github.event.inputs.artifacts == 'y' |
| 332 | name: Upload apk (armeabi-v7a) |
| 333 | with: |
| 334 | name: NekoX-${{ matrix.flavor }}-armeabi-v7a |
| 335 | path: ${{ env.APK_FILE_ARMV7 }} |
| 336 | - uses: actions/upload-artifact@v2 |
| 337 | if: github.event.inputs.artifacts == 'y' |
| 338 | name: Upload apk (x86_64) |
| 339 | with: |
| 340 | name: NekoX-${{ matrix.flavor }}-x86_64 |
| 341 | path: ${{ env.APK_FILE_X64 }} |
| 342 | - uses: actions/upload-artifact@v2 |
| 343 | if: github.event.inputs.artifacts == 'y' |
| 344 | name: Upload apk (x86) |
| 345 | with: |
| 346 | name: NekoX-${{ matrix.flavor }}-x86 |
| 347 | path: ${{ env.APK_FILE_X86 }} |
| 348 |
| 349 | build-dev: |
| 350 | name: Gradle Build |
| 351 | runs-on: ubuntu-latest |
| 352 | needs: |
| 353 | - native |
| 354 | - v2ray |
| 355 | steps: |
| 356 | - name: Checkout |
| 357 | uses: actions/checkout@v2 |
| 358 | - name: Setup Android SDK Tools |
| 359 | uses: android-actions/setup-android@v2 |
| 360 | - name: Fetch Status |
| 361 | run: | |
| 362 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 363 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 364 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 365 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 366 | git submodule status v2ray > v2ray_status |
| 367 | - name: Native Cache (arm64-v8a) |
| 368 | uses: actions/cache@v2 |
| 369 | with: |
| 370 | path: | |
| 371 | TMessagesProj/src/main/libs |
| 372 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 373 | - name: V2ray Cache |
| 374 | uses: actions/cache@v2 |
| 375 | with: |
| 376 | path: | |
| 377 | TMessagesProj/libs/libv2ray.aar |
| 378 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 379 | - name: Configure Gradle |
| 380 | run: | |
| 381 | sed -i -e "s/16384/6144/g" gradle.properties |
| 382 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 383 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 384 | - name: Gradle cache |
| 385 | uses: actions/cache@v2 |
| 386 | with: |
| 387 | path: ~/.gradle |
| 388 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 389 | - name: Debug Build |
| 390 | run: | |
| 391 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 392 | export DEBUG_BUILD=true |
| 393 | export NATIVE_TARGET=arm64-v8a |
| 394 | ./gradlew TMessagesProj:assembleMiniRelease |
| 395 | - name: Send Build |
| 396 | run: | |
| 397 | apk=$(find TMessagesProj/build/outputs/apk/mini/release -name '*arm64-v8a*.apk' | head -n 1) |
| 398 | curl https://api.telegram.org/bot${{ secrets.HELPER_BOT_TOKEN }}/sendDocument \ |
| 399 | -X POST \ |
| 400 | -F chat_id="${{ secrets.HELPER_BOT_TARGET }}" \ |
| 401 | -F document="@$apk" \ |
| 402 | -F caption="$GITHUB_SHA" \ |
| 403 | --silent --show-error --fail >/dev/null |