From 4470db5a6f7a7e8bf54bc68abf419667874ff4d8 Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Tue, 22 Feb 2022 20:35:03 -0500 Subject: [PATCH 1/2] chore: Add SonarCloud support --- .github/workflows/sonar.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/sonar.yaml diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml new file mode 100644 index 0000000000..4c379cd0ae --- /dev/null +++ b/.github/workflows/sonar.yaml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + 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 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=googleapis_gapic-generator-java -Dsonar.organization=googleapis -Dsonar.host.url=https://sonarcloud.io From 5207f6fc2b83f5871fd45e3c7df29cedef9c88c6 Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Tue, 22 Feb 2022 20:37:25 -0500 Subject: [PATCH 2/2] Update sonar.yaml --- .github/workflows/sonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 4c379cd0ae..9e7862f9e9 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -1,4 +1,4 @@ -name: Build +name: SonarCloud Build on: push: branches: