Added Github workflow martix for JDK 1.8, 11 & 15.
This commit is contained in:
parent
cae74c95b3
commit
af3de2cc74
3 changed files with 32 additions and 23 deletions
21
.github/workflows/gradle.yml
vendored
21
.github/workflows/gradle.yml
vendored
|
@ -5,17 +5,24 @@ on: [push, pull_request, workflow_dispatch]
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
||||
SONAR_JDK: "11"
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 1.8, 11, 15 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK ${{ matrix.java-version }}
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
java-version: ${{ matrix.java-version }}
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Cache SonarCloud packages
|
||||
if: matrix.java-version == env.SONAR_JDK
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
|
@ -27,15 +34,17 @@ jobs:
|
|||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
${{ runner.os }}-gradle-${{ matrix.java-version }}-
|
||||
- name: Test with Gradle
|
||||
run: ./gradlew build check --stacktrace
|
||||
- name: SonarCloud
|
||||
if: success() && matrix.java-version == env.SONAR_JDK
|
||||
env:
|
||||
CI_NAME: "GitHub CI"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: ./gradlew check sonarqube
|
||||
run: ./gradlew sonarqube
|
||||
- name: Cleanup Gradle Cache
|
||||
run: |
|
||||
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
||||
|
|
33
build.gradle
33
build.gradle
|
@ -71,7 +71,7 @@ pmd {
|
|||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from(components.java)
|
||||
from components.java
|
||||
groupId = project.group
|
||||
artifactId = rootProject.name
|
||||
|
||||
|
@ -94,8 +94,8 @@ publishing {
|
|||
}
|
||||
}
|
||||
scm {
|
||||
connection = "scm:git:" + mavenScmCon
|
||||
developerConnection = "scm:git:" + mavenScmDevCon
|
||||
connection = 'scm:git:' + mavenScmCon
|
||||
developerConnection = 'scm:git:' + mavenScmDevCon
|
||||
url = mavenUrl
|
||||
}
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ publishing {
|
|||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "ossrh"
|
||||
name = 'ossrh'
|
||||
project.afterEvaluate {
|
||||
url = project.version.contains("SNAPSHOT")
|
||||
? "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
url = project.version.contains('SNAPSHOT')
|
||||
? 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
||||
}
|
||||
credentials(PasswordCredentials)
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ javadoc {
|
|||
|
||||
test {
|
||||
testLogging {
|
||||
exceptionFormat = "full"
|
||||
events("passed", "skipped", "failed")
|
||||
exceptionFormat = 'full'
|
||||
events('passed', 'skipped', 'failed')
|
||||
}
|
||||
|
||||
useTestNG()
|
||||
|
@ -161,11 +161,12 @@ tasks.withType(Checkstyle) {
|
|||
}
|
||||
}
|
||||
|
||||
task release(dependsOn: ['wrapper', 'clean', 'publishToMavenLocal']) {
|
||||
task release {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version to local maven repository.'
|
||||
dependsOn(wrapper, clean, publishToMavenLocal)
|
||||
doFirst {
|
||||
println("Version: $version")
|
||||
println "Version: $version"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,13 +201,13 @@ jacocoTestReport {
|
|||
|
||||
sonarqube {
|
||||
properties {
|
||||
property("sonar.organization", "ethauvin-github")
|
||||
property("sonar.projectKey", "ethauvin_semver")
|
||||
property("sonar.host.url", "https://sonarcloud.io")
|
||||
property("sonar.sourceEncoding", "UTF-8")
|
||||
property('sonar.organization', 'ethauvin-github')
|
||||
property('sonar.projectKey', 'ethauvin_semver')
|
||||
property('sonar.host.url', 'https://sonarcloud.io')
|
||||
property('sonar.sourceEncoding', 'UTF-8')
|
||||
}
|
||||
}
|
||||
|
||||
tasks.sonarqube {
|
||||
dependsOn("jacocoTestReport")
|
||||
dependsOn 'jacocoTestReport'
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@ tasks.withType(JavaCompile) {
|
|||
task runExample(type: JavaExec) {
|
||||
group = 'application'
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
|
||||
main = 'com.example.Example'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue