| types: [opened, reopened, synchronize] |
| 6 | paths-ignore: |
| 7 | - '**.md' |
| 8 | - '**.xml' |
| 9 |
| 10 | jobs: |
| 11 | ffmpeg: |
| 12 | name: Native Build (FFmpeg) |
| 13 | runs-on: ubuntu-latest |
| 14 | steps: |
| 15 | - name: Checkout |
| 16 | uses: actions/checkout@v4 |
| 17 | - name: Fetch Status |
| 18 | run: | |
| 19 | sed -i 's/\/\///g' settings.gradle |
| 20 | git submodule status TMessagesProj/jni/third_party/ffmpeg > ffmpeg_status |
| 21 | git submodule status TMessagesProj/jni/third_party/dav1d > dav1d_status |
| 22 | git submodule status TMessagesProj/jni/third_party/libvpx > libvpx_status |
| 23 | - name: FFmpeg Cache |
| 24 | id: cache |
| 25 | uses: actions/cache@v4 |
| 26 | with: |
| 27 | path: | |
| 28 | TMessagesProj/jni/ffmpeg/build |
| 29 | key: ${{ hashFiles('ffmpeg_status', 'dav1d_status', 'libvpx_status', 'TMessagesProj/jni/third_party/build_*.sh') }} |
| 30 | - name: Set up Python 3.12 |
| 31 | uses: actions/setup-python@v5 |
| 32 | if: steps.cache.outputs.cache-hit != 'true' |
| 33 | with: |
| 34 | python-version: '3.12' |
| 35 | - name: Set up JDK 17 |
| 36 | uses: actions/setup-java@v3 |
| 37 | if: steps.cache.outputs.cache-hit != 'true' |
| 38 | with: |
| 39 | java-version: '17' |
| 40 | distribution: 'temurin' |
| 41 | - name: Setup Android SDK Tools |
| 42 | uses: android-actions/setup-android@v3 |
| 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;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 48 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 49 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 50 | - name: Native Build |
| 51 | if: steps.cache.outputs.cache-hit != 'true' |
| 52 | run: | |
| 53 | ./run init action ffmpeg |
| 54 | ./run init libs libvpx |
| 55 | ./run init libs dav1d |
| 56 | ./run init libs ffmpeg |
| 57 | boringssl: |
| 58 | name: Native Build (BoringSSL) |
| 59 | runs-on: ubuntu-latest |
| 60 | steps: |
| 61 | - name: Checkout |
| 62 | uses: actions/checkout@v4 |
| 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@v4 |
| 70 | with: |
| 71 | path: | |
| 72 | TMessagesProj/jni/boringssl/build |
| 73 | key: ${{ hashFiles('boringssl_status') }} |
| 74 | - name: Set up JDK 17 |
| 75 | uses: actions/setup-java@v3 |
| 76 | if: steps.cache.outputs.cache-hit != 'true' |
| 77 | with: |
| 78 | java-version: '17' |
| 79 | distribution: 'temurin' |
| 80 | - name: Setup Android SDK Tools |
| 81 | uses: android-actions/setup-android@v3 |
| 82 | if: steps.cache.outputs.cache-hit != 'true' |
| 83 | - name: Install NDK |
| 84 | if: steps.cache.outputs.cache-hit != 'true' |
| 85 | run: | |
| 86 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 87 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 88 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 89 | - name: Native Build |
| 90 | if: steps.cache.outputs.cache-hit != 'true' |
| 91 | run: | |
| 92 | ./run init action boringssl |
| 93 | ./run init libs boringssl |
| 94 | native: |
| 95 | name: Native Build (Telegram) |
| 96 | runs-on: ubuntu-latest |
| 97 | needs: |
| 98 | - ffmpeg |
| 99 | - boringssl |
| 100 | strategy: |
| 101 | matrix: |
| 102 | flavor: |
| 103 | - armeabi-v7a |
| 104 | - arm64-v8a |
| 105 | steps: |
| 106 | - name: Checkout |
| 107 | uses: actions/checkout@v4 |
| 108 | - name: Fetch Status |
| 109 | run: | |
| 110 | sed -i 's/\/\///g' settings.gradle |
| 111 | git submodule status TMessagesProj/jni/third_party/ffmpeg > ffmpeg_status |
| 112 | git submodule status TMessagesProj/jni/third_party/dav1d > dav1d_status |
| 113 | git submodule status TMessagesProj/jni/third_party/libvpx > libvpx_status |
| 114 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 115 | - name: Native Cache |
| 116 | id: cache |
| 117 | uses: actions/cache@v4 |
| 118 | with: |
| 119 | path: | |
| 120 | TMessagesProj/src/main/libs |
| 121 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} |
| 122 | - name: Checkout Library |
| 123 | if: steps.cache.outputs.cache-hit != 'true' |
| 124 | run: | |
| 125 | git submodule update --init 'TMessagesProj/jni/*' |
| 126 | - name: FFmpeg Cache |
| 127 | uses: actions/cache@v4 |
| 128 | if: steps.cache.outputs.cache-hit != 'true' |
| 129 | with: |
| 130 | path: | |
| 131 | TMessagesProj/jni/ffmpeg/build |
| 132 | key: ${{ hashFiles('ffmpeg_status', 'dav1d_status', 'libvpx_status', 'TMessagesProj/jni/third_party/build_*.sh') }} |
| 133 | - name: BoringSSL Cache |
| 134 | uses: actions/cache@v4 |
| 135 | if: steps.cache.outputs.cache-hit != 'true' |
| 136 | with: |
| 137 | path: | |
| 138 | TMessagesProj/jni/boringssl/build |
| 139 | key: ${{ hashFiles('boringssl_status') }} |
| 140 | - name: Set up JDK 17 |
| 141 | uses: actions/setup-java@v3 |
| 142 | if: steps.cache.outputs.cache-hit != 'true' |
| 143 | with: |
| 144 | java-version: '17' |
| 145 | distribution: 'temurin' |
| 146 | - name: Setup Android SDK Tools |
| 147 | uses: android-actions/setup-android@v3 |
| 148 | if: steps.cache.outputs.cache-hit != 'true' |
| 149 | - name: Install NDK |
| 150 | if: steps.cache.outputs.cache-hit != 'true' |
| 151 | run: | |
| 152 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 153 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 154 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 155 | - name: Fix BoringSSL |
| 156 | if: steps.cache.outputs.cache-hit != 'true' |
| 157 | run: | |
| 158 | cd TMessagesProj/jni |
| 159 | ./patch_boringssl.sh |
| 160 | - name: Native Build |
| 161 | if: steps.cache.outputs.cache-hit != 'true' |
| 162 | run: | |
| 163 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 164 | ./run libs native |
| 165 | build: |
| 166 | name: Gradle Build |
| 167 | runs-on: ubuntu-latest |
| 168 | needs: |
| 169 | - native |
| 170 | steps: |
| 171 | - name: Checkout |
| 172 | uses: actions/checkout@v4 |
| 173 | - name: Set up JDK 17 |
| 174 | uses: actions/setup-java@v3 |
| 175 | with: |
| 176 | java-version: '17' |
| 177 | distribution: 'temurin' |
| 178 | - name: Setup Android SDK Tools |
| 179 | uses: android-actions/setup-android@v3 |
| 180 | - name: Install NDK |
| 181 | run: | |
| 182 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 183 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 184 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 185 | - name: Fetch Status |
| 186 | run: | |
| 187 | sed -i 's/\/\///g' settings.gradle |
| 188 | git submodule status TMessagesProj/jni/third_party/ffmpeg > ffmpeg_status |
| 189 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 190 | - name: Native Cache (armeabi-v7a) |
| 191 | uses: actions/cache@v4 |
| 192 | with: |
| 193 | path: | |
| 194 | TMessagesProj/src/main/libs |
| 195 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 196 | - name: Native Cache (arm64-v8a) |
| 197 | uses: actions/cache@v4 |
| 198 | with: |
| 199 | path: | |
| 200 | TMessagesProj/src/main/libs |
| 201 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 202 | - name: Configure Gradle |
| 203 | run: | |
| 204 | sed -i "s/2000000000000/$(date +%s%N | cut -c1-13)/g" gradle.properties |
| 205 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 206 | - name: Setup Gradle |
| 207 | uses: gradle/actions/setup-gradle@v6 |
| 208 | - name: Debug Build |
| 209 | run: | |
| 210 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 211 | export DEBUG_BUILD=true |
| 212 | sed -i 's/signingConfig signingConfigs.release//g' TMessagesProj/build.gradle |
| 213 | ./gradlew TMessagesProj:assembleRelease --build-cache --no-configuration-cache |
| 214 |
| 215 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 216 | APK=$(dirname $APK) |
| 217 | echo "APK=$APK" >> $GITHUB_ENV |
| 218 | - uses: actions/upload-artifact@v4 |
| 219 | with: |
| 220 | name: Debug |
| 221 | path: ${{ env.APK }} |
| 222 |