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:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
||||
SONAR_JDK: "11"
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 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,25 +34,29 @@ 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
|
||||
env:
|
||||
CI_NAME: "GitHub CI"
|
||||
ALPHAVANTAGE_API_KEY: ${{ secrets.ALPHAVANTAGE_API_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
||||
GOOGLE_CSE_CX: ${{ secrets.GOOGLE_CSE_CX }}
|
||||
OWM_API_KEY: ${{ secrets.OWM_API_KEY }}
|
||||
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
TWITTER_CONSUMERKEY: ${{ secrets.TWITTER_CONSUMERKEY }}
|
||||
TWITTER_CONSUMERSECRET: ${{ secrets.TWITTER_CONSUMERSECRET }}
|
||||
TWITTER_HANDLE: ${{ secrets.TWITTER_HANDLE }}
|
||||
TWITTER_TOKEN: ${{ secrets.TWITTER_TOKEN }}
|
||||
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
|
||||
run: |
|
||||
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
||||
|
|
34
build.gradle
34
build.gradle
|
@ -65,8 +65,8 @@ dependencies {
|
|||
|
||||
test {
|
||||
testLogging {
|
||||
exceptionFormat = "full"
|
||||
events(/* "passed", */ "skipped", "failed")
|
||||
exceptionFormat = 'full'
|
||||
events('skipped', 'failed')
|
||||
}
|
||||
useTestNG() {
|
||||
options.suites('src/test/resources/testng.xml')
|
||||
|
@ -80,7 +80,7 @@ java {
|
|||
|
||||
kapt {
|
||||
arguments {
|
||||
arg("semver.project.dir", projectDir)
|
||||
arg('semver.project.dir', projectDir)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ tasks.withType(JavaCompile) {
|
|||
}
|
||||
|
||||
compileJava {
|
||||
dependsOn('incrementBuildMeta')
|
||||
dependsOn 'incrementBuildMeta'
|
||||
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
||||
}
|
||||
|
||||
|
@ -137,16 +137,16 @@ incrementBuildMeta {
|
|||
if (!System.getenv('CI')) {
|
||||
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
||||
} else {
|
||||
println "No increment on CIs."
|
||||
println 'No increment on CIs.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property("sonar.organization", "ethauvin-github")
|
||||
property("sonar.projectKey", "ethauvin_mobibot")
|
||||
property("sonar.host.url", "https://sonarcloud.io")
|
||||
property('sonar.organization', 'ethauvin-github')
|
||||
property('sonar.projectKey', 'ethauvin_mobibot')
|
||||
property('sonar.host.url', 'https://sonarcloud.io')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,34 +170,36 @@ tasks.withType(Checkstyle) {
|
|||
}
|
||||
|
||||
tasks.sonarqube {
|
||||
dependsOn("jacocoTestReport")
|
||||
dependsOn('jacocoTestReport')
|
||||
}
|
||||
|
||||
task copyToDeploy(type: Copy) {
|
||||
from('properties')
|
||||
from(jar)
|
||||
into(deployDir)
|
||||
from jar
|
||||
into deployDir
|
||||
}
|
||||
|
||||
task copyToDeployLib(type: Copy) {
|
||||
from(configurations.runtimeClasspath) {
|
||||
exclude('annotations-*.jar')
|
||||
exclude 'annotations-*.jar'
|
||||
}
|
||||
into(deployDir + '/lib')
|
||||
}
|
||||
|
||||
task deploy(dependsOn: ['clean', 'build', 'jar']) {
|
||||
task deploy {
|
||||
description = "Copies all needed files to the ${deployDir} directory."
|
||||
group = 'Publishing'
|
||||
outputs.dir(deployDir)
|
||||
dependsOn(clean, build, jar)
|
||||
outputs.dir deployDir
|
||||
inputs.files(copyToDeploy, copyToDeployLib)
|
||||
doLast {
|
||||
file(deployDir + '/logs').mkdir()
|
||||
}
|
||||
mustRunAfter(clean)
|
||||
mustRunAfter clean
|
||||
}
|
||||
|
||||
task release(dependsOn: ['wrapper', 'deploy']) {
|
||||
task release {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
dependsOn(wrapper, 'deploy')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue