Skip to content

Commit

Permalink
Update build (#63)
Browse files Browse the repository at this point in the history
* build: Use java toolchain and test suite

See: https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#test_framework_implementation_dependencies

* build: Migrate from `gradleEnterprise` to `develocity` 3.18

This commit updates the build configuration to replace the deprecated
gradleEnterprise extension with the new develocity extension (version 3.18).
This migration ensures compatibility with future updates and takes advantage
of the latest features and improvements in the develocity plugin.
  • Loading branch information
matrei authored Aug 27, 2024
1 parent 0706606 commit 35bb058
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ jobs:
- name: "🔨 Run Build"
id: build
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: >
./gradlew build
-Dgeb.env=chromeHeadless
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew build
- name: "📤 Publish Snapshot to repo.grails.org"
if: steps.build.outcome == 'success' && github.event_name == 'push'
env:
ORG_GRADLE_PROJECT_artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
ORG_GRADLE_PROJECT_artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: >
./gradlew
-Dorg.gradle.internal.publish.checksums.insecure=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: "📤 Publish to Sonatype"
id: publish_to_sonatype
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
ORG_GRADLE_PROJECT_sonatypeOssUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypeOssPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeOssStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
Expand Down
20 changes: 15 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ version = projectVersion

apply plugin: 'groovy'
apply plugin: 'java-library'
apply plugin: 'jvm-test-suite'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply plugin: 'maven-publish'
Expand All @@ -41,7 +42,7 @@ configurations.configureEach {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
withJavadocJar()
}
Expand Down Expand Up @@ -81,17 +82,26 @@ tasks.named('jar', Jar) {
archiveClassifier = ''
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging { events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' }
testing {
suites {
test {
useJUnitJupiter()
targets.configureEach {
testTask.configure { Test task ->
task.testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
}
}
}

ext.set('signing.keyId', System.getenv('SIGNING_KEY'))
ext.set('signing.password', System.getenv('SIGNING_PASSPHRASE'))
ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT'))
ext.set('isReleaseVersion', !isSnapshot)


def javaComponent = components.named('java')
publishing {
publications {
Expand Down
25 changes: 12 additions & 13 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
plugins {
id 'com.gradle.enterprise' version '3.16.2'
id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13'
id 'com.gradle.develocity' version '3.18'
id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2'
}

gradleEnterprise {
def isCI = System.getenv('CI') != null
def isLocal = !isCI
def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null

develocity {
server = 'https://ge.grails.org'
buildScan {
publishAlwaysIf(System.getenv('CI') == 'true')
publishIfAuthenticated()
uploadInBackground = System.getenv("CI") == null
capture {
taskInputFiles = true
}
publishing.onlyIf { isAuthenticated }
uploadInBackground = isLocal
}
}

buildCache {
local { enabled = System.getenv('CI') != 'true' }
remote(gradleEnterprise.buildCache) {
def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY')
push = System.getenv('CI') == 'true' && isAuthenticated
local { enabled = isLocal }
remote(develocity.buildCache) {
push = isCI && isAuthenticated
enabled = true
}
}
Expand Down

0 comments on commit 35bb058

Please sign in to comment.