Improve Kotlin build caching (#1947)

* Update Gradle properties with Kotlin 1.7 build things

* Disable build tooling metadata task

* Revert "Revert "github: stop disabling configuration cache in CI""

This reverts commit 08951643f51a5a62ca2419cb3a5e935b1d7de413.

* Store build reports as artifacts
This commit is contained in:
Harsh Shandilya 2022-06-10 23:27:56 +05:30 committed by GitHub
parent a6f7a96c0d
commit bd9f883bb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 16 deletions

View file

@ -29,7 +29,7 @@ jobs:
- name: Build release binaries - name: Build release binaries
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache :app:assembleFreeRelease :app:assembleNonFreeRelease :app:bundleNonFreeRelease arguments: :app:assembleFreeRelease :app:assembleNonFreeRelease :app:bundleNonFreeRelease
env: env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

View file

@ -32,7 +32,7 @@ jobs:
- name: Upload binaries - name: Upload binaries
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache :${{ steps.task-select.outputs.PROJECT }}:publishAllPublicationsToMavenCentralRepository arguments: :${{ steps.task-select.outputs.PROJECT }}:publishAllPublicationsToMavenCentralRepository
env: env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_PUBLISH_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
@ -42,7 +42,7 @@ jobs:
- name: Close and release repository - name: Close and release repository
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache closeAndReleaseRepository arguments: closeAndReleaseRepository
env: env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_PUBLISH_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}

View file

@ -35,7 +35,7 @@ jobs:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with: with:
arguments: --no-configuration-cache collectFreeReleaseApks collectNonFreeReleaseApks -PsentryUploadMappings arguments: collectFreeReleaseApks collectNonFreeReleaseApks -PsentryUploadMappings
- name: Clean secrets - name: Clean secrets
run: scripts/signing-cleanup.sh run: scripts/signing-cleanup.sh

View file

@ -69,9 +69,9 @@ jobs:
# that the version number is already correct, and we only need to drop the # that the version number is already correct, and we only need to drop the
# -SNAPSHOT suffix. # -SNAPSHOT suffix.
if [[ "${CHECKOUT_REF}" == "develop" ]]; then if [[ "${CHECKOUT_REF}" == "develop" ]]; then
./gradlew --no-configuration-cache --no-daemon clearPreRelease ./gradlew --no-daemon clearPreRelease
else else
./gradlew --no-configuration-cache --no-daemon bumpPatch ./gradlew --no-daemon bumpPatch
fi fi
# Commit changes to the versioning # Commit changes to the versioning

View file

@ -42,7 +42,14 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache spotlessCheck arguments: spotlessCheck
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/
unit-tests: unit-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -76,7 +83,7 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache test -PslimTests arguments: test -PslimTests
- name: (Fail-only) Upload test report - name: (Fail-only) Upload test report
if: "${{ failure() }}" if: "${{ failure() }}"
@ -85,6 +92,13 @@ jobs:
name: Test report name: Test report
path: app/build/reports path: app/build/reports
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/
build-apks: build-apks:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -117,7 +131,14 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache assembleFreeDebug assembleNonFreeDebug arguments: assembleFreeDebug assembleNonFreeDebug
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/
check-api: check-api:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -151,7 +172,14 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache apiCheck arguments: apiCheck
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/
lint-debug: lint-debug:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -185,7 +213,14 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache lintDebug arguments: lintDebug
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/
assemble-release-apks: assemble-release-apks:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -219,4 +254,11 @@ jobs:
if: "${{ steps.service-changed.outputs.result == 'true' }}" if: "${{ steps.service-changed.outputs.result == 'true' }}"
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache aNFR arguments: aNFR
- name: Upload Kotlin build report
if: "${{ always() }}"
uses: actions/upload-artifact@v3.1.0
with:
name: Build report
path: build/reports/kotlin-build/

View file

@ -44,4 +44,4 @@ jobs:
env: env:
GRADLE_VERSION_OVERRIDE_com_android_tools_build_gradle: ${{ matrix.agp-version }} GRADLE_VERSION_OVERRIDE_com_android_tools_build_gradle: ${{ matrix.agp-version }}
with: with:
arguments: --no-configuration-cache check arguments: check

View file

@ -20,7 +20,7 @@ jobs:
- name: Download new translations from Crowdin - name: Download new translations from Crowdin
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache crowdin arguments: crowdin
env: env:
CROWDIN_LOGIN: ${{ secrets.CROWDIN_LOGIN }} CROWDIN_LOGIN: ${{ secrets.CROWDIN_LOGIN }}
CROWDIN_PROJECT_KEY: ${{ secrets.CROWDIN_PROJECT_KEY }} CROWDIN_PROJECT_KEY: ${{ secrets.CROWDIN_PROJECT_KEY }}

View file

@ -20,7 +20,7 @@ jobs:
- name: Download new publicsuffix data - name: Download new publicsuffix data
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
with: with:
arguments: --no-configuration-cache updatePSL arguments: updatePSL
- name: Compare list changes - name: Compare list changes
run: if [[ $(git diff --binary --stat) != "" ]]; then echo "UPDATED=true" >> $GITHUB_ENV; fi run: if [[ $(git diff --binary --stat) != "" ]]; then echo "UPDATED=true" >> $GITHUB_ENV; fi
@ -29,7 +29,7 @@ jobs:
uses: gradle/gradle-build-action@v2.2.0 uses: gradle/gradle-build-action@v2.2.0
if: "${{ env.UPDATED == 'true' }}" if: "${{ env.UPDATED == 'true' }}"
with: with:
arguments: --no-configuration-cache :autofill-parser:test -PslimTests arguments: :autofill-parser:test -PslimTests
- name: Create Pull Request - name: Create Pull Request
id: cpr id: cpr

View file

@ -24,6 +24,13 @@ kapt.incremental.apt=true
# Turn off AP discovery in compile path to enable compile avoidance # Turn off AP discovery in compile path to enable compile avoidance
kapt.include.compile.classpath=false kapt.include.compile.classpath=false
# New incremental compilation for Kotlin
kotlin.incremental.useClasspathSnapshot=true
kotlin.build.report.output=file
# Disable Gradle task that breaks configuration caching
kotlin.mpp.enableKotlinToolingMetadataArtifact=false
# Use R8 instead of ProGuard for code shrinking. # Use R8 instead of ProGuard for code shrinking.
android.enableR8.fullMode=true android.enableR8.fullMode=true