Use gradle-build-action to cache more files (#2400)

This commit is contained in:
Howard Wu 2023-02-27 02:52:49 +08:00 committed by GitHub
parent c7f39e0e5d
commit a31162e284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 149 additions and 131 deletions

View File

@ -2,6 +2,11 @@ name: Core
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
post_telegram:
description: 'Post to Telegram'
required: true
type: boolean
push: push:
branches: [ master ] branches: [ master ]
tags: [ v* ] tags: [ v* ]
@ -14,15 +19,16 @@ jobs:
env: env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true" CCACHE_NOHASHDIR: "true"
CCACHE_MAXSIZE: "1G"
CCACHE_HARDLINK: "true" CCACHE_HARDLINK: "true"
CCACHE_BASEDIR: "${{ github.workspace }}" CCACHE_BASEDIR: "${{ github.workspace }}"
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
submodules: 'recursive' submodules: "recursive"
fetch-depth: 0 fetch-depth: 0
- name: Write key - name: Write key
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }} if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
run: | run: |
@ -33,43 +39,49 @@ jobs:
echo androidStoreFile='key.jks' >> gradle.properties echo androidStoreFile='key.jks' >> gradle.properties
echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks
fi fi
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: "temurin"
java-version: '17' java-version: "17"
cache: 'gradle'
- name: Cache Gradle Build - name: Setup Gradle
uses: actions/cache@v3 uses: gradle/gradle-build-action@v2
- name: Checkout libxposed/api
uses: actions/checkout@v3
with: with:
path: | repository: libxposed/api
~/.gradle/caches/build-cache-* path: libxposed/api
~/.gradle/buildOutputCleanup/cache.properties
key: gradle-builds-core-${{ github.sha }} - name: Checkout libxposed/api
restore-keys: | uses: actions/checkout@v3
gradle-builds with:
repository: libxposed/service
path: libxposed/service
- name: Set up ccache - name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
with: with:
max-size: 2G
key: ${{ runner.os }} key: ${{ runner.os }}
restore-keys: ${{ runner.os }} restore-keys: ${{ runner.os }}
- name: Build dependencies - name: Build dependencies
working-directory: libxposed
run: | run: |
mkdir -p libxposed
cd libxposed
git clone https://github.com/libxposed/api.git
cd api cd api
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
./gradlew :api:publishApiPublicationToMavenLocal ./gradlew :api:publishApiPublicationToMavenLocal
cd .. cd ..
git clone https://github.com/libxposed/service.git
cd service cd service
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
./gradlew :interface:publishInterfacePublicationToMavenLocal ./gradlew :interface:publishInterfacePublicationToMavenLocal
cd ../..
env: env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }}
- name: Build with Gradle - name: Build with Gradle
run: | run: |
[ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* || true [ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* || true
@ -79,8 +91,10 @@ jobs:
echo 'org.gradle.vfs.watch=true' >> gradle.properties echo 'org.gradle.vfs.watch=true' >> gradle.properties
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
echo 'android.native.buildOutput=verbose' >> gradle.properties echo 'android.native.buildOutput=verbose' >> gradle.properties
sed -i 's/org.gradle.unsafe.configuration-cache=true//g' gradle.properties
echo 'buildCache { local { removeUnusedEntriesAfterDays = 1 } }' >> settings.gradle.kts echo 'buildCache { local { removeUnusedEntriesAfterDays = 1 } }' >> settings.gradle.kts
./gradlew zipAll ./gradlew zipAll
- name: Prepare artifact - name: Prepare artifact
if: success() if: success()
id: prepareArtifact id: prepareArtifact
@ -93,26 +107,31 @@ jobs:
unzip magisk-loader/release/LSPosed-v*-riru-debug.zip -d LSPosed-riru-debug unzip magisk-loader/release/LSPosed-v*-riru-debug.zip -d LSPosed-riru-debug
unzip magisk-loader/release/LSPosed-v*-zygisk-release.zip -d LSPosed-zygisk-release unzip magisk-loader/release/LSPosed-v*-zygisk-release.zip -d LSPosed-zygisk-release
unzip magisk-loader/release/LSPosed-v*-zygisk-debug.zip -d LSPosed-zygisk-debug unzip magisk-loader/release/LSPosed-v*-zygisk-debug.zip -d LSPosed-zygisk-debug
- name: Upload riru release - name: Upload riru release
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ steps.prepareArtifact.outputs.riruReleaseName }} name: ${{ steps.prepareArtifact.outputs.riruReleaseName }}
path: './LSPosed-riru-release/*' path: "./LSPosed-riru-release/*"
- name: Upload riru debug - name: Upload riru debug
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ steps.prepareArtifact.outputs.riruDebugName }} name: ${{ steps.prepareArtifact.outputs.riruDebugName }}
path: './LSPosed-riru-debug/*' path: "./LSPosed-riru-debug/*"
- name: Upload zygisk release - name: Upload zygisk release
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ steps.prepareArtifact.outputs.zygiskReleaseName }} name: ${{ steps.prepareArtifact.outputs.zygiskReleaseName }}
path: './LSPosed-zygisk-release/*' path: "./LSPosed-zygisk-release/*"
- name: Upload zygisk debug - name: Upload zygisk debug
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ steps.prepareArtifact.outputs.zygiskDebugName }} name: ${{ steps.prepareArtifact.outputs.zygiskDebugName }}
path: './LSPosed-zygisk-debug/*' path: "./LSPosed-zygisk-debug/*"
- name: Upload mappings - name: Upload mappings
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@ -120,16 +139,15 @@ jobs:
path: | path: |
magisk-loader/build/outputs/mapping magisk-loader/build/outputs/mapping
app/build/outputs/mapping app/build/outputs/mapping
- name: Upload symbols - name: Upload symbols
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: symbols name: symbols
path: | path: build/symbols
magisk-loader/build/symbols
daemon/build/symbols
dex2oat/build/symbols
- name: Post to channel - name: Post to channel
if: ${{ success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.ref_type != 'tag' }} if: ${{ success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.ref_type != 'tag' && inputs.post_telegram != false }}
env: env:
CHANNEL_ID: ${{ secrets.CHANNEL_ID }} CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
DISCUSSION_ID: ${{ secrets.DISCUSSION_ID }} DISCUSSION_ID: ${{ secrets.DISCUSSION_ID }}