Code cleanup #50
Workflow file for this run
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
name: Java CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java: [11, 17, 21] | |
env: | |
DEFAULT_JAVA: 17 | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.java }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache SonarQube packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-sonar- | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'gradle' | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
- name: Publish Test Report | |
uses: scacap/action-surefire-report@v1 | |
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} | |
with: | |
report_paths: '**/build/test-results/*/TEST-*.xml' | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sonar analysis | |
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }} | |
run: ./gradlew sonarqube -Dsonar.token=$SONAR_TOKEN | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |