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