Skip to content

Commit

Permalink
Define GitHub Actions workflows and update Gradle (#208)
Browse files Browse the repository at this point in the history
update Gradle version so that it can run on newer Java versions - Maven Central publishing will need to be configured from scratch since `maven` Gradle plugin is no longer alive
  • Loading branch information
pivovarit authored Oct 13, 2024
1 parent 68aaec5 commit 23f96e5
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 64 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: build and test
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
validation:
name: "Gradle Wrapper Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
build:
name: "Compile against JDKs and OSes"
needs: [ validation ]
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
java: [ 8, 11, 17, 21, 23 ]
exclude:
- java: 8
os: macos-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Gradle build
run: ./gradlew build

test:
name: "Test"
needs: [ build ]
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 17, 21, 23 ]
fasterxmlVersion: [ 2.8.11, 2.9.10, 2.10.4, 2.11.3, 2.12.3, 2.13.4, 2.14.1 ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: gradle
- run: |
./gradlew clean check --refresh-dependencies -PfasterxmlVersion=${{ matrix.fasterxmlVersion }}
./gradlew codeCoverageReport
91 changes: 28 additions & 63 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id 'java'
id 'maven'
id 'jacoco'
id 'maven-publish'
id 'checkstyle'
id 'com.bmuschko.nexus' version '2.3.1'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

group = 'io.vavr'
version = '0.10.5-SNAPSHOT'
Expand All @@ -20,35 +20,39 @@ repositories {
}

dependencies {
compile "io.vavr:vavr:${vavrVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${fasterxmlVersion}"
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
implementation "io.vavr:vavr:${vavrVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${fasterxmlVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testCompile "javax.xml.bind:jaxb-api:${jaxbVersion}"
testCompile "com.squareup:javapoet:${javapoetVersion}"
testCompile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:${fasterxmlVersion}"
testCompile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${fasterxmlVersion}"
testCompile "com.fasterxml.jackson.datatype:jackson-datatype-joda:${fasterxmlVersion}"
testCompile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${fasterxmlVersion}"
testCompile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${fasterxmlVersion}"
testCompile "com.fasterxml.jackson.module:jackson-module-scala_2.11:${fasterxmlVersion}"
testImplementation "javax.xml.bind:jaxb-api:${jaxbVersion}"
testImplementation "com.squareup:javapoet:${javapoetVersion}"
testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:${fasterxmlVersion}"
testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${fasterxmlVersion}"
testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:${fasterxmlVersion}"
testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${fasterxmlVersion}"
testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${fasterxmlVersion}"
testImplementation "com.fasterxml.jackson.module:jackson-module-scala_2.11:${fasterxmlVersion}"
}

task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
tasks.register('codeCoverageReport', JacocoReport) {
dependsOn tasks.test
executionData.setFrom(fileTree(project.rootDir).include("**/build/jacoco/*.exec"))

sourceSets sourceSets.main
sourceDirectories.setFrom(files(sourceSets.main.allSource.srcDirs))
classDirectories.setFrom(fileTree("build/classes/java/main") {
exclude '**/SomeExcludedClass.class'
})

reports {
xml.enabled = true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled = true
csv.enabled = false
xml.required.set(true)
xml.outputLocation.set(file("${buildDir}/reports/jacoco/report.xml"))
html.required.set(true)
csv.required.set(false)
}
}

codeCoverageReport.dependsOn {
project.test
tasks.test {
finalizedBy tasks.codeCoverageReport
}

jar {
Expand All @@ -59,45 +63,6 @@ jar {
}
}

modifyPom {
project {
name 'Vavr-Jackson'
description 'Jackson datatype module for Vavr.io'
url 'http://vavr.io'
inceptionYear '2016'

scm {
connection 'scm:git:[email protected]:vavr-io/vavr-jackson.git'
developerConnection 'scm:git:[email protected]:vavr-io/vavr-jackson.git'
url '[email protected]:vavr-io/vavr-jackson.git'
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'ruslansennov'
name 'Ruslan Sennov'
email '[email protected]'
}
developer {
id 'minconghuang'
name 'Mincong Huang'
email '[email protected]'
}
}
}
}

nexus {
sign = !version.endsWith("SNAPSHOT")
}

test {
useJUnitPlatform()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 23f96e5

Please sign in to comment.