From 0d47889f4c952dde365235187a9b11bae7dfde74 Mon Sep 17 00:00:00 2001 From: Guillermo Calvo Date: Tue, 13 Feb 2024 20:23:18 +0100 Subject: [PATCH] Refactor build/release pipeline --- .github/workflows/build.yml | 22 +++++++++++++++++++--- .github/workflows/release.yml | 9 ++++++--- build.gradle | 7 ------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f86ff5..0f8fee8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,6 +68,9 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: + build-scan-publish: true + build-scan-terms-of-service-url: https://gradle.com/terms-of-service + build-scan-terms-of-service-agree: yes cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} # ================================ @@ -76,7 +79,7 @@ jobs: - name: Build uses: gradle/actions/setup-gradle@v3 with: - arguments: build -x check --info --scan + arguments: build -x check --info # ================================ # CHECK @@ -84,7 +87,7 @@ jobs: - name: Check uses: gradle/actions/setup-gradle@v3 with: - arguments: check --info --scan + arguments: check --info # ================================ # COMPATIBILITY REPORT @@ -92,6 +95,19 @@ jobs: - name: Compatibility report run: cat ./api-compatibility/build/report.txt >> $GITHUB_STEP_SUMMARY + # ================================ + # CACHE SONARCLOUD PACKAGES + # ================================ + - name: Cache SonarCloud packages + if: ${{ matrix.jdk == 21 }} + uses: actions/cache@v4 + with: + key: ${{ runner.os }}-sonar + path: | + ~/.sonar/cache + restore-keys: | + ${{ runner.os }}-sonar + # ================================ # ANALYZE # ================================ @@ -103,4 +119,4 @@ jobs: SONAR_ORGANIZATION: leakyabstractions uses: gradle/actions/setup-gradle@v3 with: - arguments: sonarqube --info --scan + arguments: sonarqube --info diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45790a3..21f3d7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,9 +15,9 @@ jobs: steps: # ================================ - # CHECKOUT + # SHALLOW CLONE # ================================ - - name: Checkout git tag + - name: Shallow clone uses: actions/checkout@v4 # ================================ @@ -50,4 +50,7 @@ jobs: ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} uses: gradle/actions/setup-gradle@v3 with: - arguments: publish -Prelease --info --scan + build-scan-publish: true + build-scan-terms-of-service-url: https://gradle.com/terms-of-service + build-scan-terms-of-service-agree: yes + arguments: publish -Prelease --info diff --git a/build.gradle b/build.gradle index c912927..e0654f9 100644 --- a/build.gradle +++ b/build.gradle @@ -20,13 +20,6 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass } } -if (hasProperty('buildScan')) { - buildScan { - termsOfServiceUrl = 'https://gradle.com/terms-of-service' - termsOfServiceAgree = 'yes' - } -} - /** * Print project property by key * - Usage: `./gradlew -q printProperty -Pkey=description`