| types: [opened, reopened, synchronize] |
| 6 | paths-ignore: |
| 7 | - '**.md' |
| 8 | - '**.xml' |
| 9 |
| 10 | jobs: |
| 11 | native: |
| 12 | name: Native Build (Telegram) |
| 13 | runs-on: ubuntu-latest |
| 14 | strategy: |
| 15 | matrix: |
| 16 | flavor: |
| 17 | - armeabi-v7a |
| 18 | - arm64-v8a |
| 19 | steps: |
| 20 | - name: Checkout |
| 21 | uses: actions/checkout@v7 |
| 22 | - name: Fetch Status |
| 23 | run: | |
| 24 | sed -i 's/\/\///g' settings.gradle |
| 25 | - name: Native Cache |
| 26 | id: cache |
| 27 | uses: actions/cache@v6 |
| 28 | with: |
| 29 | path: | |
| 30 | TMessagesProj/src/main/libs |
| 31 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-${{ matrix.flavor }} |
| 32 | - name: Checkout Library |
| 33 | if: steps.cache.outputs.cache-hit != 'true' |
| 34 | run: | |
| 35 | git submodule update --init |
| 36 | - name: Set up JDK 17 |
| 37 | uses: actions/setup-java@v6 |
| 38 | if: steps.cache.outputs.cache-hit != 'true' |
| 39 | with: |
| 40 | java-version: '17' |
| 41 | distribution: 'temurin' |
| 42 | - name: Setup Android SDK Tools |
| 43 | uses: android-actions/setup-android@v4 |
| 44 | if: steps.cache.outputs.cache-hit != 'true' |
| 45 | with: |
| 46 | packages: 'platform-tools' |
| 47 | - name: Install NDK |
| 48 | if: steps.cache.outputs.cache-hit != 'true' |
| 49 | run: | |
| 50 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 51 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 52 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 53 | - name: Native Build |
| 54 | if: steps.cache.outputs.cache-hit != 'true' |
| 55 | run: | |
| 56 | export NATIVE_TARGET="${{ matrix.flavor }}" |
| 57 | ./run init libs |
| 58 | ./run libs native |
| 59 | build: |
| 60 | name: Gradle Build |
| 61 | runs-on: ubuntu-latest |
| 62 | needs: |
| 63 | - native |
| 64 | steps: |
| 65 | - name: Checkout |
| 66 | uses: actions/checkout@v7 |
| 67 | - name: Fetch Status |
| 68 | run: | |
| 69 | sed -i 's/\/\///g' settings.gradle |
| 70 | - name: Native Cache (armeabi-v7a) |
| 71 | uses: actions/cache@v6 |
| 72 | with: |
| 73 | path: | |
| 74 | TMessagesProj/src/main/libs |
| 75 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-armeabi-v7a |
| 76 | - name: Native Cache (arm64-v8a) |
| 77 | uses: actions/cache@v6 |
| 78 | with: |
| 79 | path: | |
| 80 | TMessagesProj/src/main/libs |
| 81 | key: ${{ hashFiles('TMessagesProj/jni/**') }}-arm64-v8a |
| 82 | - name: Checkout Library |
| 83 | run: | |
| 84 | git submodule update --init |
| 85 | - name: Set up JDK 17 |
| 86 | uses: actions/setup-java@v6 |
| 87 | with: |
| 88 | java-version: '17' |
| 89 | distribution: 'temurin' |
| 90 | - name: Setup Android SDK Tools |
| 91 | uses: android-actions/setup-android@v4 |
| 92 | with: |
| 93 | packages: 'platform-tools' |
| 94 | - name: Install NDK |
| 95 | run: | |
| 96 | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null |
| 97 | echo "sdk.dir=${ANDROID_HOME}" > local.properties |
| 98 | echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties |
| 99 | - name: Configure Gradle |
| 100 | run: | |
| 101 | sed -i "s/2000000000000/$(date +%s%N | cut -c1-13)/g" gradle.properties |
| 102 | echo "sdk.dir=${ANDROID_HOME}" >> local.properties |
| 103 | - name: Setup Gradle |
| 104 | uses: gradle/actions/setup-gradle@v6 |
| 105 | - name: Debug Build |
| 106 | run: | |
| 107 | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" |
| 108 | export DEBUG_BUILD=true |
| 109 | sed -i 's/signingConfig signingConfigs.release//g' TMessagesProj/build.gradle |
| 110 | ./gradlew TMessagesProj:assembleRelease --build-cache --no-configuration-cache |
| 111 |
| 112 | APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') |
| 113 | APK=$(dirname $APK) |
| 114 | echo "APK=$APK" >> $GITHUB_ENV |
| 115 | - uses: actions/upload-artifact@v7 |
| 116 | with: |
| 117 | name: Debug |
| 118 | path: ${{ env.APK }} |
| 119 |