Skip to content

Commit 43a200d

Browse files
authored
Trigger Sonarcloud analysis from GHA (#143)
Only generate coverage info conditionally (with profile "code-coverage") This closes #140
1 parent a747eb8 commit 43a200d

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest, macos-latest]
1616
java: [ '11', '17', '21' ]
17+
include:
18+
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
19+
- os: ubuntu-latest
20+
java: '17'
21+
isMainBuildEnv: true
1722
fail-fast: false
1823

1924
runs-on: ${{ matrix.os }}
@@ -27,5 +32,12 @@ jobs:
2732
cache: 'maven'
2833

2934
- name: Build with Maven
35+
if: '!matrix.isMainBuildEnv'
3036
run: ./mvnw verify -e -B -V
3137

38+
- name: Build with Maven (incl. Sonarcloud analysis)
39+
if: 'matrix.isMainBuildEnv'
40+
env:
41+
# SonarCloud access token and project coordinates provided in context of https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/4700
42+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
run: ./mvnw verify -Pcode-coverage -e -B -V org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
```
1010

1111
[![build](https://github.com/eclipse/sisu.inject/actions/workflows/build.yml/badge.svg?event=push)](https://github.com/eclipse/sisu.inject/actions/workflows/build.yml)
12-
[![maintainability](https://sonarcloud.io/api/project_badges/measure?project=org.eclipse.sisu%3Asisu-inject&metric=sqale_rating)](https://sonarcloud.io/summary/overall?id=org.eclipse.sisu%3Asisu-inject)
12+
[![maintainability](https://sonarcloud.io/api/project_badges/measure?project=eclipse-sisu_sisu.inject&metric=sqale_rating)](https://sonarcloud.io/summary/overall?id=eclipse-sisu_sisu.inject)
1313
[![license](https://img.shields.io/badge/license-EPL_1.0-blue.svg)](https://www.eclipse.org/legal/epl-v10.html)
1414

1515
Sisu is a modular [JSR330](https://javax-inject.github.io/javax-inject/)-based container that supports classpath scanning, auto-binding, and dynamic auto-wiring.

pom.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,6 @@ Bundle-DocURL: http://www.eclipse.org/sisu/
624624
<groupId>org.apache.maven.plugins</groupId>
625625
<artifactId>maven-enforcer-plugin</artifactId>
626626
</plugin>
627-
<plugin>
628-
<groupId>org.jacoco</groupId>
629-
<artifactId>jacoco-maven-plugin</artifactId>
630-
</plugin>
631627
</plugins>
632628
</build>
633629

@@ -689,5 +685,16 @@ Bundle-DocURL: http://www.eclipse.org/sisu/
689685
</plugins>
690686
</build>
691687
</profile>
688+
<profile>
689+
<id>code-coverage</id>
690+
<build>
691+
<plugins>
692+
<plugin>
693+
<groupId>org.jacoco</groupId>
694+
<artifactId>jacoco-maven-plugin</artifactId>
695+
</plugin>
696+
</plugins>
697+
</build>
698+
</profile>
692699
</profiles>
693700
</project>

0 commit comments

Comments
 (0)