Added Github workflow martix for JDK 1.8, 11 & 15.
This commit is contained in:
parent
b967f13230
commit
12936688ae
2 changed files with 36 additions and 25 deletions
21
.github/workflows/gradle.yml
vendored
21
.github/workflows/gradle.yml
vendored
|
@ -5,17 +5,24 @@ on: [push, pull_request, workflow_dispatch]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: ${{ matrix.java-version }}
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
|
if: matrix.java-version == env.SONAR_JDK
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.sonar/cache
|
path: ~/.sonar/cache
|
||||||
|
@ -27,15 +34,17 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
~/.gradle/caches
|
~/.gradle/caches
|
||||||
~/.gradle/wrapper
|
~/.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: |
|
restore-keys: |
|
||||||
${{ runner.os }}-gradle-
|
${{ runner.os }}-gradle-${{ matrix.java-version }}-
|
||||||
- name: Test with Gradle
|
- name: Test with Gradle
|
||||||
|
run: ./gradlew build check --stacktrace
|
||||||
|
- name: SonarCloud
|
||||||
|
if: success() && matrix.java-version == env.SONAR_JDK
|
||||||
env:
|
env:
|
||||||
CI_NAME: "GitHub CI"
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: ./gradlew check sonarqube
|
run: ./gradlew sonarqube
|
||||||
- name: Cleanup Gradle Cache
|
- name: Cleanup Gradle Cache
|
||||||
run: |
|
run: |
|
||||||
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
||||||
|
|
40
build.gradle
40
build.gradle
|
@ -93,8 +93,8 @@ clean {
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
exceptionFormat = "full"
|
exceptionFormat = 'full'
|
||||||
events("passed", "skipped", "failed")
|
events('passed', 'skipped', 'failed')
|
||||||
}
|
}
|
||||||
|
|
||||||
useTestNG()
|
useTestNG()
|
||||||
|
@ -123,7 +123,7 @@ tasks.withType(Checkstyle) {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
from(components.java)
|
from components.java
|
||||||
groupId = project.group
|
groupId = project.group
|
||||||
artifactId = rootProject.name
|
artifactId = rootProject.name
|
||||||
|
|
||||||
|
@ -155,11 +155,11 @@ publishing {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "ossrh"
|
name = 'ossrh'
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
url = project.version.contains("SNAPSHOT")
|
url = project.version.contains('SNAPSHOT')
|
||||||
? "https://oss.sonatype.org/content/repositories/snapshots/"
|
? 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
||||||
}
|
}
|
||||||
credentials(PasswordCredentials)
|
credentials(PasswordCredentials)
|
||||||
}
|
}
|
||||||
|
@ -175,21 +175,23 @@ task copyToDeploy(type: Copy) {
|
||||||
from(configurations.runtimeClasspath) {
|
from(configurations.runtimeClasspath) {
|
||||||
exclude('javax.servlet-api-*.jar', 'jsp-api-*.jar')
|
exclude('javax.servlet-api-*.jar', 'jsp-api-*.jar')
|
||||||
}
|
}
|
||||||
from(jar)
|
from jar
|
||||||
into(deployDir)
|
into deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
|
task deploy {
|
||||||
description = "Copies all needed files to the ${deployDir} directory."
|
description = "Copies all needed files to the ${deployDir} directory."
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
outputs.dir(deployDir)
|
dependsOn(clean, build, 'copyToDeploy')
|
||||||
inputs.files(copyToDeploy)
|
outputs.dir deployDir
|
||||||
mustRunAfter(clean)
|
inputs.files copyToDeploy
|
||||||
|
mustRunAfter clean
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(dependsOn: ['wrapper', 'deploy', 'pandoc', 'publishToMavenLocal']) {
|
task release {
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
description = 'Releases new version.'
|
description = 'Releases new version.'
|
||||||
|
dependsOn(wrapper, 'deploy', 'pandoc', publishToMavenLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
task pandoc(type: Exec) {
|
task pandoc(type: Exec) {
|
||||||
|
@ -221,13 +223,13 @@ jacocoTestReport {
|
||||||
|
|
||||||
sonarqube {
|
sonarqube {
|
||||||
properties {
|
properties {
|
||||||
property("sonar.organization", "ethauvin-github")
|
property('sonar.organization', 'ethauvin-github')
|
||||||
property("sonar.projectKey", "ethauvin_HttpStatus")
|
property('sonar.projectKey', 'ethauvin_HttpStatus')
|
||||||
property("sonar.host.url", "https://sonarcloud.io")
|
property('sonar.host.url', 'https://sonarcloud.io')
|
||||||
property("sonar.sourceEncoding", "UTF-8")
|
property('sonar.sourceEncoding', 'UTF-8')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.sonarqube {
|
tasks.sonarqube {
|
||||||
dependsOn("jacocoTestReport")
|
dependsOn 'jacocoTestReport'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue