From c0490eb86557eb172894778fef6d4c102636534e Mon Sep 17 00:00:00 2001 From: qwq233 Date: Fri, 8 Nov 2024 19:46:04 +0800 Subject: [PATCH] fix: ci Signed-off-by: qwq233 --- .github/workflows/ci.yml | 111 +++++++++++-------------------- .github/workflows/pr.yml | 24 ++++--- TMessagesProj/build.gradle.kts | 2 +- TMessagesProj/jni/CMakeLists.txt | 4 +- 4 files changed, 54 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17da0305c..102974d5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,42 +16,39 @@ jobs: build: name: Gradle Build if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" CCACHE_NOHASHDIR: "true" CCACHE_MAXSIZE: "10G" CCACHE_HARDLINK: "true" steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check out submodules run: | git -c submodule."libs/rust".update=none submodule update --init --recursive - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.12 - with: - cmake-version: '3.22.1' - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' cache: 'gradle' - name: Setup Gradle - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/actions/setup-gradle@v3 - name: Set up ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@v1 with: key: ccache-stable restore-keys: ccache-stable - name: Setup Android SDK Tools - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Prepare Environment run: | echo "Removing large packages" - sudo apt-get remove -y '^dotnet-.*' aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 + sudo apt-get remove -y '^dotnet-.*' sudo apt-get remove -y '^llvm-.*' sudo apt-get remove -y 'php.*' sudo apt-get remove -y '^mongodb-.*' @@ -72,8 +69,12 @@ jobs: sudo apt-get install wget bison gcc make curl ninja-build -y echo "y" | sdkmanager --install "ndk;$ndkversion" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null - wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang - chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang + echo "y" | sdkmanager --install "cmake;3.31.0" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + + wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18 + chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18 + touch ${ANDROID_SDK_ROOT}/ndk/$ndkversion/enable_ollvm + echo "sdk.dir=${ANDROID_HOME}" >> local.properties - name: Debug Build run: | @@ -106,8 +107,8 @@ jobs: play-build: - name: Gradle Build (play store) - runs-on: ubuntu-latest + name: Gradle Build (Play Store) + runs-on: ubuntu-24.04 if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }} env: CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" @@ -115,35 +116,32 @@ jobs: CCACHE_MAXSIZE: "5G" CCACHE_HARDLINK: "true" steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check out submodules run: | git -c submodule."libs/rust".update=none submodule update --init --recursive - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.12 - with: - cmake-version: '3.22.1' - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' cache: 'gradle' - name: Setup Gradle - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/actions/setup-gradle@v3 - name: Set up ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@v1 with: key: ccache restore-keys: ccache - name: Setup Android SDK Tools - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Prepare Environment run: | echo "Removing large packages" - sudo apt-get remove -y '^dotnet-.*' aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 + sudo apt-get remove -y '^dotnet-.*' sudo apt-get remove -y '^llvm-.*' sudo apt-get remove -y 'php.*' sudo apt-get remove -y '^mongodb-.*' @@ -164,8 +162,12 @@ jobs: sudo apt-get install bison gcc make wget curl ninja-build -y echo "y" | sdkmanager --install "ndk;$ndkversion" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null - wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang - chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang + echo "y" | sdkmanager --install "cmake;3.31.0" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + + wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18 + chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18 + touch ${ANDROID_SDK_ROOT}/ndk/$ndkversion/enable_ollvm + echo "sdk.dir=${ANDROID_HOME}" >> local.properties - name: Debug Build @@ -187,33 +189,32 @@ jobs: runs-on: ubuntu-latest needs: - build - - telegram-bot-api steps: - name: Donwload Artifacts uses: actions/download-artifact@v3 with: path: artifacts - - name: Download Telegram Bot API Binary - uses: actions/download-artifact@master - with: - name: telegram-bot-api-binary - path: . - - name: find apk + - name: Find apk run: | mkdir apks find artifacts -name "*.apk" -exec cp {} apks \; echo "APK_FILE_UPLOAD=$(find apks -name '*arm64*.apk')" >> $GITHUB_ENV - - name: Get Apk Info + - name: Get APK Info id: apk uses: JantHsueh/get-apk-info-action@master with: apkPath: ${{ env.APK_FILE_UPLOAD }} + - name: Set up Telegram Bot API + uses: zjns/telegram-bot-server@v1 + with: + api_id: 21724 + api_hash: 3e0cb5efcd52300aec5994fdfc5bdc16 + server-port: 8081 + - name: Release run: | - chmod +x telegram-bot-api-binary - ./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null & curl https://raw.githubusercontent.com/qwq233/qwq233/master/uploadCI.py -o uploadCI.py python uploadCI.py env: @@ -221,39 +222,3 @@ jobs: VERSION_CODE: ${{steps.apk.outputs.versionCode}} VERSION_NAME: ${{steps.apk.outputs.versionNum}} COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - - telegram-bot-api: - name: Telegram Bot API - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Clone Telegram Bot API - run: | - git clone --recursive https://github.com/tdlib/telegram-bot-api.git - git status telegram-bot-api >> telegram-bot-api-status - - name: Cache Bot API Binary - id: cache-bot-api - uses: actions/cache@v2 - with: - path: telegram-bot-api-binary - key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} - - name: Compile Telegram Bot API - if: steps.cache-bot-api.outputs.cache-hit != 'true' - run: | - sudo apt-get update - sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ - cd telegram-bot-api - rm -rf build - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. - cmake --build . --target install -j$(nproc) - cd ../.. - ls -l telegram-bot-api/bin/telegram-bot-api* - cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary - - name: Upload Binary - uses: actions/upload-artifact@master - with: - name: telegram-bot-api-binary - path: telegram-bot-api-binary diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 68c41b4c8..8ccf9175e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,42 +15,43 @@ jobs: build: name: Gradle Build if: ${{ github.event_name == 'pull_request' && success() }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" CCACHE_NOHASHDIR: "true" CCACHE_MAXSIZE: "10G" CCACHE_HARDLINK: "true" steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check out submodules run: | git -c submodule."libs/rust".update=none submodule update --init --recursive - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.12 + uses: jwlawson/actions-setup-cmake@v2 with: cmake-version: '3.22.1' - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' cache: 'gradle' - name: Setup Gradle - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/actions/setup-gradle@v3 - name: Set up ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@v1 with: key: ccache restore-keys: ccache - name: Setup Android SDK Tools - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Prepare Environment run: | echo "Removing large packages" - sudo apt-get remove -y '^dotnet-.*' aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 + sudo apt-get remove -y '^dotnet-.*' sudo apt-get remove -y '^llvm-.*' sudo apt-get remove -y 'php.*' sudo apt-get remove -y '^mongodb-.*' @@ -67,9 +68,12 @@ jobs: sudo rm -rf /usr/local/lib/node_modules df -h - sudo apt-get install bison gcc make curl ninja-build ccache -y - echo "y" | sdkmanager --install "ndk;27.0.12077973" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + export ndkversion="27.0.12077973" + + sudo apt-get install wget bison gcc make curl ninja-build -y + echo "y" | sdkmanager --install "ndk;$ndkversion" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" >> local.properties + - name: Debug Build run: | sed '/signingConfig =/d' TMessagesProj/build.gradle.kts > TMessagesProj/build.gradle.kts.tmp diff --git a/TMessagesProj/build.gradle.kts b/TMessagesProj/build.gradle.kts index 951c5e234..f676144b1 100644 --- a/TMessagesProj/build.gradle.kts +++ b/TMessagesProj/build.gradle.kts @@ -192,7 +192,7 @@ android { defaultConfig { externalNativeBuild { cmake { - version = "3.22.1" + version = "3.31.0" arguments += listOf( "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-27", diff --git a/TMessagesProj/jni/CMakeLists.txt b/TMessagesProj/jni/CMakeLists.txt index d0874faaf..160b8140b 100644 --- a/TMessagesProj/jni/CMakeLists.txt +++ b/TMessagesProj/jni/CMakeLists.txt @@ -26,10 +26,8 @@ ${CMAKE_HOME_DIRECTORY}/boringssl/lib/libssl_${ANDROID_ABI}.a, ${CMAKE_HOME_DIRECTORY}/boringssl/lib/libcrypto_${ANDROID_ABI}.a") if (UNIX) -if(EXISTS "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang") +if(EXISTS "${CMAKE_ANDROID_NDK}/enable_ollvm") message("ollvm enabled") - set(CMAKE_C_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang") - set(CMAKE_CXX_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/oclang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mllvm -fla -mllvm -split -mllvm -sub -mllvm -bcf") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -fla -mllvm -split -mllvm -sub -mllvm -bcf") endif()