Skip to content

Merge pull request #220 from ihrasko/18.x-bumps #498

Merge pull request #220 from ihrasko/18.x-bumps

Merge pull request #220 from ihrasko/18.x-bumps #498

Workflow file for this run

# 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