Skip to content

Commit

Permalink
feat(cicd): analyse with sonar cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Aug 29, 2023
1 parent cd4b093 commit ff6409b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: SonarCloud
on:
push:
branches:
- develop
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

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- 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
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle*.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build jacoco sonar --info
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {

// test
id 'com.adarshr.test-logger' version '3.2.0'
id "org.sonarqube" version "4.2.1.3168"

// helper
id "com.github.ben-manes.versions" version "0.47.0"
Expand Down Expand Up @@ -332,6 +333,17 @@ task jacoco(type: JacocoReport) {
}
}

/**********************************************************************************************************************\
* Sonar
**********************************************************************************************************************/
sonar {
properties {
property "sonar.projectKey", "kestra-io_kestra"
property "sonar.organization", "kestra-io"
property "sonar.host.url", "https://sonarcloud.io"
}
}

/**********************************************************************************************************************\
* Standalone
**********************************************************************************************************************/
Expand Down

0 comments on commit ff6409b

Please sign in to comment.