Skip to content

Commit

Permalink
Refactor build/release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Feb 14, 2024
1 parent 18f154d commit 8581e7a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,15 @@ jobs:
java-package: jdk
java-version: ${{ matrix.jdk }}

# ================================
# CACHE SONARCLOUD PACKAGES
# ================================
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
key: ${{ runner.os }}-sonar
path: |
~/.sonar/cache
restore-keys: |
${{ runner.os }}-sonar
# ================================
# SETUP GRADLE
# ================================
- 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' }}

# ================================
Expand All @@ -76,22 +67,36 @@ jobs:
- name: Build
uses: gradle/actions/setup-gradle@v3
with:
arguments: build -x check --info --scan
arguments: build -x check --info

# ================================
# CHECK
# ================================
- name: Check
uses: gradle/actions/setup-gradle@v3
with:
arguments: check --info --scan
arguments: check --info

# ================================
# COMPATIBILITY REPORT
# ================================
- name: Compatibility report
if: ${{ matrix.jdk == 21 }}
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
# ================================
Expand All @@ -103,4 +108,4 @@ jobs:
SONAR_ORGANIZATION: leakyabstractions
uses: gradle/actions/setup-gradle@v3
with:
arguments: sonarqube --info --scan
arguments: sonarqube --info
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
steps:

# ================================
# CHECKOUT
# SHALLOW CLONE
# ================================
- name: Checkout git tag
- name: Shallow clone
uses: actions/checkout@v4

# ================================
Expand Down Expand Up @@ -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
7 changes: 0 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 8581e7a

Please sign in to comment.