| types: [opened, reopened, synchronize] |
| 6 | paths-ignore: |
| 7 | - '**.md' |
| 8 | - '**.xml' |
| 9 |
| 10 | jobs: |
| 11 | check: |
| 12 | name: Check Access |
| 13 | runs-on: ubuntu-latest |
| 14 | steps: |
| 15 | - name: "Check access" |
| 16 | uses: "lannonbr/repo-permission-check-action@2.0.0" |
| 17 | with: |
| 18 | permission: "write" |
| 19 | env: |
| 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | ffmpeg: |
| 22 | name: Native Build (FFmpeg) |
| 23 | runs-on: ubuntu-latest |
| 24 | needs: check |
| 25 | steps: |
| 26 | - name: Checkout |
| 27 | uses: actions/checkout@v2 |
| 28 | - name: Fetch Status |
| 29 | run: | |
| 30 | sed -i 's/\/\///g' settings.gradle |
| 31 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 32 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 33 | - name: FFmpeg Cache |
| 34 | id: cache |
| 35 | uses: actions/cache@v2 |
| 36 | with: |
| 37 | path: | |
| 38 | TMessagesProj/jni/ffmpeg/build |
| 39 | TMessagesProj/jni/libvpx/build |
| 40 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 41 | - name: Set up JDK 17 |
| 42 | uses: actions/setup-java@v3 |
| 43 | if: steps.cache.outputs.cache-hit != 'true' |
| 44 | with: |
| 45 | java-version: '17' |
| 46 | distribution: 'temurin' |
| 47 | - name: Setup Android SDK Tools |
| 48 | uses: android-actions/setup-android@v3 |
| 49 | if: steps.cache.outputs.cache-hit != 'true' |
| 50 | - name: Install NDK |
| 51 | if: steps.cache.outputs.cache-hit != 'true' |
| 52 | run: | |
| 53 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 54 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 55 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 56 | - name: Native Build |
| 57 | if: steps.cache.outputs.cache-hit != 'true' |
| 58 | run: | |
| 59 | sudo apt-get install yasm -y |
| 60 | ./run init libs libvpx |
| 61 | ./run init libs ffmpeg |
| 62 | boringssl: |
| 63 | name: Native Build (BoringSSL) |
| 64 | runs-on: ubuntu-latest |
| 65 | needs: check |
| 66 | steps: |
| 67 | - name: Checkout |
| 68 | uses: actions/checkout@v2 |
| 69 | - name: Fetch Status |
| 70 | run: | |
| 71 | sed -i 's/\/\///g' settings.gradle |
| 72 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 73 | - name: BoringSSL Cache |
| 74 | id: cache |
| 75 | uses: actions/cache@v2 |
| 76 | with: |
| 77 | path: | |
| 78 | TMessagesProj/jni/boringssl/build |
| 79 | key: ${{ hashFiles('boringssl_status') }} |
| 80 | - name: Set up JDK 17 |
| 81 | uses: actions/setup-java@v3 |
| 82 | if: steps.cache.outputs.cache-hit != 'true' |
| 83 | with: |
| 84 | java-version: '17' |
| 85 | distribution: 'temurin' |
| 86 | - name: Setup Android SDK Tools |
| 87 | uses: android-actions/setup-android@v3 |
| 88 | if: steps.cache.outputs.cache-hit != 'true' |
| 89 | - name: Install NDK |
| 90 | if: steps.cache.outputs.cache-hit != 'true' |
| 91 | run: | |
| 92 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 93 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 94 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 95 | - name: Native Build |
| 96 | if: steps.cache.outputs.cache-hit != 'true' |
| 97 | run: | |
| 98 | ./run init action boringssl |
| 99 | ./run init libs boringssl |
| 100 | native: |
| 101 | name: Native Build (Telegram) |
| 102 | runs-on: ubuntu-latest |
| 103 | needs: |
| 104 | - ffmpeg |
| 105 | - boringssl |
| 106 | strategy: |
| 107 | matrix: |
| 108 | flavor: |
| 109 | - armeabi-v7a |
| 110 | - arm64-v8a |
| 111 | steps: |
| 112 | - name: Checkout |
| 113 | uses: actions/checkout@v2 |
| 114 | - name: Fetch Status |
| 115 | run: | |
| 116 | sed -i 's/\/\///g' settings.gradle |
| 117 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 118 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 119 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 120 | - name: Native Cache |
| 121 | id: cache |
| 122 | uses: actions/cache@v2 |
| 123 | with: |
| 124 | path: | |
| 125 | TMessagesProj/src/main/libs |
| 126 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 127 | - name: Checkout Library |
| 128 | if: steps.cache.outputs.cache-hit != 'true' |
| 129 | run: | |
| 130 | git submodule update --init 'TMessagesProj/jni/*' |
| 131 | - name: FFmpeg Cache |
| 132 | uses: actions/cache@v2 |
| 133 | if: steps.cache.outputs.cache-hit != 'true' |
| 134 | with: |
| 135 | path: | |
| 136 | TMessagesProj/jni/ffmpeg/build |
| 137 | TMessagesProj/jni/libvpx/build |
| 138 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 139 | - name: BoringSSL Cache |
| 140 | uses: actions/cache@v2 |
| 141 | if: steps.cache.outputs.cache-hit != 'true' |
| 142 | with: |
| 143 | path: | |
| 144 | TMessagesProj/jni/boringssl/build |
| 145 | key: ${{ hashFiles('boringssl_status') }} |
| 146 | - name: Set up JDK 17 |
| 147 | uses: actions/setup-java@v3 |
| 148 | if: steps.cache.outputs.cache-hit != 'true' |
| 149 | with: |
| 150 | java-version: '17' |
| 151 | distribution: 'temurin' |
| 152 | - name: Setup Android SDK Tools |
| 153 | uses: android-actions/setup-android@v3 |
| 154 | if: steps.cache.outputs.cache-hit != 'true' |
| 155 | - name: Install NDK |
| 156 | if: steps.cache.outputs.cache-hit != 'true' |
| 157 | run: | |
| 158 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 159 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 160 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 161 | - name: Fix BoringSSL |
| 162 | if: steps.cache.outputs.cache-hit != 'true' |
| 163 | run: | |
| 164 | cd TMessagesProj/jni |
| 165 | ./patch_boringssl.sh |
| 166 | - name: Native Build |
| 167 | if: steps.cache.outputs.cache-hit != 'true' |
| 168 | run: | |
| 169 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 170 | ./run libs native |
| 171 | v2ray: |
| 172 | name: Native Build (V2ray) |
| 173 | runs-on: ubuntu-latest |
| 174 | needs: check |
| 175 | steps: |
| 176 | - name: Checkout |
| 177 | uses: actions/checkout@v2 |
| 178 | - name: Fetch Status |
| 179 | run: | |
| 180 | sed -i 's/\/\///g' settings.gradle |
| 181 | git submodule status v2ray > v2ray_status |
| 182 | - name: V2ray Cache |
| 183 | id: cache |
| 184 | uses: actions/cache@v2 |
| 185 | with: |
| 186 | path: | |
| 187 | TMessagesProj/libs/libv2ray.aar |
| 188 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 189 | - name: Set up JDK 17 |
| 190 | uses: actions/setup-java@v3 |
| 191 | if: steps.cache.outputs.cache-hit != 'true' |
| 192 | with: |
| 193 | java-version: '17' |
| 194 | distribution: 'temurin' |
| 195 | - name: Setup Android SDK Tools |
| 196 | uses: android-actions/setup-android@v3 |
| 197 | if: steps.cache.outputs.cache-hit != 'true' |
| 198 | - name: Install NDK |
| 199 | if: steps.cache.outputs.cache-hit != 'true' |
| 200 | run: | |
| 201 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 202 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 203 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 204 | - name: Install Golang |
| 205 | uses: actions/setup-go@v2 |
| 206 | if: steps.cache.outputs.cache-hit != 'true' |
| 207 | with: |
| 208 | go-version: 1.16 |
| 209 | - name: Native Build |
| 210 | if: steps.cache.outputs.cache-hit != 'true' |
| 211 | run: ./run libs v2ray |
| 212 | shadowsocks: |
| 213 | name: Native Build (Shadowsocks) |
| 214 | runs-on: ubuntu-latest |
| 215 | needs: check |
| 216 | steps: |
| 217 | - name: Checkout |
| 218 | uses: actions/checkout@v2 |
| 219 | - name: Fetch Status |
| 220 | run: | |
| 221 | sed -i 's/\/\///g' settings.gradle |
| 222 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 223 | - name: Shadowsocks Cache |
| 224 | id: cache |
| 225 | uses: actions/cache@v2 |
| 226 | with: |
| 227 | path: | |
| 228 | TMessagesProj/libs/ss-rust-release.aar |
| 229 | key: ${{ hashFiles('shadowsocks_status') }} |
| 230 | - name: Set up JDK 17 |
| 231 | uses: actions/setup-java@v3 |
| 232 | if: steps.cache.outputs.cache-hit != 'true' |
| 233 | with: |
| 234 | java-version: '17' |
| 235 | distribution: 'temurin' |
| 236 | - name: Setup Android SDK Tools |
| 237 | uses: android-actions/setup-android@v3 |
| 238 | if: steps.cache.outputs.cache-hit != 'true' |
| 239 | - name: Install NDK |
| 240 | if: steps.cache.outputs.cache-hit != 'true' |
| 241 | run: | |
| 242 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 243 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 244 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 245 | - name: Install Rust |
| 246 | if: steps.cache.outputs.cache-hit != 'true' |
| 247 | run: ./run init action shadowsocks |
| 248 | - name: Native Build |
| 249 | if: steps.cache.outputs.cache-hit != 'true' |
| 250 | run: ./run libs shadowsocks |
| 251 | shadowsocksr: |
| 252 | name: Native Build (ShadowsocksR) |
| 253 | runs-on: ubuntu-latest |
| 254 | needs: check |
| 255 | steps: |
| 256 | - name: Checkout |
| 257 | uses: actions/checkout@v2 |
| 258 | - name: Fetch Status |
| 259 | run: | |
| 260 | sed -i 's/\/\///g' settings.gradle |
| 261 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 262 | - name: ShadowsocksR Cache |
| 263 | id: cache |
| 264 | uses: actions/cache@v2 |
| 265 | with: |
| 266 | path: | |
| 267 | TMessagesProj/libs/ssr-libev-release.aar |
| 268 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 269 | - name: Set up JDK 17 |
| 270 | uses: actions/setup-java@v3 |
| 271 | if: steps.cache.outputs.cache-hit != 'true' |
| 272 | with: |
| 273 | java-version: '17' |
| 274 | distribution: 'temurin' |
| 275 | - name: Setup Android SDK Tools |
| 276 | uses: android-actions/setup-android@v3 |
| 277 | if: steps.cache.outputs.cache-hit != 'true' |
| 278 | - name: Install NDK |
| 279 | if: steps.cache.outputs.cache-hit != 'true' |
| 280 | run: | |
| 281 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 282 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 283 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 284 | - name: Native Build |
| 285 | if: steps.cache.outputs.cache-hit != 'true' |
| 286 | run: ./run libs ssr |
| 287 | build: |
| 288 | name: Gradle Build |
| 289 | runs-on: ubuntu-latest |
| 290 | needs: |
| 291 | - native |
| 292 | - v2ray |
| 293 | - shadowsocks |
| 294 | - shadowsocksr |
| 295 | strategy: |
| 296 | matrix: |
| 297 | flavor: |
| 298 | # - FullRelease |
| 299 | - MiniRelease |
| 300 | steps: |
| 301 | - name: Checkout |
| 302 | uses: actions/checkout@v2 |
| 303 | - name: Set up JDK 17 |
| 304 | uses: actions/setup-java@v3 |
| 305 | with: |
| 306 | java-version: '17' |
| 307 | distribution: 'temurin' |
| 308 | - name: Setup Android SDK Tools |
| 309 | uses: android-actions/setup-android@v3 |
| 310 | - name: Install NDK |
| 311 | run: | |
| 312 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 313 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 314 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 315 | - name: Fetch Status |
| 316 | run: | |
| 317 | sed -i 's/\/\///g' settings.gradle |
| 318 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 319 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 320 | git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status |
| 321 | git submodule status 'ssr-libev/*' > shadowsocksr_status |
| 322 | git submodule status v2ray > v2ray_status |
| 323 | - name: Native Cache (armeabi-v7a) |
| 324 | uses: actions/cache@v2 |
| 325 | with: |
| 326 | path: | |
| 327 | TMessagesProj/src/main/libs |
| 328 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 329 | - name: Native Cache (arm64-v8a) |
| 330 | uses: actions/cache@v2 |
| 331 | with: |
| 332 | path: | |
| 333 | TMessagesProj/src/main/libs |
| 334 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 335 | - name: V2ray Cache |
| 336 | uses: actions/cache@v2 |
| 337 | with: |
| 338 | path: | |
| 339 | TMessagesProj/libs/libv2ray.aar |
| 340 | key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} |
| 341 | - name: Shadowsocks Cache |
| 342 | uses: actions/cache@v2 |
| 343 | with: |
| 344 | path: | |
| 345 | TMessagesProj/libs/ss-rust-release.aar |
| 346 | key: ${{ hashFiles('shadowsocks_status') }} |
| 347 | - name: ShadowsocksR Cache |
| 348 | uses: actions/cache@v2 |
| 349 | with: |
| 350 | path: | |
| 351 | TMessagesProj/libs/ssr-libev-release.aar |
| 352 | key: ${{ hashFiles('shadowsocksr_status') }} |
| 353 | - name: Configure Gradle |
| 354 | run: | |
| 355 | sed -i -e "s/16384/6144/g" gradle.properties |
| 356 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 357 | - name: Gradle cache |
| 358 | uses: actions/cache@v2 |
| 359 | with: |
| 360 | path: ~/.gradle |
| 361 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 362 | - name: Debug Build |
| 363 | run: | |
| 364 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 365 | export DEBUG_BUILD=true |
| 366 | sed -i 's/signingConfig signingConfigs.release//g' TMessagesProj/build.gradle |
| 367 | ./gradlew TMessagesProj:assemble${{ matrix.flavor }} |
| 368 |
| 369 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 370 | APK=$(dirname $APK) |
| 371 | echo "APK=$APK" >> $GITHUB_ENV |
| 372 | - uses: actions/upload-artifact@v2 |
| 373 | with: |
| 374 | name: ${{ matrix.flavor }} |
| 375 | path: ${{ env.APK }} |
| 376 |