From ce1863fdbc4ec85262590520cc9f11d251412654 Mon Sep 17 00:00:00 2001 From: Kalle Norrestam Date: Mon, 22 Mar 2021 14:35:34 +0100 Subject: [PATCH] Modify build files for coverage and sonar analysis... --- .github/workflows/coverage.yml | 33 ++++++++++++++++++++++ .github/workflows/{build.yml => sonar.yml} | 11 ++------ pom.xml | 4 +++ 3 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/coverage.yml rename .github/workflows/{build.yml => sonar.yml} (84%) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..418ff13f92b --- /dev/null +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/sonar.yml similarity index 84% rename from .github/workflows/build.yml rename to .github/workflows/sonar.yml index c528e6b084e..dade8aa87b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/sonar.yml @@ -1,8 +1,5 @@ -name: Build +name: Run Sonar Analysis on: - push: - branches: - - master workflow_dispatch: jobs: build: @@ -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 diff --git a/pom.xml b/pom.xml index b772e3fc034..39bf7445cd3 100755 --- a/pom.xml +++ b/pom.xml @@ -448,6 +448,10 @@ + + zookeeper + knorrest + https://sonarcloud.io 1.8 1.8