| 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 |
| 138 | if: steps.cache.outputs.cache-hit != 'true' |
| 139 | run: | |
| 140 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 141 | ./run libs native |
| 142 | v2ray: |
| 143 | name: Native Build (V2ray) |
| 144 | runs-on: ubuntu-latest |
| 145 | steps: |
| 146 | - name: Checkout |
| 147 | uses: actions/checkout@v2 |
| 148 | - name: Fetch Status |
| 149 | run: git submodule status v2ray > v2ray_status |
| 150 | - name: V2ray Cache |
| 151 | id: cache |
| 152 | uses: actions/cache@v2 |
| 153 | with: |
| 154 | path: | |
| 155 | TMessagesProj/libs/libv2ray.aar |
| 156 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 157 | - name: Setup Android SDK Tools |
| 158 | uses: android-actions/setup-android@v2 |
| 159 | if: steps.cache.outputs.cache-hit != 'true' |
| 160 | - name: Install NDK |
| 161 | if: steps.cache.outputs.cache-hit != 'true' |
| 162 | run: | |
| 163 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 164 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 165 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 166 | - name: Install Golang |
| 167 | uses: actions/setup-go@v2 |
| 168 | if: steps.cache.outputs.cache-hit != 'true' |
| 169 | with: |
| 170 | go-version: 1.16 |
| 171 | - name: Native Build |
| 172 | if: steps.cache.outputs.cache-hit != 'true' |
| 173 | run: ./run libs v2ray |
| 174 | shadowsocks: |
| 175 | name: Native Build (Shadowsocks) |
| 176 | runs-on: ubuntu-latest |
| 177 | steps: |
| 178 | - name: Checkout |
| 179 | uses: actions/checkout@v2 |
| 180 | - name: Fetch Status |
| 181 | run: git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 182 | - name: Shadowsocks Cache |
| 183 | id: cache |
| 184 | uses: actions/cache@v2 |
| 185 | with: |
| 186 | path: | |
| 187 | TMessagesProj/libs/ss-rust-release.aar |
| 188 | key: ${{ hashFiles('shadowsocks_status') }} |
| 189 | - name: Setup Android SDK Tools |
| 190 | uses: android-actions/setup-android@v2 |
| 191 | if: steps.cache.outputs.cache-hit != 'true' |
| 192 | - name: Install NDK |
| 193 | if: steps.cache.outputs.cache-hit != 'true' |
| 194 | run: | |
| 195 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 196 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 197 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 198 | - name: Install Rust |
| 199 | if: steps.cache.outputs.cache-hit != 'true' |
| 200 | run: ./run init action shadowsocks |
| 201 | - name: Native Build |
| 202 | if: steps.cache.outputs.cache-hit != 'true' |
| 203 | run: ./run libs shadowsocks |
| 204 | shadowsocksr: |
| 205 | name: Native Build (ShadowsocksR) |
| 206 | runs-on: ubuntu-latest |
| 207 | steps: |
| 208 | - name: Checkout |
| 209 | uses: actions/checkout@v2 |
| 210 | - name: Fetch Status |
| 211 | run: git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 212 | - name: ShadowsocksR Cache |
| 213 | id: cache |
| 214 | uses: actions/cache@v2 |
| 215 | with: |
| 216 | path: | |
| 217 | TMessagesProj/libs/ssr-libev-release.aar |
| 218 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 219 | - name: Setup Android SDK Tools |
| 220 | uses: android-actions/setup-android@v2 |
| 221 | if: steps.cache.outputs.cache-hit != 'true' |
| 222 | - name: Install NDK |
| 223 | if: steps.cache.outputs.cache-hit != 'true' |
| 224 | run: | |
| 225 | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 226 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 227 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 228 | - name: Native Build |
| 229 | if: steps.cache.outputs.cache-hit != 'true' |
| 230 | run: ./run libs ssr |
| 231 | build: |
| 232 | name: Gradle Build |
| 233 | runs-on: ubuntu-latest |
| 234 | needs: |
| 235 | - native |
| 236 | - v2ray |
| 237 | - shadowsocks |
| 238 | - shadowsocksr |
| 239 | strategy: |
| 240 | matrix: |
| 241 | flavor: |
| 242 | - MiniRelease |
| 243 | - MiniReleaseNoGcm |
| 244 | - FullRelease |
| 245 | - FullReleaseNoGcm |
| 246 | steps: |
| 247 | - name: Checkout |
| 248 | uses: actions/checkout@v2 |
| 249 | - name: Setup Android SDK Tools |
| 250 | uses: android-actions/setup-android@v2 |
| 251 | - name: Fetch Status |
| 252 | run: | |
| 253 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 254 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 255 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 256 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 257 | git submodule status v2ray > v2ray_status |
| 258 | - name: Native Cache (armeabi-v7a) |
| 259 | uses: actions/cache@v2 |
| 260 | with: |
| 261 | path: | |
| 262 | TMessagesProj/src/main/libs |
| 263 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 264 | - name: Native Cache (arm64-v8a) |
| 265 | uses: actions/cache@v2 |
| 266 | with: |
| 267 | path: | |
| 268 | TMessagesProj/src/main/libs |
| 269 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 270 | - name: Native Cache (x86) |
| 271 | uses: actions/cache@v2 |
| 272 | with: |
| 273 | path: | |
| 274 | TMessagesProj/src/main/libs |
| 275 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86 |
| 276 | - name: Native Cache (x86_64) |
| 277 | uses: actions/cache@v2 |
| 278 | with: |
| 279 | path: | |
| 280 | TMessagesProj/src/main/libs |
| 281 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-x86_64 |
| 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 | echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" >> local.properties |
| 305 | - name: Gradle cache |
| 306 | uses: actions/cache@v2 |
| 307 | with: |
| 308 | path: ~/.gradle |
| 309 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 310 | - name: Debug Build |
| 311 | run: | |
| 312 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 313 | export DEBUG_BUILD=true |
| 314 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 315 |
| 316 | echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')" >> $GITHUB_ENV |
| 317 | echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*armeabi*.apk')" >> $GITHUB_ENV |
| 318 | echo "APK_FILE_X86=$(find TMessagesProj/build/outputs/apk -name '*x86-*.apk')" >> $GITHUB_ENV |
| 319 | echo "APK_FILE_X64=$(find TMessagesProj/build/outputs/apk -name '*x86_64*.apk')" >> $GITHUB_ENV |
| 320 | - uses: actions/upload-artifact@v2 |
| 321 | if: github.event.inputs.artifacts == 'y' |
| 322 | name: Upload apk (arm64-v8a) |
| 323 | with: |
| 324 | name: NekoX-${{ matrix.flavor }}-arm64-v8a |
| 325 | path: ${{ env.APK_FILE }} |
| 326 | - uses: actions/upload-artifact@v2 |
| 327 | if: github.event.inputs.artifacts == 'y' |
| 328 | name: Upload apk (armeabi-v7a) |
| 329 | with: |
| 330 | name: NekoX-${{ matrix.flavor }}-armeabi-v7a |
| 331 | path: ${{ env.APK_FILE_ARMV7 }} |
| 332 | - uses: actions/upload-artifact@v2 |
| 333 | if: github.event.inputs.artifacts == 'y' |
| 334 | name: Upload apk (x86_64) |
| 335 | with: |
| 336 | name: NekoX-${{ matrix.flavor }}-x86_64 |
| 337 | path: ${{ env.APK_FILE_X64 }} |
| 338 | - uses: actions/upload-artifact@v2 |
| 339 | if: github.event.inputs.artifacts == 'y' |
| 340 | name: Upload apk (x86) |
| 341 | with: |
| 342 | name: NekoX-${{ matrix.flavor }}-x86 |
| 343 | path: ${{ env.APK_FILE_X86 }} |
| 344 |