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:
|
||||
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
|
||||
|
|
40
build.gradle
40
build.gradle
|
@ -93,8 +93,8 @@ clean {
|
|||
|
||||
test {
|
||||
testLogging {
|
||||
exceptionFormat = "full"
|
||||
events("passed", "skipped", "failed")
|
||||
exceptionFormat = 'full'
|
||||
events('passed', 'skipped', 'failed')
|
||||
}
|
||||
|
||||
useTestNG()
|
||||
|
@ -123,7 +123,7 @@ tasks.withType(Checkstyle) {
|
|||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from(components.java)
|
||||
from components.java
|
||||
groupId = project.group
|
||||
artifactId = rootProject.name
|
||||
|
||||
|
@ -155,11 +155,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)
|
||||
}
|
||||
|
@ -175,21 +175,23 @@ task copyToDeploy(type: Copy) {
|
|||
from(configurations.runtimeClasspath) {
|
||||
exclude('javax.servlet-api-*.jar', 'jsp-api-*.jar')
|
||||
}
|
||||
from(jar)
|
||||
into(deployDir)
|
||||
from jar
|
||||
into deployDir
|
||||
}
|
||||
|
||||
task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
|
||||
task deploy {
|
||||
description = "Copies all needed files to the ${deployDir} directory."
|
||||
group = 'Publishing'
|
||||
outputs.dir(deployDir)
|
||||
inputs.files(copyToDeploy)
|
||||
mustRunAfter(clean)
|
||||
dependsOn(clean, build, 'copyToDeploy')
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
}
|
||||
|
||||
task release(dependsOn: ['wrapper', 'deploy', 'pandoc', 'publishToMavenLocal']) {
|
||||
task release {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
dependsOn(wrapper, 'deploy', 'pandoc', publishToMavenLocal)
|
||||
}
|
||||
|
||||
task pandoc(type: Exec) {
|
||||
|
@ -221,13 +223,13 @@ jacocoTestReport {
|
|||
|
||||
sonarqube {
|
||||
properties {
|
||||
property("sonar.organization", "ethauvin-github")
|
||||
property("sonar.projectKey", "ethauvin_HttpStatus")
|
||||
property("sonar.host.url", "https://sonarcloud.io")
|
||||
property("sonar.sourceEncoding", "UTF-8")
|
||||
property('sonar.organization', 'ethauvin-github')
|
||||
property('sonar.projectKey', 'ethauvin_HttpStatus')
|
||||
property('sonar.host.url', 'https://sonarcloud.io')
|
||||
property('sonar.sourceEncoding', 'UTF-8')
|
||||
}
|
||||
}
|
||||
|
||||
tasks.sonarqube {
|
||||
dependsOn("jacocoTestReport")
|
||||
dependsOn 'jacocoTestReport'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue