Adjust Workflows

This commit is contained in:
NkBe 2025-09-03 22:05:08 +08:00
parent 7142050894
commit 2f23001a8e
No known key found for this signature in database
GPG Key ID: 75EF144ED8F4D7B8
2 changed files with 64 additions and 24 deletions

17
.github/workflows/clean.yml vendored Normal file
View File

@ -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/

View File

@ -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