Added Gihub workflow matrix for Java 11 & 15.
This commit is contained in:
parent
3f628e58f0
commit
b2dcf781c2
2 changed files with 36 additions and 23 deletions
25
.github/workflows/gradle.yml
vendored
25
.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: [ 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,25 +34,29 @@ 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
|
||||||
env:
|
env:
|
||||||
CI_NAME: "GitHub CI"
|
CI_NAME: "GitHub CI"
|
||||||
ALPHAVANTAGE_API_KEY: ${{ secrets.ALPHAVANTAGE_API_KEY }}
|
ALPHAVANTAGE_API_KEY: ${{ secrets.ALPHAVANTAGE_API_KEY }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
||||||
GOOGLE_CSE_CX: ${{ secrets.GOOGLE_CSE_CX }}
|
GOOGLE_CSE_CX: ${{ secrets.GOOGLE_CSE_CX }}
|
||||||
OWM_API_KEY: ${{ secrets.OWM_API_KEY }}
|
OWM_API_KEY: ${{ secrets.OWM_API_KEY }}
|
||||||
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
|
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
TWITTER_CONSUMERKEY: ${{ secrets.TWITTER_CONSUMERKEY }}
|
TWITTER_CONSUMERKEY: ${{ secrets.TWITTER_CONSUMERKEY }}
|
||||||
TWITTER_CONSUMERSECRET: ${{ secrets.TWITTER_CONSUMERSECRET }}
|
TWITTER_CONSUMERSECRET: ${{ secrets.TWITTER_CONSUMERSECRET }}
|
||||||
TWITTER_HANDLE: ${{ secrets.TWITTER_HANDLE }}
|
TWITTER_HANDLE: ${{ secrets.TWITTER_HANDLE }}
|
||||||
TWITTER_TOKEN: ${{ secrets.TWITTER_TOKEN }}
|
TWITTER_TOKEN: ${{ secrets.TWITTER_TOKEN }}
|
||||||
TWITTER_TOKENSECRET: ${{ secrets.TWITTER_TOKENSECRET }}
|
TWITTER_TOKENSECRET: ${{ secrets.TWITTER_TOKENSECRET }}
|
||||||
run: ./gradlew check sonarqube
|
run: ./gradlew build check --stacktrace
|
||||||
|
- name: SonarCloud
|
||||||
|
if: success() && matrix.java-version == env.SONAR_JDK
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
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
|
||||||
|
|
34
build.gradle
34
build.gradle
|
@ -65,8 +65,8 @@ dependencies {
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
exceptionFormat = "full"
|
exceptionFormat = 'full'
|
||||||
events(/* "passed", */ "skipped", "failed")
|
events('skipped', 'failed')
|
||||||
}
|
}
|
||||||
useTestNG() {
|
useTestNG() {
|
||||||
options.suites('src/test/resources/testng.xml')
|
options.suites('src/test/resources/testng.xml')
|
||||||
|
@ -80,7 +80,7 @@ java {
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
arguments {
|
arguments {
|
||||||
arg("semver.project.dir", projectDir)
|
arg('semver.project.dir', projectDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ tasks.withType(JavaCompile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
dependsOn('incrementBuildMeta')
|
dependsOn 'incrementBuildMeta'
|
||||||
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,16 +137,16 @@ incrementBuildMeta {
|
||||||
if (!System.getenv('CI')) {
|
if (!System.getenv('CI')) {
|
||||||
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
||||||
} else {
|
} else {
|
||||||
println "No increment on CIs."
|
println 'No increment on CIs.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sonarqube {
|
sonarqube {
|
||||||
properties {
|
properties {
|
||||||
property("sonar.organization", "ethauvin-github")
|
property('sonar.organization', 'ethauvin-github')
|
||||||
property("sonar.projectKey", "ethauvin_mobibot")
|
property('sonar.projectKey', 'ethauvin_mobibot')
|
||||||
property("sonar.host.url", "https://sonarcloud.io")
|
property('sonar.host.url', 'https://sonarcloud.io')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,34 +170,36 @@ tasks.withType(Checkstyle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.sonarqube {
|
tasks.sonarqube {
|
||||||
dependsOn("jacocoTestReport")
|
dependsOn('jacocoTestReport')
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyToDeploy(type: Copy) {
|
task copyToDeploy(type: Copy) {
|
||||||
from('properties')
|
from('properties')
|
||||||
from(jar)
|
from jar
|
||||||
into(deployDir)
|
into deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyToDeployLib(type: Copy) {
|
task copyToDeployLib(type: Copy) {
|
||||||
from(configurations.runtimeClasspath) {
|
from(configurations.runtimeClasspath) {
|
||||||
exclude('annotations-*.jar')
|
exclude 'annotations-*.jar'
|
||||||
}
|
}
|
||||||
into(deployDir + '/lib')
|
into(deployDir + '/lib')
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ['clean', 'build', 'jar']) {
|
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, jar)
|
||||||
|
outputs.dir deployDir
|
||||||
inputs.files(copyToDeploy, copyToDeployLib)
|
inputs.files(copyToDeploy, copyToDeployLib)
|
||||||
doLast {
|
doLast {
|
||||||
file(deployDir + '/logs').mkdir()
|
file(deployDir + '/logs').mkdir()
|
||||||
}
|
}
|
||||||
mustRunAfter(clean)
|
mustRunAfter clean
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(dependsOn: ['wrapper', 'deploy']) {
|
task release {
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
description = 'Releases new version.'
|
description = 'Releases new version.'
|
||||||
|
dependsOn(wrapper, 'deploy')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue