From 1d23a5fa75a1aa8410260faf9f1cb9b6d6041f57 Mon Sep 17 00:00:00 2001 From: mchuangatmp <85254535+mchuangatmp@users.noreply.github.com> Date: Mon, 28 Nov 2022 13:24:55 -0800 Subject: [PATCH] ci: Add in ktlintCheck to daily cron job (#284) --- .github/workflows/daily.yml | 41 +++++++++++++++++++ .github/workflows/pull-request.yml | 17 +------- .github/workflows/release.yml | 4 +- android-core/build.gradle | 2 +- .../com/mparticle/kits/KitConfiguration.java | 1 - build.gradle | 2 +- kit-plugin/build.gradle | 2 +- .../com/mparticle/kits/KitPlugin.groovy | 1 + .../com/mparticle/kits/KitPluginTest.groovy | 2 +- testutils/build.gradle | 8 ++-- 10 files changed, 53 insertions(+), 27 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index a023b1f60..d764dce02 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -84,6 +84,7 @@ jobs: with: distribution: "zulu" java-version: "11" + cache: "gradle" - name: "Run Instrumented Tests" uses: reactivecircus/android-emulator-runner@v2.26.0 with: @@ -112,6 +113,7 @@ jobs: with: distribution: "zulu" java-version: "11" + cache: "gradle" - name: "Run Instrumented Orchestrator Tests" uses: reactivecircus/android-emulator-runner@v2.26.0 with: @@ -140,6 +142,7 @@ jobs: with: distribution: "zulu" java-version: "11" + cache: "gradle" - name: "Run Unit Tests" run: ./gradlew test - name: "Print Android Unit Tests Report" @@ -168,6 +171,7 @@ jobs: with: distribution: "zulu" java-version: "11" + cache: "gradle" - name: "Run Android Core SDK Lint" run: ./gradlew lint - name: "Setup Android Kit Lint" @@ -187,6 +191,42 @@ jobs: name: "kit-lint-results" path: kits/**/build/reports/** + kotlin-lint-checks: + name: "Kotlin Lint Checks" + timeout-minutes: 15 + runs-on: macos-latest + needs: create-regression-branch + steps: + - name: "Checkout Branch" + uses: actions/checkout@v3 + with: + ref: regression/${{ github.run_number }} + submodules: recursive + - name: "Install JDK 11" + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "11" + cache: "gradle" + - name: "Run Android Core SDK Kotlin Lint" + run: ./gradlew ktlintCheck + - name: "Setup Android Kit Kotlin Lint" + run: ./gradlew publishReleaseLocal + - name: "Run Android Kit Kotlin Lint" + run: ./gradlew publishReleaseLocal -c settings-kits.gradle ktlintCheck + - name: "Archive Test Results" + uses: actions/upload-artifact@v3 + if: always() + with: + name: "core-ktlint-results" + path: ./**/build/reports/** + - name: "Archive Test Kit Results" + uses: actions/upload-artifact@v3 + if: always() + with: + name: "kit-ktlint-results" + path: kits/**/build/reports/** + update-kits: name: "Update Kits" needs: create-regression-branch @@ -208,6 +248,7 @@ jobs: with: distribution: "zulu" java-version: "11" + cache: "gradle" - name: "Build Android Core" run: ./gradlew -PisRelease=true clean publishReleaseLocal - name: "Test Kits" diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 02b2f58f7..069243221 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -148,19 +148,4 @@ jobs: automerge-dependabot: name: "Save PR Number for Dependabot Automerge" needs: [ instrumented-tests, instrumented-orchestrator-tests, unit-tests, lint-checks, kotlin-lint-checks, kit-compatibility-test ] - if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: "Checkout PR branch" - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: "Save Pull Request Number" - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NR - - uses: actions/upload-artifact@v3 - with: - name: pr - path: pr/ \ No newline at end of file + uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 136ac3ee6..b11860769 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: create-release-branch: name: "Create Release Branch" - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: confirm-public-repo-main-branch env: GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} @@ -117,7 +117,7 @@ jobs: sonatype-release: name: "Sonatype Release" needs: semantic-release - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/android-core/build.gradle b/android-core/build.gradle index e8c739e55..e92819e43 100644 --- a/android-core/build.gradle +++ b/android-core/build.gradle @@ -154,7 +154,7 @@ dependencies { androidTestImplementation project(':testutils') if (useOrchestrator()) { androidTestImplementation 'androidx.test:runner:1.4.0' - androidTestUtil 'androidx.test:orchestrator:1.3.0' + androidTestUtil 'androidx.test:orchestrator:1.4.2' } androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" diff --git a/android-kit-base/src/main/java/com/mparticle/kits/KitConfiguration.java b/android-kit-base/src/main/java/com/mparticle/kits/KitConfiguration.java index cd38c02cc..27a4d082e 100644 --- a/android-kit-base/src/main/java/com/mparticle/kits/KitConfiguration.java +++ b/android-kit-base/src/main/java/com/mparticle/kits/KitConfiguration.java @@ -569,7 +569,6 @@ public boolean shouldLogScreen(String screenName) { return true; } - protected boolean shouldLogEvent(MPEvent event) { if (!shouldIncludeFromAttributeValueFiltering(event.getCustomAttributeStrings())) { return false; diff --git a/build.gradle b/build.gradle index 5b7d63e7f..212887c86 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.20' + ext.kotlin_version = '1.7.21' ext.gradle_version = '7.3.1' repositories { diff --git a/kit-plugin/build.gradle b/kit-plugin/build.gradle index 0b99ae447..d8898e5f7 100644 --- a/kit-plugin/build.gradle +++ b/kit-plugin/build.gradle @@ -9,7 +9,7 @@ apply from: '../scripts/maven.gradle' dependencies { implementation gradleApi() implementation localGroovy() - compileOnly "com.android.tools.build:gradle:7.3.0" + compileOnly "com.android.tools.build:gradle:7.3.1" testImplementation "com.android.tools.build:gradle:4.1.3" } diff --git a/kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy b/kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy index 0dc21e2ce..c0139075a 100644 --- a/kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy +++ b/kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy @@ -1,4 +1,5 @@ package com.mparticle.kits + import com.android.build.gradle.LibraryExtension import org.gradle.api.Plugin import org.gradle.api.Project diff --git a/kit-plugin/src/test/groovy/com/mparticle/kits/KitPluginTest.groovy b/kit-plugin/src/test/groovy/com/mparticle/kits/KitPluginTest.groovy index 0fb1fba5b..ad98c3ca1 100644 --- a/kit-plugin/src/test/groovy/com/mparticle/kits/KitPluginTest.groovy +++ b/kit-plugin/src/test/groovy/com/mparticle/kits/KitPluginTest.groovy @@ -6,7 +6,7 @@ import org.junit.Test class KitPluginTest { @Test - public void greeterPluginAddsGreetingTaskToProject() { + void greeterPluginAddsGreetingTaskToProject() { Project project = ProjectBuilder.builder().build() project.pluginManager.apply 'com.mparticle.kit' diff --git a/testutils/build.gradle b/testutils/build.gradle index 8e7ce64ff..0995691ac 100644 --- a/testutils/build.gradle +++ b/testutils/build.gradle @@ -50,10 +50,10 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) compileOnly project(':android-core') compileOnly project(':android-kit-base') - compileOnly 'org.mockito:mockito-android:4.8.1' + compileOnly 'org.mockito:mockito-android:4.9.0' api 'androidx.annotation:annotation:1.5.0' - api 'androidx.test.ext:junit:1.1.3' + api 'androidx.test.ext:junit:1.1.4' api 'androidx.test:rules:1.4.0' androidTestCompileOnly project(':android-core') @@ -65,11 +65,11 @@ dependencies { } androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.ext:junit:1.1.4' androidTestImplementation 'androidx.test:rules:1.3.0' androidTestImplementation 'com.google.firebase:firebase-messaging:20.0.0' - androidTestUtil 'androidx.test:orchestrator:1.3.0' + androidTestUtil 'androidx.test:orchestrator:1.4.2' } boolean legacyTest() {