diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fcf45e539..2fbfae808 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -39,8 +39,21 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + - name: Cache SonarCloud packages + uses: actions/cache@v2.1.2 + if: matrix.java_version == '11' + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar - name: Run tests - run: ./mvnw -V -B -ntp -ff verify + run: ./mvnw -V -B -ntp -ff verify jacoco:report + - name: Static Analysis (Sonar) + if: matrix.java_version == '11' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./mvnw -B -ntp -ff org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - name: Release Snapshot if: matrix.java_version == '11' run: ./mvnw -V -B -ntp -ff deploy diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 047beb4c2..0bbe28a30 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -32,5 +32,18 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + - name: Cache SonarCloud packages + uses: actions/cache@v2.1.2 + if: matrix.java_version == '11' + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar - name: Run tests run: ./mvnw -V -B -ntp -ff verify + - name: Static Analysis (Sonar) + if: matrix.java_version == '11' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./mvnw -B -ntp -ff org.sonarsource.scanner.maven:sonar-maven-plugin:sonar diff --git a/README.md b/README.md index 9f804609b..885940bb8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Compare two OpenAPI specifications (3.x) and render the difference to HTML plaintext, or Markdown files. [![Build](https://github.com/OpenAPITools/openapi-diff/workflows/Main%20Build/badge.svg)](https://github.com/OpenAPITools/openapi-diff/actions?query=branch%3Amaster+workflow%3A"Main+Build") +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=OpenAPITools_openapi-diff&metric=alert_status)](https://sonarcloud.io/dashboard?id=OpenAPITools_openapi-diff) [![Maven Central](https://img.shields.io/maven-central/v/org.openapitools.openapidiff/openapi-diff-core)](https://search.maven.org/artifact/org.openapitools.openapidiff/openapi-diff-core) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) diff --git a/pom.xml b/pom.xml index 49167d444..7aa3599e7 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,12 @@ UTF-8 UTF-8 github + + openapitools + OpenAPITools_openapi-diff + https://sonarcloud.io + ${project.artifactId} + 2.0.22 1.7.30 @@ -306,6 +312,16 @@ 1.6.8 true + + org.jacoco + jacoco-maven-plugin + 0.8.6 + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.7.0.1746 + @@ -347,6 +363,18 @@ + + org.jacoco + jacoco-maven-plugin + + + jacoco-initialize + + prepare-agent + + + +