diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b171473..28fd6fb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,14 +5,38 @@ on: [push, pull_request, workflow_dispatch] jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: Test with Gradle - run: ./gradlew check + env: + CI_NAME: "GitHub CI" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew check sonarqube + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties diff --git a/.travis.yml b/.travis.yml index 957710f..8b09e0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,22 +5,9 @@ env: global: - CI=true -#install: -# - git fetch --unshallow --tags - -addons: - sonarcloud: - organization: "ethauvin-github" - jdk: - openjdk11 - openjdk15 before_install: - chmod +x gradlew - -after_success: - - | - if [ "${TRAVIS_TEST_RESULT}" == 0 ] && [ "$TRAVIS_JDK_VERSION" == "openjdk15" ]; then - ./gradlew sonarqube - fi diff --git a/build.gradle.kts b/build.gradle.kts index e4d22a7..be83ede 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,6 +61,8 @@ detekt { sonarqube { properties { property("sonar.projectKey", "ethauvin_$name") + property("sonar.organization", "ethauvin-github") + property("sonar.host.url", "https://sonarcloud.io") property("sonar.sourceEncoding", "UTF-8") } }