diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57adc4993..96c564855 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 @@ -24,15 +25,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 -i preMerge - name: Archive artifacts uses: actions/upload-artifact@v3 @@ -42,11 +36,7 @@ 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: + name: sentry-android-gradle-plugin diff --git a/Makefile b/Makefile index 7194ec91f..6bbbaef9c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,11 @@ clean: ./gradlew clean preMerge: - ./gradlew preMerge --continue + ./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/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/build.gradle.kts b/plugin-build/build.gradle.kts index 45406d245..4b02c5ffe 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -20,6 +20,25 @@ plugins { id("io.sentry.android.gradle.aar2jar") 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 { + toolVersion = "0.8.10" +} + +tasks.jacocoTestReport { + reports { + xml.required.set(true) + } +} + +tasks.withType { + configure { + isIncludeNoLocationClasses = true + excludes = listOf("jdk.internal.*") + } } allprojects { 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..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 @@ -83,13 +83,14 @@ 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.1") + 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 3c5937131..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 @@ -105,13 +105,14 @@ 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.1.0-alpha11", "8.1") + arrayOf("8.1.0-alpha11", "8.1") */ + arrayOf("7.3.0", "7.5"), ) internal fun GradleRunner.appendArguments(vararg arguments: String) = diff --git a/sentry-kotlin-compiler-plugin/build.gradle.kts b/sentry-kotlin-compiler-plugin/build.gradle.kts index 113591109..91766d990 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,12 @@ allprojects { } } +tasks.jacocoTestReport { + reports { + xml.required.set(true) + } +} + 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(":"))