diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45e35ea..b3cccab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0 - name: Fetch version history # Do NOT want to fetch all tags if building a specific tag. - # Doing so could result in code published with wrong version, if newer tags have been pushed + # Doing so could result in code published with the wrong version if newer tags have been pushed if: (!startsWith(github.ref, 'refs/tags/')) run: git fetch --tag --unshallow - name: Set up JDK @@ -39,23 +39,26 @@ jobs: java-version: '17' distribution: 'adopt' - name: Setup Gradle - uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1 + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 with: gradle-home-cache-cleanup: true - name: Build env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + CI_NAME: github-actions + CI_JOB_ID: ${{ github.run_id }} + CI_PULL_REQUEST: ${{ github.event.pull_request.number }} run: ./gradlew build coveralls - name: Upload Reports if: failure() - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: reports-linux path: '**/build/reports/**/*.xml' retention-days: 5 - name: Upload Test Results if: failure() - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: test-results-linux path: '**/build/test-results/**/*.xml' @@ -69,8 +72,7 @@ jobs: ORG_GRADLE_PROJECT_SONA_PASSWORD: ${{ secrets.SONA_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ./gradlew cV - ./gradlew publish closeAndReleaseStagingRepository + ./gradlew publish closeAndReleaseStagingRepositories - name: Publish to Gradle Plugins Portal if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-alpha') env: @@ -87,27 +89,31 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0 + - name: Fetch version history + # Do NOT want to fetch all tags if building a specific tag, as it will fail + if: (!startsWith(github.ref, 'refs/tags/')) + run: git fetch --tag --unshallow - name: Set up JDK uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 with: java-version: '17' distribution: 'adopt' - name: Setup Gradle - uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1 + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 with: gradle-home-cache-cleanup: true - name: Build run: ./gradlew.bat build -PexcludeContainerised - - name: Upload Reports + - name: Upload reports if: failure() - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: reports-win path: '**/build/reports/**/*.xml' retention-days: 5 - name: Upload Test Results if: failure() - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: test-results-win path: '**/build/test-results/**/*.xml' diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index d6a358b..457678f 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -14,3 +14,6 @@ * limitations under the License. */ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts index 9b3224f..c5605e2 100644 --- a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts @@ -20,12 +20,13 @@ *
Apply to all java modules, usually excluding the root project in multi-module sets. * *
Versions: + * - 1.13: indentWithSpaces -> leadingTabsToSpaces and a few others * - 1.12: XML reporting for spotbugs * - 1.11: Add explicit checkstyle tool version - * - 1.10: Add ability to exclude containerised tests + * - 1.10: Add the ability to exclude containerised tests * - 1.9: Add `allDeps` task. * - 1.8: Tweak test config to reduce build speed. - * - 1.7: Switch to setting Java version via toolchain + * - 1.7: Switch to setting the Java version via toolchain * - 1.6: Remove GitHub packages for snapshots * - 1.5: Add filters to exclude generated sources * - 1.4: Add findsecbugs-plugin @@ -50,7 +51,7 @@ repositories { mavenCentral() maven { - url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + url = uri("https://central.sonatype.com/repository/maven-snapshots/") mavenContent { includeGroup("org.creekservice") snapshotsOnly() @@ -59,12 +60,12 @@ repositories { } dependencies { - spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0") - checkstyle("com.puppycrawl.tools:checkstyle:10.17.0") + spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0") + checkstyle("com.puppycrawl.tools:checkstyle:10.26.1") } configurations.all { - // Reduce chance of build servers running into compilation issues due to stale snapshots: + // Reduce the chance of build servers running into compilation issues due to stale snapshots: resolutionStrategy.cacheChangingModulesFor(15, TimeUnit.MINUTES) } @@ -80,7 +81,7 @@ tasks.test { } } - setForkEvery(5) + forkEvery = 5 maxParallelForks = Runtime.getRuntime().availableProcessors() testLogging { showStandardStreams = true @@ -94,7 +95,7 @@ tasks.test { spotless { java { googleJavaFormat("1.15.0").aosp().reflowLongStrings() - indentWithSpaces() + leadingTabsToSpaces() importOrder() removeUnusedImports() trimTrailingWhitespace() diff --git a/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts index ab4abb7..a29dda2 100644 --- a/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-plugin-publishing-convention.gradle.kts @@ -20,7 +20,7 @@ *
Versions: * - 1.6: Correct automatic module name * - 1.5: Switch to using `gradlePlugin`, as required by Gradle 8.0 - * - 1.4: Fix website URL to avoid redirect + * - 1.4: Fix website URL to avoid redirect * - 1.3: Switch to setting 'system' from issue-management * *
Apply this plugin to any module publishing a Gradle plugin. diff --git a/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts index e3a1b20..a6e793b 100644 --- a/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-publishing-convention.gradle.kts @@ -17,7 +17,8 @@ /** * Standard configuration for Creek library publishing * - *
Version: 1.2 + *
Version: 1.3 + * - 1.3: Switch to setting 'system' from issue-management * *
Apply this plugin only to subprojects if in multi-module setup. * @@ -113,7 +114,7 @@ publishing { } issueManagement { - name.set("GitHub issues") + system.set("GitHub issues") url.set("https://github.com/creek-service/${rootProject.name}/issues") } } diff --git a/buildSrc/src/main/kotlin/creek-sonatype-publishing-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-sonatype-publishing-convention.gradle.kts index e879ae6..c0173bf 100644 --- a/buildSrc/src/main/kotlin/creek-sonatype-publishing-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-sonatype-publishing-convention.gradle.kts @@ -15,13 +15,13 @@ */ /** - * Standard configuration for Creek library publishing to Maven Central vis SonaType OSSRH + * Standard configuration for Creek library publishing to Maven Central viq the portal * - *
Version: 1.1 + *
Version: 1.2 * *
Apply this plugin only to the root project if in multi-module setup. * - * @see OSSHR Nexus Service + * @see Maven Central Portal */ plugins { @@ -29,11 +29,12 @@ plugins { } nexusPublishing { + packageGroup = "org.creekservice" + repositories { sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - stagingProfileId.set("89a20518f39cd") + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) if (project.hasProperty("SONA_USERNAME")) { username.set(project.property("SONA_USERNAME").toString())