diff --git a/.github/workflows/build-kits.yml b/.github/workflows/build-kits.yml index 7bcd88c5f..71ed080e7 100644 --- a/.github/workflows/build-kits.yml +++ b/.github/workflows/build-kits.yml @@ -44,6 +44,11 @@ jobs: distribution: zulu java-version: "17" + - name: Setup Gradle + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 + with: + cache-read-only: true + - name: Publish core SDK to Maven Local run: ./gradlew publishMavenPublicationToMavenLocal diff --git a/.github/workflows/instrumented-tests.yml b/.github/workflows/instrumented-tests.yml index 1d6e3bbd5..acb6c95b1 100644 --- a/.github/workflows/instrumented-tests.yml +++ b/.github/workflows/instrumented-tests.yml @@ -38,8 +38,10 @@ jobs: with: distribution: "zulu" java-version: "17" - - name: Gradle cache - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a #v2.9.0 + - name: "Setup Gradle" + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 + with: + cache-read-only: true # AVD cache disabled: causes indefinite hangs on emulator shutdown (see # ReactiveCircus/android-emulator-runner#373, #385, #362; WordPress/gutenberg#66771) - name: Enable KVM group perms diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4b585d659..a57f02bda 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,6 +1,11 @@ name: "Build and Test" -on: [workflow_dispatch, pull_request] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -17,6 +22,7 @@ jobs: trunk-check: name: Trunk code check runs-on: ubuntu-latest + if: github.event_name == 'pull_request' steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -72,6 +78,8 @@ jobs: with: distribution: "zulu" java-version: "17" + - name: "Setup Gradle" + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: "Run Unit Tests" run: ./gradlew test - name: "Print Android Unit Tests Report" @@ -98,6 +106,8 @@ jobs: with: distribution: "zulu" java-version: "17" + - name: "Setup Gradle" + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: "Run Android Core SDK Lint" run: ./gradlew lint - name: "Setup Android Kit Lint" @@ -125,6 +135,8 @@ jobs: with: distribution: "zulu" java-version: "17" + - name: "Setup Gradle" + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: "Run Android Core SDK Kotlin Lint" run: ./gradlew ktlintCheck - name: "Setup Android Kit Kotlin Lint" @@ -140,6 +152,7 @@ jobs: security-checks: name: "Security Lint Checks" + if: github.event_name == 'pull_request' uses: mparticle/mparticle-workflows/.github/workflows/security-checks.yml@main with: base_branch: main @@ -161,6 +174,8 @@ jobs: with: distribution: "zulu" java-version: "17" + - name: "Setup Gradle" + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: "Generate Core Release Build" run: ./gradlew publishMavenPublicationToMavenLocal - name: "Run Kit-Base Release Tests and Build" @@ -176,6 +191,7 @@ jobs: automerge-dependabot: name: "Save PR Number for Dependabot Automerge" + if: github.event_name == 'pull_request' needs: [ instrumented-core, diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index e8fd2955a..eede09100 100644 --- a/.github/workflows/release-draft.yml +++ b/.github/workflows/release-draft.yml @@ -113,7 +113,7 @@ jobs: echo "${{ steps.compose-version.outputs.new-version }}" > VERSION - name: Publish to Maven local (smoke test) - run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=${{ steps.compose-version.outputs.new-version }} + run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=${{ steps.compose-version.outputs.new-version }} --no-build-cache - name: Generate changelog entry id: changelog diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index a7398fa37..63534c330 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -54,13 +54,13 @@ jobs: uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Publish core to Maven local (required before kits can compile) - run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=${{ needs.setup-and-version.outputs.final_version }} + run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=${{ needs.setup-and-version.outputs.final_version }} --no-build-cache - name: Publish core to Maven Central - run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} + run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} --no-build-cache - name: Publish kits to Maven Central - run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle + run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle --no-build-cache # rokt-sdk-plus (com.rokt:rokt-sdk-plus) is an umbrella over the mParticle Rokt kit + the # Rokt Payment Extension. The "Publish core to Maven local" step above already placed @@ -69,7 +69,7 @@ jobs: # Maven Central propagation. com.rokt:payment-extension (+ roktsdk) come from Central, # released independently from the ROKT sdk-android-source repo. - name: Publish Rokt kit to Maven local (so rokt-sdk-plus resolves it locally) - run: ./gradlew :kits:android-rokt:rokt:publishMavenPublicationToMavenLocal -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle + run: ./gradlew :kits:android-rokt:rokt:publishMavenPublicationToMavenLocal -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle --no-build-cache # Published under the com.rokt namespace, so this step signs with the Rokt signing key. # The Sonatype account is shared with the com.mparticle publish (that account owns both @@ -80,7 +80,7 @@ jobs: ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ROKT_MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-rokt-sdk-plus.gradle + run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-rokt-sdk-plus.gradle --no-build-cache - name: Create GitHub release uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 diff --git a/gradle.properties b/gradle.properties index 444938580..e0d20bf41 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,7 @@ android.useAndroidX=true org.gradle.daemon=true org.gradle.jvmargs=-Xmx2560m #-XX:ThreadStackSize=4096 -XX:CompilerThreadStackSize=4096 +org.gradle.caching=true android.defaults.buildfeatures.buildconfig=true systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true JAVA_VERSION=17