Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,24 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# PR builds get a unique version (<base>-pr<PR#>.<sha>) so the resulting
# Docker image can be pulled locally to test the PR before merging.
# gradle.properties holds the plain version. Effective version by event:
# PR -> <base>-pr<PR#>.<sha> (pullable image to test the PR)
# develop push -> <base>-SNAPSHOT (development build)
# master push -> <base> (release, published as-is)
- name: Determine build version
id: ver
run: |
BASE=$(grep '^continuumVersion=' gradle.properties | cut -d= -f2)
BASE=${BASE%-SNAPSHOT}
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
VERSION="${BASE%-SNAPSHOT}-pr${{ github.event.pull_request.number }}.${SHORT_SHA}"
VERSION="${BASE}-pr${{ github.event.pull_request.number }}.${SHORT_SHA}"
echo "gradle_args=-PcontinuumVersion=${VERSION}" >> "$GITHUB_OUTPUT"
else
elif [[ "${{ github.ref_name }}" == "master" ]]; then
VERSION="${BASE}"
echo "gradle_args=-Prelease" >> "$GITHUB_OUTPUT"
else
VERSION="${BASE}-SNAPSHOT"
echo "gradle_args=" >> "$GITHUB_OUTPUT"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
Expand All @@ -62,7 +68,7 @@ jobs:

- name: Publish to Maven Central with JReleaser
if: ${{ github.event_name == 'push' && steps.gradle_build.outcome == 'success' }}
run: ./gradlew publish && ./gradlew jreleaserDeploy --info
run: ./gradlew publish ${{ steps.ver.outputs.gradle_args }} && ./gradlew jreleaserDeploy --info ${{ steps.ver.outputs.gradle_args }}
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_TOKEN_USERNAME }}
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVEN_TOKEN_PASSWORD }}
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Version Check

on:
pull_request:
branches:
- master

jobs:
require_version_bump:
name: Require version bump
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compare version with base branch
run: |
HEAD_VERSION=$(grep '^continuumVersion=' gradle.properties | cut -d= -f2)

git fetch origin "${{ github.base_ref }}" --depth=1
BASE_VERSION=$(git show "origin/${{ github.base_ref }}:gradle.properties" | grep '^continuumVersion=' | cut -d= -f2)

# The numeric core ignores any pre-release suffix (-SNAPSHOT, -rc1, ...)
HEAD_CORE=${HEAD_VERSION%%-*}
BASE_CORE=${BASE_VERSION%%-*}

echo "Base (${{ github.base_ref }}): ${BASE_VERSION}"
echo "Head: ${HEAD_VERSION}"

fail() { echo "::error::$1"; exit 1; }

if [[ "${HEAD_CORE}" == "${BASE_CORE}" ]]; then
if [[ "${HEAD_VERSION}" == "${BASE_VERSION}" ]]; then
fail "continuumVersion is still ${HEAD_VERSION}; bump it in gradle.properties before merging to ${{ github.base_ref }} (releases are immutable in Maven Central)"
elif [[ "${HEAD_VERSION}" == "${HEAD_CORE}" ]]; then
# pre-release -> release promotion of the same version (e.g. 3.6.0-rc1 -> 3.6.0)
echo "Version promotion OK: ${BASE_VERSION} -> ${HEAD_VERSION}"
elif [[ "${BASE_VERSION}" == "${BASE_CORE}" ]]; then
fail "continuumVersion ${HEAD_VERSION} is a pre-release of ${BASE_VERSION}, which is already released"
else
# both pre-releases of the same version: head must sort after base
HIGHEST=$(printf '%s\n%s\n' "${BASE_VERSION}" "${HEAD_VERSION}" | sort -V | tail -1)
if [[ "${HIGHEST}" != "${HEAD_VERSION}" ]]; then
fail "continuumVersion ${HEAD_VERSION} is lower than ${BASE_VERSION} on ${{ github.base_ref }}"
fi
echo "Version bump OK: ${BASE_VERSION} -> ${HEAD_VERSION}"
fi
else
HIGHEST=$(printf '%s\n%s\n' "${BASE_CORE}" "${HEAD_CORE}" | sort -V | tail -1)
if [[ "${HIGHEST}" != "${HEAD_CORE}" ]]; then
fail "continuumVersion ${HEAD_VERSION} is lower than ${BASE_VERSION} on ${{ github.base_ref }}"
fi
echo "Version bump OK: ${BASE_VERSION} -> ${HEAD_VERSION}"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,41 @@ dependencies {

// Options to configure here https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#build-image
// bootBuildImage task source https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImage.java

// Full --add-opens set recommended by Apache Ignite for JDK 11+
// https://ignite.apache.org/docs/latest/quick-start/java#running-ignite-with-java-11-or-later
// A missing entry surfaces at runtime as InaccessibleObjectException during Ignite marshalling
def igniteAddOpens = [
'java.base/jdk.internal.access',
'java.base/jdk.internal.misc',
'java.base/sun.nio.ch',
'java.base/sun.util.calendar',
'java.management/com.sun.jmx.mbeanserver',
'jdk.internal.jvmstat/sun.jvmstat.monitor',
'java.base/sun.reflect.generics.reflectiveObjects',
'jdk.management/com.sun.management.internal',
'java.base/java.io',
'java.base/java.nio',
'java.base/java.net',
'java.base/java.util',
'java.base/java.util.concurrent',
'java.base/java.util.concurrent.locks',
'java.base/java.util.concurrent.atomic',
'java.base/java.lang',
'java.base/java.lang.invoke',
'java.base/java.lang.reflect',
'java.base/java.math',
'java.sql/java.sql',
'java.base/java.time',
'java.base/java.text',
'java.management/sun.management',
'java.desktop/java.awt.font'
].collect { "--add-opens=${it}=ALL-UNNAMED" }.join(' ')

bootBuildImage {
network = "host"
publish = true
// Local builds only produce the image; CI publishes by passing --publishImage
publish = false
imageName = "mindsignited/${project.name}:${project.version}"
// Only release versions (no -SNAPSHOT / -prN.sha suffix) may claim the latest tag
tags = (!version.contains('-') ?
Expand All @@ -33,7 +65,7 @@ bootBuildImage {
: [])
environment = [
"BPE_DELIM_JAVA_TOOL_OPTIONS" : " ",
"BPE_APPEND_JAVA_TOOL_OPTIONS" : "-XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:+DisableExplicitGC --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED-XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:+DisableExplicitGC --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED"
"BPE_APPEND_JAVA_TOOL_OPTIONS" : "-XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:+DisableExplicitGC ${igniteAddOpens}".toString()
]
docker {
publishRegistry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ plugins {
}

group 'org.kinotic'
version = "${continuumVersion}"

// gradle.properties holds the plain version (e.g. 3.1.0). Development builds get
// -SNAPSHOT appended automatically; CI passes -Prelease on master to publish the
// version as-is (stripping a leftover -SNAPSHOT so the guard and the build agree),
// and PR builds pass an explicit -PcontinuumVersion override.
def effectiveVersion = "${continuumVersion}"
if (hasProperty('release')) {
effectiveVersion = effectiveVersion - '-SNAPSHOT'
} else if (!effectiveVersion.contains('-')) {
effectiveVersion += '-SNAPSHOT'
}
version = effectiveVersion

java {
sourceCompatibility = '21'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
continuumVersion=3.1.0-SNAPSHOT
continuumVersion=3.1.0

allureVersion=2.29.1
aspectJVersion=1.9.22.1
Expand Down
Loading