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