Skip to content

Commit

Permalink
Merge 15ddbbf into fe10f05
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor authored Jul 28, 2023
2 parents fe10f05 + 15ddbbf commit 442eb35
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 21 deletions.
24 changes: 4 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,14 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
# Clean, check formatting, build and do a dry release
- name: Make all
run: make all

# We stop gradle at the end to make sure the cache folders
# don't contain any lock files and are free to be cached.
- name: Make stop
run: make stop

- name: Archive packages
# We need artifacts from only one the builds
if: runner.os == 'Linux' && matrix.java == '17'
uses: actions/upload-artifact@v3
with:
name: ${{ github.sha }}
if-no-files-found: error
path: |
./*/build/distributions/*.zip
./sentry-opentelemetry/*/build/distributions/*.zip
./sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
# Try unit test coverage report for sentry-android-core
- name: Run unit test coverage
run: ./gradlew unitTestCoverageReport

- name: Upload coverage to Codecov
# We need coverage data from only one the builds
if: runner.os == 'Linux' && matrix.java == '17'
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3
with:
name: sentry-java
files: "sentry-android-*/build/reports/jacoco/unitTestCoverageReport/unitTestCoverageReport.xml"
24 changes: 24 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ allprojects {
}

subprojects {
if (name.contains("sentry-android") && !name.contains("sentry-android-integration-tests")) {
tasks.create("unitTestCoverageReport", JacocoReport::class) {
dependsOn("testReleaseUnitTest")

group = "Verification" // existing group containing tasks for generating linting reports etc.
description = "Generate Jacoco coverage reports for the release build."

reports {
html.required.set(true)
xml.required.set(true)
}

// Execution data generated when running the tests against classes instrumented by the JaCoCo agent.
// This is enabled with 'enableUnitTestCoverage' in the 'debug' build type.
executionData.setFrom("${buildDir}/outputs/unit_test_code_coverage/releaseUnitTest/testReleaseUnitTest.exec")

// Compiled Kotlin class files are written into build-variant-specific subdirectories of 'build/tmp/kotlin-classes'.
classDirectories.setFrom("${buildDir}/tmp/kotlin-classes/releaseUnitTest")

// To produce an accurate report, the bytecode is mapped back to the original source code.
sourceDirectories.setFrom("$projectDir}/src/main/java")
}
}

plugins.withId(Config.QualityPlugins.detektPlugin) {
configure<DetektExtension> {
buildUponDefaultConfig = true
Expand Down
5 changes: 4 additions & 1 deletion sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ android {
}

buildTypes {
getByName("debug")
getByName("debug") {
enableUnitTestCoverage = true
}
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-ndk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-sqlite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down
1 change: 1 addition & 0 deletions sentry-android-timber/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
buildTypes {
getByName("debug")
getByName("release") {
enableUnitTestCoverage = true
consumerProguardFiles("proguard-rules.pro")
}
}
Expand Down

0 comments on commit 442eb35

Please sign in to comment.