Add Sonar Workflow (#24)
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
new file mode 100644
index 0000000..e774f50
--- /dev/null
+++ b/.github/workflows/sonarcloud.yml
@@ -0,0 +1,41 @@
+name: SonarCloud Analysis
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ types: [opened, synchronize, reopened]
+permissions:
+ pull-requests: read
+jobs:
+ build:
+ name: Build and analyze
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # disable shallow clone
+ - name: Set up JDK 11
+ uses: actions/setup-java@v3
+ with:
+ java-version: 11
+ distribution: 'temurin'
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+ - name: Cache Maven packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build and test, with coverage
+ run: mvn -B verify -Pcoverage
+ - name: Perform Sonar analysis
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
+ run: mvn -B verify -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=xmlgraphics-commons
diff --git a/pom.xml b/pom.xml
index 8e01ca4..0545751 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,8 +5,8 @@
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>2.8.0-SNAPSHOT</version>
- <name>${project.groupId}:${project.artifactId}</name>
- <description>XML Graphics Commons</description>
+ <name>Apache XML Graphics Commons</name>
+ <description>XML Graphics Common Support</description>
<url>http://xmlgraphics.apache.org/commons/</url>
<properties>
@@ -21,8 +21,6 @@
<release.version>2.5.2</release.version>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>apache</sonar.organization>
- <sonar.projectKey>xmlgraphics-commons</sonar.projectKey>
- <sonar.projectName>Apache XML Graphics Commons</sonar.projectName>
<surefire.version>2.18.1</surefire.version>
<jdk.path>${env.JAVA_HOME}</jdk.path>
</properties>