Merge pull request #107 from tnaskali/dependabot/maven/com.diffplug.s… #215
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: code analysis | |
on: | |
push: | |
branches: [ 'master' ] | |
tags: [ 'v*.*.*' ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
permissions: | |
pull-requests: read # allows SonarCloud to decorate PRs with analysis results | |
env: | |
SONAR_URL: https://sonarcloud.io | |
SONAR_PROJECTKEY: ${{ github.repository_owner }}_bgg-api | |
SONAR_ORGANIZATION: ${{ github.repository_owner }} | |
jobs: | |
analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
mvn --batch-mode verify sonar:sonar -Dsonar.host.url=${{ env.SONAR_URL }} -Dsonar.projectKey=${{ env.SONAR_PROJECTKEY }} -Dsonar.organization=${{ env.SONAR_ORGANIZATION }} |