| 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 | build: |
| 172 | name: Gradle Build |
| 173 | runs-on: ubuntu-latest |
| 174 | needs: |
| 175 | - native |
| 176 | steps: |
| 177 | - name: Checkout |
| 178 | uses: actions/checkout@v2 |
| 179 | - name: Set up JDK 17 |
| 180 | uses: actions/setup-java@v3 |
| 181 | with: |
| 182 | java-version: '17' |
| 183 | distribution: 'temurin' |
| 184 | - name: Setup Android SDK Tools |
| 185 | uses: android-actions/setup-android@v3 |
| 186 | - name: Install NDK |
| 187 | run: | |
| 188 | echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 189 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 190 | echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties |
| 191 | - name: Fetch Status |
| 192 | run: | |
| 193 | sed -i 's/\/\///g' settings.gradle |
| 194 | git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status |
| 195 | git submodule status TMessagesProj/jni/boringssl > boringssl_status |
| 196 | - name: Native Cache (armeabi-v7a) |
| 197 | uses: actions/cache@v2 |
| 198 | with: |
| 199 | path: | |
| 200 | TMessagesProj/src/main/libs |
| 201 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a |
| 202 | - name: Native Cache (arm64-v8a) |
| 203 | uses: actions/cache@v2 |
| 204 | with: |
| 205 | path: | |
| 206 | TMessagesProj/src/main/libs |
| 207 | key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a |
| 208 | - name: Configure Gradle |
| 209 | run: | |
| 210 | sed -i -e "s/16384/6144/g" gradle.properties |
| 211 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 212 | - name: Gradle cache |
| 213 | uses: actions/cache@v2 |
| 214 | with: |
| 215 | path: ~/.gradle |
| 216 | key: gradle-${{ hashFiles('**/*.gradle') }} |
| 217 | - name: Debug Build |
| 218 | run: | |
| 219 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 220 | export DEBUG_BUILD=true |
| 221 | sed -i 's/signingConfig signingConfigs.release//g' TMessagesProj/build.gradle |
| 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: Debug |
| 230 | path: ${{ env.APK }} |
| 231 |