Skip to content

Commit 77fda02

Browse files
committed
ci: use separate SonarQube scan action
1 parent 07398a1 commit 77fda02

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.github/workflows/run_maven_tests.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: Java CI with Maven
66
on:
77
push:
88
branches: [ "main" ]
9-
pull_request_target:
9+
pull_request:
1010
branches: [ "**" ]
1111

1212
jobs:
@@ -35,18 +35,15 @@ jobs:
3535
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3636
restore-keys: ${{ runner.os }}-m2
3737
- name: Download maven dependencies
38-
run: ./mvnw package -Dmaven.test.skip=true -B dependency:go-offline dependency:resolve-plugins dependency:resolve -q
38+
run: ./mvnw install -Dmaven.test.skip=true -B dependency:go-offline dependency:resolve-plugins dependency:resolve -q
3939
- name: run unit tests
4040
run: ./mvnw -B verify -Papitests -T $(nproc) -DCI=true
4141
- name: Run the unit tests a second time with jacoco
4242
run: |
4343
# Ensure test stability across graph reloads.
4444
./mvnw -B verify -Papitests -T $(nproc) jacoco:report
45-
- name: Scan results with Sonar
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49-
run: ./mvnw -B org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar
45+
- name: 'Prepare Sonar analysis'
46+
uses: evaristegalois11/sonar-fork-analysis@v1
5047
- name: Rocket.Chat Notification
5148
uses: RocketChat/[email protected]
5249
env:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Sonar'
2+
on:
3+
workflow_run:
4+
workflows: [ 'Java CI with Maven' ]
5+
types:
6+
- completed
7+
jobs:
8+
sonar:
9+
name: 'SonarCube Analysis'
10+
runs-on: ubuntu-latest
11+
#if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
permissions:
13+
actions: read # Required to download artifacts
14+
steps:
15+
- name: 'Sonar analysis'
16+
uses: evaristegalois11/sonar-fork-analysis@v1
17+
with:
18+
distribution: 'temurin'
19+
java-version: '17'
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
sonar-token: ${{ secrets.SONAR_TOKEN }}
22+
project-key: 'GIScience_openrouteservice'

0 commit comments

Comments
 (0)