Skip to content

Commit

Permalink
Modify build files for coverage and sonar analysis...
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalle Norrestam authored and RokLenarcic committed Aug 31, 2022
1 parent 0121406 commit ce1863f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Tests With Clover
on:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Configure credentials
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
# Run build steps
- run: mvn clean clover:setup
- run: mvn test
- run: mvn clover:aggregate clover:clover
if: always()
- run: aws s3 cp ./target/site/clover/clover.xml s3://codescene-on-prem/code-coverage-data/apache/zookeeper/clover.xml
11 changes: 3 additions & 8 deletions .github/workflows/build.yml → .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Build
name: Run Sonar Analysis
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
Expand All @@ -28,10 +25,8 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
# Run build steps
- run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipTests -e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- run: mvn clean clover:setup
- run: mvn test
- run: mvn clover:aggregate clover:clover
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@
</profiles>

<properties>
<!-- sonar properties -->
<sonar.projectKey>zookeeper</sonar.projectKey>
<sonar.organization>knorrest</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<!-- maven properties -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down

0 comments on commit ce1863f

Please sign in to comment.