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