Moved Sonarqube to GitHub action.

This commit is contained in:
Erik C. Thauvin 2021-05-19 22:52:19 -07:00
parent 6f15433034
commit 37789dc633
4 changed files with 48 additions and 13 deletions

42
.github/workflows/gradle.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Java CI with Gradle
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test with Gradle
env:
CI_NAME: "GitHub CI"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew check sonarqube
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties

View file

@ -5,15 +5,5 @@ jdk:
- oraclejdk8 - oraclejdk8
- openjdk14 - openjdk14
addons:
sonarcloud:
organization: "ethauvin-github"
before_install: before_install:
- chmod +x gradlew - chmod +x gradlew
after_success:
- |
if [ "${TRAVIS_TEST_RESULT}" == 0 ] && [ "$TRAVIS_JDK_VERSION" == "openjdk14" ]; then
./gradlew sonarqube
fi

View file

@ -93,6 +93,7 @@ clean {
test { test {
testLogging { testLogging {
exceptionFormat "full" exceptionFormat "full"
events "passed", "skipped", "failed"
} }
useTestNG() useTestNG()
@ -178,7 +179,7 @@ task copyToDeploy(type: Copy) {
} }
task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) { task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
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 outputs.dir deployDir
inputs.files copyToDeploy inputs.files copyToDeploy
@ -219,7 +220,9 @@ jacocoTestReport {
sonarqube { sonarqube {
properties { properties {
property("sonar.projectKey", "ethauvin_HttpStatus") property "sonar.organization", "ethauvin-github"
property "sonar.projectKey", "ethauvin_semver"
property "sonar.host.url", "https://sonarcloud.io"
property("sonar.sourceEncoding", "UTF-8") property("sonar.sourceEncoding", "UTF-8")
} }
} }

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists