diff --git a/.github/workflows/.github/workflows/build.yml b/.github/workflows/.github/workflows/build.yml new file mode 100644 index 00000000..15606dea --- /dev/null +++ b/.github/workflows/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: SonarCloud +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available + - 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 + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - 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 sonar --info diff --git a/build.gradle b/build.gradle index 166a5199..5ca6ea20 100644 --- a/build.gradle +++ b/build.gradle @@ -94,10 +94,15 @@ protobuf { } plugins { - grpc { - artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" - } - } + id "org.sonarqube" version "4.4.1.3373" +} + +sonar { + properties { + property "sonar.projectKey", "Liquid-illusion_tron-deployment" + property "sonar.organization", "liquid-illusion1121" + property "sonar.host.url", "https://sonarcloud.io" + } generateProtoTasks { all().each { task -> task.builtins { diff --git a/root directory/configuration/sonar-project.properties b/root directory/configuration/sonar-project.properties new file mode 100644 index 00000000..9101eb42 --- /dev/null +++ b/root directory/configuration/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=Liquid-illusion_tron-deployment +sonar.organization=liquid-illusion1121 + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=tron-deployment +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 diff --git a/settings.gradle b/settings.gradle index afa132d8..6a9c7753 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = 'wallet' \ No newline at end of file +rootProject.name = 'wallet'