Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 10 additions & 32 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,37 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
java-version: '21'
distribution: 'zulu'
cache: maven
- name: Cache SonarQube packages
uses: actions/cache@v3
uses: actions/cache@v5
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven and analyze with SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
mvn -B test -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dsonar.javaOpts="-Xmx8192m " \
-Dsonar.scanner.debug="true" \
-Dsonar.sources="." \
-Dsonar.exclusions="src/test/java/**/*" \
-Dsonar.tests="src/test/java" \
-X

- name: SonarQube Pull Request Analysis
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
mvn -B test -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dsonar.pullrequest.key="${{ github.event.pull_request.number }}" \
-Dsonar.pullrequest.base="${{ github.event.pull_request.base.ref }}" \
-Dsonar.pullrequest.branch="${{ github.head_ref }}" \
-Dsonar.javaOpts="-Xmx8192m " \
-Dsonar.scanner.debug="true" \
-Dsonar.sources="." \
-Dsonar.exclusions="src/test/java/**/*" \
-Dsonar.tests="src/test/java" \
-X
-Dsonar.maven.scanAll=True

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
#- name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6