Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
chore: Add maven sonar workflow (#1847)
Browse files Browse the repository at this point in the history
* chore: Add maven sonar workflow

* chore: Use latest action versions

* chore: Rename gradle sonar job name

* chore: Fix syntax error in sonar workflow

* chore: Use jacoco for coverage

* chore: Temp disable gradle sonar

* chore: Ignore enforcer and clirr

* chore: Ignore enforcer and clirr on install

* chore: Use correct path

* chore: Use user property for sonar config

* chore: Add enforcer and clirr skip

* chore: Update sonar.yaml

* chore: Re-add gradle sonar

* chore: Remove gradle sonar

* chore: remove jacoco report aggregate
  • Loading branch information
lqiu96 authored Nov 15, 2022
1 parent 9505cb1 commit 903ee87
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,33 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Java 11 Gradle Build
sonar-maven:
name: Java 11 Maven Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
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
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
path: ~/.m2/repository
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: ./gradlew build sonarqube --info
run: mvn -B verify sonar:sonar -Dsonar.projectKey=googleapis_gax-java -Dsonar.organization=googleapis -Dsonar.host.url=https://sonarcloud.io -Denforcer.skip -Dclirr.skip -Dsonar.verbose=true

0 comments on commit 903ee87

Please sign in to comment.