Skip to content

Commit

Permalink
Create code quality check action
Browse files Browse the repository at this point in the history
Add a build actions for code quality checking using SonarCloud.io
  • Loading branch information
jsnel committed Oct 13, 2023
1 parent 820adbc commit e2c3c9d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
name: Java CI with Maven

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
# extra argument taken from:
# https://github.com/actions/virtual-environments/issues/1499#issuecomment-689467080

jobs:
build:
Expand All @@ -25,6 +28,4 @@ jobs:
distribution: "adopt"
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml # add -X -V for debugging
# extra argument taken from:
# https://github.com/actions/virtual-environments/issues/1499#issuecomment-689467080
run: mvn -e -B package --file pom.xml
31 changes: 31 additions & 0 deletions .github/workflows/qualitycheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: QualityCheck
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120

jobs:
build:
name: QualityCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: "adopt"
cache: 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 -e -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=glotaran_glotaran-legacy
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
</licenses>

<properties>
<!-- SonarCloud settings -->
<sonar.organization>glotaran</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<!-- SonarCloud settings -->
<sonar.organization>glotaran</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<!-- NBM Plugin settings -->
<project.name.capatilized>Glotaran</project.name.capatilized>
<brandingToken>glotaran</brandingToken>
Expand Down

0 comments on commit e2c3c9d

Please sign in to comment.