diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 59b04c0..607fdc7 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -5,6 +5,7 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] + types: [opened, synchronize, reopened] permissions: contents: write @@ -29,8 +30,23 @@ jobs: build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" build-scan-terms-of-use-agree: "yes" dependency-graph: generate-and-submit + - name: Cache SonarQube packages + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle - name: Run CI build - run: ./gradlew build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew build sonar --info asciidoc-build: # The type of runner that the job will run on diff --git a/build.gradle b/build.gradle index 60fbc41..52ff2c7 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.4.1' apply false id 'io.spring.dependency-management' version '1.1.7' + id "org.sonarqube" version '6.0.1.5171' } group = 'zin.rashidi' @@ -24,3 +25,11 @@ dependencyManagement { mavenBom SpringBootPlugin.BOM_COORDINATES } } + +sonar { + properties { + property "sonar.projectKey", "rashidi_spring-boot-tutorials" + property "sonar.organization", "rashidi-github" + property "sonar.host.url", "https://sonarcloud.io" + } +} \ No newline at end of file