Skip to content

Commit

Permalink
Merge pull request #93 from transloadit/enable_code_cov
Browse files Browse the repository at this point in the history
Enable CodeCov for Java SDK
  • Loading branch information
kvz authored Dec 19, 2024
2 parents 448b1ee + c56904d commit 0f5128d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
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

0 comments on commit 0f5128d

Please sign in to comment.