Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CodeCov for Java SDK #93

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,28 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew assemble

- name: Run Tests
run: ./gradlew check

- name: Upload coverage to Codecov
if: matrix.java == '11'
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

slack-on-failure:
needs: [Java]
if: failure() && github.ref == 'refs/heads/main'
Expand Down
28 changes: 12 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'signing'
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id 'jacoco'
}

apply plugin: 'java'
Expand Down Expand Up @@ -42,6 +43,7 @@ test {
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}

tasks.register('sourcesJar', Jar) {
Expand Down Expand Up @@ -92,6 +94,16 @@ def pomConfig = {
}
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}

check.dependsOn jacocoTestReport

publishing {
publications {
mavenJava(MavenPublication) {
Expand All @@ -109,22 +121,6 @@ publishing {
}
}
}

/* Keeping this as fallback in case of a failure within the nexus-publishing plugin
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
if (version.toString().toLowerCase().endsWith("snapshot")) {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" // For Snapshot testing
}

credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_KEY")
}
}
}
*/
}
signing{
def signingKeyId = System.getenv("SIGNING_KEY_ID")
Expand Down
Loading