| 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: Set up JDK 17 |
| 44 | uses: actions/setup-java@v3 |
| 45 | if: steps.cache.outputs.cache-hit != 'true' |
| 46 | with: |
| 47 | java-version: '17' |
| 48 | distribution: 'temurin' |
| 49 | - name: Setup Android SDK Tools |
| 50 | uses: android-actions/setup-android@v3 |
| 51 | if: steps.cache.outputs.cache-hit != 'true' |
| 52 | - name: Install NDK |
| 53 | if: steps.cache.outputs.cache-hit != 'true' |
| 54 | run: | |
| 55 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 56 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 57 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 58 | - name: Native Build |
| 59 | if: steps.cache.outputs.cache-hit != 'true' |
| 60 | run: | |
| 61 | sudo apt-get install yasm -y |
| 62 | ./run init libs libvpx |
| 63 | ./run init libs ffmpeg |
| 64 | boringssl: |
| 65 | name: Native Build (BoringSSL) |
| 66 | runs-on: ubuntu-latest |
| 67 | needs: check |
| 68 | steps: |
| 69 | - name: Checkout |
| 70 | uses: actions/checkout@v2 |
| 71 | - name: Fetch Status |
| 72 | run: | |
| 73 | sed -i 's/\/\///g' settings.gradle |
| 74 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 75 | - name: BoringSSL Cache |
| 76 | id: cache |
| 77 | uses: actions/cache@v2 |
| 78 | with: |
| 79 | path: | |
| 80 | TMessagesProj/jni/boringssl/build |
| 81 | key: ${{ hashFiles('boringssl_status') }} |
| 82 | - name: Set up JDK 17 |
| 83 | uses: actions/setup-java@v3 |
| 84 | if: steps.cache.outputs.cache-hit != 'true' |
| 85 | with: |
| 86 | java-version: '17' |
| 87 | distribution: 'temurin' |
| 88 | - name: Setup Android SDK Tools |
| 89 | uses: android-actions/setup-android@v3 |
| 90 | if: steps.cache.outputs.cache-hit != 'true' |
| 91 | - name: Install NDK |
| 92 | if: steps.cache.outputs.cache-hit != 'true' |
| 93 | run: | |
| 94 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 95 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 96 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 97 | - name: Native Build |
| 98 | if: steps.cache.outputs.cache-hit != 'true' |
| 99 | run: | |
| 100 | ./run init action boringssl |
| 101 | ./run init libs boringssl |
| 102 | native: |
| 103 | name: Native Build (Telegram) |
| 104 | runs-on: ubuntu-latest |
| 105 | needs: |
| 106 | - ffmpeg |
| 107 | - boringssl |
| 108 | strategy: |
| 109 | matrix: |
| 110 | flavor: |
| 111 | - armeabi-v7a |
| 112 | - arm64-v8a |
| 113 | steps: |
| 114 | - name: Checkout |
| 115 | uses: actions/checkout@v2 |
| 116 | - name: Fetch Status |
| 117 | run: | |
| 118 | sed -i 's/\/\///g' settings.gradle |
| 119 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 120 | git submodule status TMessagesProj/jni/libvpx > libvpx_status |
| 121 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 122 | - name: Native Cache |
| 123 | id: cache |
| 124 | uses: actions/cache@v2 |
| 125 | with: |
| 126 | path: | |
| 127 | TMessagesProj/src/main/libs |
| 128 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 129 | - name: Checkout Library |
| 130 | if: steps.cache.outputs.cache-hit != 'true' |
| 131 | run: | |
| 132 | git submodule update --init 'TMessagesProj/jni/*' |
| 133 | - name: FFmpeg Cache |
| 134 | uses: actions/cache@v2 |
| 135 | if: steps.cache.outputs.cache-hit != 'true' |
| 136 | with: |
| 137 | path: | |
| 138 | TMessagesProj/jni/ffmpeg/build |
| 139 | TMessagesProj/jni/libvpx/build |
| 140 | key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} |
| 141 | - name: BoringSSL Cache |
| 142 | uses: actions/cache@v2 |
| 143 | if: steps.cache.outputs.cache-hit != 'true' |
| 144 | with: |
| 145 | path: | |
| 146 | TMessagesProj/jni/boringssl/build |
| 147 | key: ${{ hashFiles('boringssl_status') }} |
| 148 | - name: Set up JDK 17 |
| 149 | uses: actions/setup-java@v3 |
| 150 | if: steps.cache.outputs.cache-hit != 'true' |
| 151 | with: |
| 152 | java-version: '17' |
| 153 | distribution: 'temurin' |
| 154 | - name: Setup Android SDK Tools |
| 155 | uses: android-actions/setup-android@v3 |
| 156 | if: steps.cache.outputs.cache-hit != 'true' |
| 157 | - name: Install NDK |
| 158 | if: steps.cache.outputs.cache-hit != 'true' |
| 159 | run: | |
| 160 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 161 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 162 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 163 | - name: Fix BoringSSL |
| 164 | if: steps.cache.outputs.cache-hit != 'true' |
| 165 | run: | |
| 166 | cd TMessagesProj/jni |
| 167 | ./patch_boringssl.sh |
| 168 | - name: Native Build |
| 169 | if: steps.cache.outputs.cache-hit != 'true' |
| 170 | run: | |
| 171 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 172 | ./run libs native |
| 173 | build: |
| 174 | name: Gradle Build |
| 175 | runs-on: ubuntu-latest |
| 176 | needs: |
| 177 | - native |
| 178 | steps: |
| 179 | - name: Checkout |
| 180 | uses: actions/checkout@v2 |
| 181 | - name: Set up JDK 17 |
| 182 | uses: actions/setup-java@v3 |
| 183 | with: |
| 184 | java-version: '17' |
| 185 | distribution: 'temurin' |
| 186 | - name: Setup Android SDK Tools |
| 187 | uses: android-actions/setup-android@v3 |
| 188 | - name: Install NDK |
| 189 | run: | |
| 190 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 191 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 192 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 193 | - name: Fetch Status |
| 194 | run: | |
| 195 | sed -i 's/\/\///g' settings.gradle |
| 196 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 197 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 198 | - name: Native Cache (armeabi-v7a) |
| 199 | uses: actions/cache@v2 |
| 200 | with: |
| 201 | path: | |
| 202 | TMessagesProj/src/main/libs |
| 203 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 204 | - name: Native Cache (arm64-v8a) |
| 205 | uses: actions/cache@v2 |
| 206 | with: |
| 207 | path: | |
| 208 | TMessagesProj/src/main/libs |
| 209 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 210 | - name: Configure Gradle |
| 211 | run: | |
| 212 | sed -i -e "s/16384/6144/g" gradle.properties |
| 213 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 214 | - name: Gradle cache |
| 215 | uses: actions/cache@v2 |
| 216 | with: |
| 217 | path: ~/.gradle |
| 218 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 219 | - name: Debug Build |
| 220 | run: | |
| 221 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 222 | ./gradlew TMessagesProj:assembleRelease |
| 223 |
| 224 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 225 | APK=$(dirname $APK) |
| 226 | echo "APK=$APK" >> $GITHUB_ENV |
| 227 | - uses: actions/upload-artifact@v4 |
| 228 | with: |
| 229 | name: Release |
| 230 | path: ${{ env.APK }} |
| 231 | upload: |
| 232 | name: Upload debug |
| 233 | if: github.event.inputs.upload != 'y' |
| 234 | runs-on: ubuntu-latest |
| 235 | needs: |
| 236 | - build |
| 237 | steps: |
| 238 | - name: Checkout |
| 239 | uses: actions/checkout@v4 |
| 240 | - name: Donwload Artifacts |
| 241 | uses: actions/download-artifact@v4 |
| 242 | with: |
| 243 | path: artifacts |
| 244 | - name: Set up Python |
| 245 | uses: actions/setup-python@v5 |
| 246 | with: |
| 247 | python-version: 3.12 |
| 248 | - name: Send to Telegram |
| 249 | run: | |
| 250 | # send release via telegram bot api |
| 251 | export mini64=$(find artifacts -name "*arm64-v8a.apk") |
| 252 | export mini32=$(find artifacts -name "*armeabi-v7a.apk") |
| 253 |
| 254 | echo $mini64 |
| 255 | echo $mini32 |
| 256 |
| 257 | python -m pip install -r bin/scripts/requirements.txt |
| 258 | git log -1 --pretty=format:"%s%n%n%b" > artifacts/caption.txt |
| 259 | python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} test |
| 260 |