From 2f23001a8eb7501ed53dcc3c7057d1ddcd6c0e49 Mon Sep 17 00:00:00 2001 From: NkBe Date: Wed, 3 Sep 2025 22:05:08 +0800 Subject: [PATCH] Adjust Workflows --- .github/workflows/clean.yml | 17 ++++++ .github/workflows/{main.yml => master.yml} | 71 ++++++++++++++-------- 2 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/clean.yml rename .github/workflows/{main.yml => master.yml} (61%) diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 0000000..217d80a --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,17 @@ +name: Clean Gradle Cache + +on: + workflow_dispatch: + +jobs: + clean: + runs-on: ubuntu-latest + steps: + - name: 删除 Gradle 缓存 + run: rm -rf ~/.gradle/caches/ + + - name: 删除 m2 缓存 + run: rm -rf ~/.m2/repository/ + + - name: 删除 ccache 缓存 + run: rm -rf ~/.ccache/ \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/master.yml similarity index 61% rename from .github/workflows/main.yml rename to .github/workflows/master.yml index 9c7140e..68403e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/master.yml @@ -1,28 +1,52 @@ -name: Build Android CI +name: Build CI on: workflow_dispatch: jobs: build: - name: Build on Ubuntu - runs-on: ubuntu-latest + runs-on: macos-latest env: CCACHE_COMPILERCHECK: '%compiler% -dumpmachine; %compiler% -dumpversion' CCACHE_NOHASHDIR: 'true' CCACHE_HARDLINK: 'true' - CCACHE_BASEDIR: '${{ github.workspace }}' + CCACHE_BASEDIR: ${{ github.workspace }} steps: - name: Checkout uses: actions/checkout@v4 - continue-on-error: true with: - submodules: 'recursive' + submodules: recursive fetch-depth: 0 - - name: Write key - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Cache Maven local repo + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ hashFiles('**/build.gradle*') }} + restore-keys: | + ${{ runner.os }}-m2- + + - name: Cache ccache + uses: actions/cache@v4 + with: + path: ~/.ccache + key: ${{ runner.os }}-ccache-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-ccache- + + - name: Write signing key if needed + if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' run: | if [ ! -z "${{ secrets.KEY_STORE }}" ]; then echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties @@ -63,51 +87,50 @@ jobs: version: 1.12.0 - name: Remove Android's cmake - shell: bash run: rm -rf $ANDROID_HOME/cmake - name: Build local dependencies run: | echo "--- Building API dependency ---" cd libxposed/api - ./gradlew :api:publishApiPublicationToMavenLocal + ./gradlew :api:publishApiPublicationToMavenLocal --no-daemon echo "--- Building Service Interface dependency ---" cd ../service - ./gradlew :interface:publishInterfacePublicationToMavenLocal + ./gradlew :interface:publishInterfacePublicationToMavenLocal --no-daemon - name: Set short commit id - run: echo "commit=$(echo ${{ github.sha }} | cut -c-7)" > $GITHUB_ENV + run: echo "commit=$(echo ${{ github.sha }} | cut -c-7)" >> $GITHUB_ENV - name: Build with Gradle run: | echo 'org.gradle.parallel=true' >> gradle.properties - echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties + echo 'org.gradle.jvmargs=-Xmx3g' >> gradle.properties echo 'android.native.buildOutput=verbose' >> gradle.properties ./gradlew buildAll - name: Upload Debug artifact uses: actions/upload-artifact@v4 with: - name: lspatch-debug - path: out/debug/* + name: npatch-debug + path: out/debug/* - name: Upload Release artifact uses: actions/upload-artifact@v4 with: - name: lspatch-release - path: out/release/* + name: npatch-release + path: out/release/* - name: Upload mappings uses: actions/upload-artifact@v4 with: - name: mappings - path: | - patch-loader/build/outputs/mapping - manager/build/outputs/mapping + name: mappings + path: | + patch-loader/build/outputs/mapping + manager/build/outputs/mapping - name: Upload symbols uses: actions/upload-artifact@v4 with: - name: symbols - path: | - patch-loader/build/symbols + name: symbols + path: | + patch-loader/build/symbols \ No newline at end of file