Merge pull request #233 from Tobianas/19.4.0-SNAPSHOT #537
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Build | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
if: ${{ env.SONAR_TOKEN != 0 }} | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Maven install + Test | |
if: ${{ env.SONAR_TOKEN == 0 }} | |
run: mvn clean install -B -V -Psource-quality | |
- name: Maven install + Test + SonarCloud | |
if: ${{ env.SONAR_TOKEN != 0 }} | |
run: mvn clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
-Dsonar.java.source=17 | |
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} | |
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }} | |
-Dsonar.host.url=https://sonarcloud.io | |
-B -V -Psource-quality | |
- name: Upload surefire test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Surefire-Test-Results | |
path: ~/**/surefire-reports/**/*.txt |