name: CI Build on: workflow_dispatch: pull_request: push: merge_group: jobs: build: name: Build runs-on: ubuntu-latest env: CCACHE_COMPILERCHECK: '%compiler% -dumpmachine; %compiler% -dumpversion' CCACHE_NOHASHDIR: 'true' CCACHE_HARDLINK: 'true' CCACHE_BASEDIR: '${{ github.workspace }}' steps: - name: Checkout uses: actions/checkout@v5 with: ref: ${{ github.sha }} submodules: 'recursive' fetch-depth: 0 - 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 echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties echo androidStoreFile='key.jks' >> gradle.properties echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks fi - name: Checkout libxposed/api uses: actions/checkout@main with: repository: libxposed/api path: libxposed/api ref: 54582730315ba4a3d7cfaf9baf9d23c419e07006 - name: Checkout libxposed/service uses: actions/checkout@main with: repository: libxposed/service path: libxposed/service - name: Setup Java uses: actions/setup-java@v5 with: java-version: '21' distribution: 'adopt' - name: Setup Gradle uses: gradle/actions/setup-gradle@v5 - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@master with: version: 1.12.0 - name: Remove Android's cmake shell: bash run: rm -rf "$ANDROID_HOME/cmake" - name: Setup build environment properties run: | # for libxposed/api build echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties # for main project build { echo 'org.gradle.parallel=true' echo 'org.gradle.jvmargs=-Xmx2048m' echo 'android.native.buildOutput=verbose' } >> gradle.properties # for libxposed dependencies build echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/service/gradle.properties - name: Grant execution permission to gradlew run: chmod +x gradlew - name: Build dependencies with Gradle working-directory: libxposed run: | cd api echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties ./gradlew :api:publishApiPublicationToMavenLocal cd ../service echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties ./gradlew :interface:publishInterfacePublicationToMavenLocal - name: Set short commit id run: echo "commit=$(echo ${{ github.sha }} | cut -c-7)" > $GITHUB_ENV - name: Build with Gradle run: ./gradlew buildAll - name: Upload Release artifact uses: actions/upload-artifact@v4 with: name: npatch-release-${{ env.commit }} path: out/release/* - name: Upload Debug artifact uses: actions/upload-artifact@v4 with: name: npatch-debug-${{ env.commit }} path: out/debug/* - name: Upload mappings uses: actions/upload-artifact@v4 with: name: mappings-${{ env.commit }} path: | patch-loader/build/outputs/mapping manager/build/outputs/mapping - name: Upload symbols uses: actions/upload-artifact@v4 with: name: symbols-${{ env.commit }} path: | patch-loader/build/symbols