From ac30e3beb44832778f0d892dddd044bf14c23c11 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Tue, 8 Aug 2023 16:28:13 +0200 Subject: [PATCH 01/10] (don't merge): testing codecov upload only with sentry-kotlin-compiler-plugin module --- Makefile | 2 +- sentry-kotlin-compiler-plugin/build.gradle.kts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7194ec91f..4859052de 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: ./gradlew clean preMerge: - ./gradlew preMerge --continue + ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached. diff --git a/sentry-kotlin-compiler-plugin/build.gradle.kts b/sentry-kotlin-compiler-plugin/build.gradle.kts index 113591109..b47fb4ad4 100644 --- a/sentry-kotlin-compiler-plugin/build.gradle.kts +++ b/sentry-kotlin-compiler-plugin/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("distribution") id("com.vanniktech.maven.publish") version "0.17.0" id("org.jlleitschuh.gradle.ktlint") version "10.2.1" + jacoco } allprojects { @@ -13,6 +14,13 @@ allprojects { } } +tasks.jacocoTestReport { + reports { + xml.required.set(true) + } +} + + ktlint { debug.set(false) verbose.set(true) From d2b2ce35bb48108e951a35a1a0b2c771d450c374 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Tue, 8 Aug 2023 16:30:31 +0200 Subject: [PATCH 02/10] Add codecov step --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57adc4993..15956313a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,3 +50,8 @@ jobs: unzip plugin-build/build/distributions/$filename.zip -d /tmp unzip /tmp/$filename/$filename.jar -d /tmp/jar/ find /tmp/jar | grep "bin/sentry-cli" + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3 + with: + name: sentry-android-gradle-plugin From afb3cb5138ce3cdcdbee0963aec3b4cb42dd4ec2 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Tue, 8 Aug 2023 16:45:28 +0200 Subject: [PATCH 03/10] Run test before jacoco --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4859052de..3ff6ce93e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: ./gradlew clean preMerge: - ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport + ./gradlew :sentry-kotlin-compiler-plugin:test & ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached. From 3da7922298d08fc311e4e6481ec946a0270396bf Mon Sep 17 00:00:00 2001 From: buenaflor Date: Tue, 8 Aug 2023 17:10:18 +0200 Subject: [PATCH 04/10] (don't merge): remove other steps temporarily --- .github/workflows/build.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15956313a..85164e0a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,15 +24,8 @@ jobs: distribution: 'temurin' java-version: '17' - - name: Build Gradle Plugin distribution artifacts - run: | - cd plugin-build - make all - - name: Build Kotlin Compiler artifacts - run: | - cd sentry-kotlin-compiler-plugin - make all + run: make all - name: Archive artifacts uses: actions/upload-artifact@v3 @@ -42,15 +35,6 @@ jobs: ${{ github.workspace }}/plugin-build/build/distributions/*.zip ${{ github.workspace }}/sentry-kotlin-compiler-plugin/build/distributions/*.zip - - name: Verifies Sentry CLI is bundled - shell: bash - run: | - zipfile=$(ls -1 plugin-build/build/distributions | grep -v "PluginMarker") - filename=${zipfile/\.zip/} - unzip plugin-build/build/distributions/$filename.zip -d /tmp - unzip /tmp/$filename/$filename.jar -d /tmp/jar/ - find /tmp/jar | grep "bin/sentry-cli" - - name: Upload coverage to Codecov uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3 with: From 160d575947c9bfc1f823bdc2aa8f42a6da7949ae Mon Sep 17 00:00:00 2001 From: buenaflor Date: Wed, 9 Aug 2023 11:25:02 +0200 Subject: [PATCH 05/10] (don't merge): run test and jacoco commands sequentially instead parallel --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3ff6ce93e..0ad136695 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: ./gradlew clean preMerge: - ./gradlew :sentry-kotlin-compiler-plugin:test & ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport + ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached. From ce9afd56b520945cb66ad2c42f50a3f602aef0d9 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Wed, 9 Aug 2023 12:30:39 +0200 Subject: [PATCH 06/10] (don't merge): add jacoco to plugin build --- Makefile | 2 +- plugin-build/build.gradle.kts | 12 ++++++++++++ .../io/sentry/android/gradle/BaseSentryPluginTest.kt | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0ad136695..1a0a5dc68 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: ./gradlew clean preMerge: - ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport + ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport && ./gradlew :plugin-build:test && ./gradlew :plugin-build:jacocoTestReport # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached. diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 45406d245..8c0f1a87a 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -20,6 +20,18 @@ plugins { id("io.sentry.android.gradle.aar2jar") id("com.github.johnrengelman.shadow") version BuildPluginsVersion.SHADOW id("com.github.gmazzo.buildconfig") version BuildPluginsVersion.BUILDCONFIG + jacoco +} + +jacoco { + toolVersion = "0.8.10" +} + +tasks.withType { + configure { + isIncludeNoLocationClasses = true + excludes = listOf("jdk.internal.*") + } } allprojects { diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt index 3c5937131..9e86da703 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt @@ -105,12 +105,12 @@ abstract class BaseSentryPluginTest( // The supported Gradle version can be found here: // https://developer.android.com/studio/releases/gradle-plugin#updating-gradle // The pair is [AGP Version, Gradle Version] - arrayOf("7.0.4", "7.2"), + /*arrayOf("7.0.4", "7.2"), arrayOf("7.1.3", "7.3.3"), arrayOf("7.2.1", "7.4"), arrayOf("7.3.0", "7.5"), arrayOf("7.4.0", "7.6"), - arrayOf("8.0.0", "8.0.2"), + arrayOf("8.0.0", "8.0.2"),*/ arrayOf("8.1.0-alpha11", "8.1") ) From 145a9dd5d6f799b8ab0595f672b848d6bb95e28a Mon Sep 17 00:00:00 2001 From: buenaflor Date: Wed, 9 Aug 2023 12:34:59 +0200 Subject: [PATCH 07/10] (don't merge): try with kover --- Makefile | 2 +- plugin-build/build.gradle.kts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a0a5dc68..b664d72ad 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ clean: ./gradlew clean preMerge: - ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport && ./gradlew :plugin-build:test && ./gradlew :plugin-build:jacocoTestReport + ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport && ./gradlew :plugin-build:test && ./gradlew :plugin-build:koverHtmlReport # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached. diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 8c0f1a87a..f3d4ee5cf 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -21,6 +21,7 @@ plugins { id("com.github.johnrengelman.shadow") version BuildPluginsVersion.SHADOW id("com.github.gmazzo.buildconfig") version BuildPluginsVersion.BUILDCONFIG jacoco + id("org.jetbrains.kotlinx.kover") version "0.7.3" } jacoco { From 73ff8dd3a0c2a284b4f4a6f90957ecbc37a4f099 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Thu, 10 Aug 2023 12:05:47 +0200 Subject: [PATCH 08/10] (don't merge): improve build times --- build.gradle.kts | 4 ++-- .../sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt | 4 ++-- sentry-kotlin-compiler-plugin/build.gradle.kts | 1 - settings.gradle.kts | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 81acd9338..2d77cfdf6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,11 +42,11 @@ tasks.register("preMerge") { dependsOn(gradle.includedBuild("sentry-kotlin-compiler-plugin").task(":check")) dependsOn(gradle.includedBuild("sentry-kotlin-compiler-plugin").task(":publishAllPublicationsToMavenTestRepoRepository")) - dependsOn(":examples:android-gradle:check") + /*dependsOn(":examples:android-gradle:check") dependsOn(":examples:android-gradle-kts:check") dependsOn(":examples:android-ndk:check") dependsOn(":examples:android-instrumentation-sample:check") - dependsOn(":examples:android-room-lib:check") + dependsOn(":examples:android-room-lib:check")*/ dependsOn(gradle.includedBuild("plugin-build").task(":check")) } diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt index 8eebf9d95..7b731693e 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt @@ -83,12 +83,12 @@ abstract class BaseSentryNonAndroidPluginTest( fun parameters() = listOf( // The supported Gradle version can be found here: // https://developer.android.com/studio/releases/gradle-plugin#updating-gradle - arrayOf("7.2"), + /*arrayOf("7.2"), arrayOf("7.3.3"), arrayOf("7.4"), arrayOf("7.5"), arrayOf("7.6"), - arrayOf("8.0.2"), + arrayOf("8.0.2"),*/ arrayOf("8.1") ) diff --git a/sentry-kotlin-compiler-plugin/build.gradle.kts b/sentry-kotlin-compiler-plugin/build.gradle.kts index b47fb4ad4..91766d990 100644 --- a/sentry-kotlin-compiler-plugin/build.gradle.kts +++ b/sentry-kotlin-compiler-plugin/build.gradle.kts @@ -20,7 +20,6 @@ tasks.jacocoTestReport { } } - ktlint { debug.set(false) verbose.set(true) diff --git a/settings.gradle.kts b/settings.gradle.kts index e5cfdb61e..4f303fff0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,13 +24,13 @@ pluginManagement { rootProject.name = ("sentry-android-gradle-plugin-composite-build") -include(":examples:android-gradle") +/*include(":examples:android-gradle") include(":examples:android-gradle-kts") include(":examples:android-guardsquare-proguard") include(":examples:android-ndk") include(":examples:android-instrumentation-sample") include(":examples:android-room-lib") -include(":examples:spring-boot-sample") +include(":examples:spring-boot-sample")*/ includeBuild("plugin-build") { dependencySubstitution { substitute(module("io.sentry:sentry-android-gradle-plugin")).using(project(":")) From d467cc9c0791913574e345fafa46477a16c4fe51 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Thu, 10 Aug 2023 13:07:05 +0200 Subject: [PATCH 09/10] (don't merge): create xml report instead of html and continue on error for testing --- .github/workflows/build.yml | 1 + plugin-build/build.gradle.kts | 6 ++++++ .../sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt | 5 +++-- .../kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt | 5 +++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85164e0a6..8f66de99b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,7 @@ jobs: job_build_upload: name: Build and upload distribution artifact runs-on: ubuntu-latest + continue-on-error: true steps: - name: Checkout current commit (${{ github.sha }}) uses: actions/checkout@v3 diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index f3d4ee5cf..4b02c5ffe 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -28,6 +28,12 @@ jacoco { toolVersion = "0.8.10" } +tasks.jacocoTestReport { + reports { + xml.required.set(true) + } +} + tasks.withType { configure { isIncludeNoLocationClasses = true diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt index 7b731693e..bad420481 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryNonAndroidPluginTest.kt @@ -88,8 +88,9 @@ abstract class BaseSentryNonAndroidPluginTest( arrayOf("7.4"), arrayOf("7.5"), arrayOf("7.6"), - arrayOf("8.0.2"),*/ - arrayOf("8.1") + arrayOf("8.0.2"), + arrayOf("8.1")*/ + arrayOf("7.5") ) internal fun GradleRunner.appendArguments(vararg arguments: String) = diff --git a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt index 9e86da703..3ec2a5909 100644 --- a/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt +++ b/plugin-build/src/test/kotlin/io/sentry/android/gradle/BaseSentryPluginTest.kt @@ -110,8 +110,9 @@ abstract class BaseSentryPluginTest( arrayOf("7.2.1", "7.4"), arrayOf("7.3.0", "7.5"), arrayOf("7.4.0", "7.6"), - arrayOf("8.0.0", "8.0.2"),*/ - arrayOf("8.1.0-alpha11", "8.1") + arrayOf("8.0.0", "8.0.2"), + arrayOf("8.1.0-alpha11", "8.1") */ + arrayOf("7.3.0", "7.5"), ) internal fun GradleRunner.appendArguments(vararg arguments: String) = From 20a12417f06a7063be29248245773523145e3828 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Thu, 10 Aug 2023 13:31:59 +0200 Subject: [PATCH 10/10] (don't merge): ignore errors during preMerge so the test report can be created --- .github/workflows/build.yml | 2 +- Makefile | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f66de99b..96c564855 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: java-version: '17' - name: Build Kotlin Compiler artifacts - run: make all + run: make -i preMerge - name: Archive artifacts uses: actions/upload-artifact@v3 diff --git a/Makefile b/Makefile index b664d72ad..6bbbaef9c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,11 @@ clean: ./gradlew clean preMerge: - ./gradlew :sentry-kotlin-compiler-plugin:test && ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport && ./gradlew :plugin-build:test && ./gradlew :plugin-build:koverHtmlReport + ./gradlew :sentry-kotlin-compiler-plugin:test ; + ./gradlew :sentry-kotlin-compiler-plugin:jacocoTestReport ; + ./gradlew :plugin-build:test ; + ./gradlew :plugin-build:jacocoTestReport + # We stop gradle at the end to make sure the cache folders # don't contain any lock files and are free to be cached.