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

Define GitHub Actions workflows #208

Merged
merged 9 commits into from
Oct 13, 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
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
Loading