Skip to content

Commit

Permalink
ci: add sonarqube to github voter
Browse files Browse the repository at this point in the history
  • Loading branch information
s4heid authored and pk-work committed Mar 12, 2021
1 parent df67723 commit 52f43ab
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
48 changes: 36 additions & 12 deletions .github/workflows/voter.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: NeonBee Voter

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest
name: Test Java ${{ matrix.java }} on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}

strategy:
matrix:
java: ['11.0.2']
platform: [ubuntu-latest] # macOS-latest, windows-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11.0.2' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests with Gradle
run: ./gradlew test
- name: Run javadoc with Gradle
java-version: ${{ matrix.java }}

- 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@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build test sonarqube

- name: Run javadoc
run: ./gradlew javadoc
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
id 'pmd'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'org.sonarqube' version '3.0'
id 'org.sonarqube' version '3.1.1'
id 'team.yi.semantic-gitlog' version '0.5.13'
}

Expand Down Expand Up @@ -162,6 +162,11 @@ docker {
sonarqube {
properties {
property 'sonar.sourceEncoding', 'UTF-8'
property "sonar.projectKey", "neonbee_key"
property "sonar.organization", "neonbee"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.coverage.jacoco.xmlReportPaths', "${buildDir}/reports/jacoco/xml/jacoco.xml"
property 'sonar.junit.reportPaths', "${buildDir}/reports/junit/xml"
}
}

Expand Down Expand Up @@ -229,4 +234,4 @@ task release(type: Exec) {
commandLine 'sh', '-c', "./gradle/release.sh ${nextVersion}"
}
}
}
}

0 comments on commit 52f43ab

Please sign in to comment.