diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..28fd6fb --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,42 @@ +name: Java CI with Gradle + +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 + 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 7ee8f56..dbd6b8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,5 @@ jdk: - oraclejdk8 - openjdk14 -addons: - sonarcloud: - organization: "ethauvin-github" - before_install: - chmod +x gradlew - -after_success: - - | - if [ "${TRAVIS_TEST_RESULT}" == 0 ] && [ "$TRAVIS_JDK_VERSION" == "openjdk14" ]; then - ./gradlew sonarqube - fi diff --git a/build.gradle b/build.gradle index be3edf1..c21ebf1 100644 --- a/build.gradle +++ b/build.gradle @@ -93,6 +93,7 @@ clean { test { testLogging { exceptionFormat "full" + events "passed", "skipped", "failed" } useTestNG() @@ -178,7 +179,7 @@ task copyToDeploy(type: Copy) { } task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) { - description = 'Copies all needed files to the ${deployDir} directory.' + description = "Copies all needed files to the ${deployDir} directory." group = 'Publishing' outputs.dir deployDir inputs.files copyToDeploy @@ -219,7 +220,9 @@ jacocoTestReport { sonarqube { properties { - property("sonar.projectKey", "ethauvin_HttpStatus") + property "sonar.organization", "ethauvin-github" + property "sonar.projectKey", "ethauvin_semver" + property "sonar.host.url", "https://sonarcloud.io" property("sonar.sourceEncoding", "UTF-8") } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e5338d3..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists