Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#1180] feat(CI): Enable CI to test multiple JDK versions (#1205)

Jerry Shao813c94f061dd
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7f5f2e3805..5d6874dbf4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -51,6 +51,9 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java-version: [ 8, 11, 17 ]
timeout-minutes: 30
needs: changes
if: needs.changes.outputs.source_changes == 'true'
@@ -61,11 +64,11 @@ jobs:
- uses: actions/setup-java@v3
with:
- java-version: '8'
+ java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- name: Build with Gradle
- run: ./gradlew build -PskipITs
+ run: ./gradlew build -PskipITs -PjdkVersion=${{ matrix.java-version }}
- name: Upload unit tests report
uses: actions/upload-artifact@v3
diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml
index ea59697c01..51ad704eca 100644
--- a/.github/workflows/integration-test.yml
+++ b/.github/workflows/integration-test.yml
@@ -55,6 +55,8 @@ jobs:
strategy:
matrix:
architecture: [linux/amd64]
+ java-version: [ 8, 11, 17 ]
+ test-mode: [ embedded, deploy ]
env:
DOCKER_RUN_NAME: hive-amd64
PLATFORM: ${{ matrix.architecture }}
@@ -63,7 +65,7 @@ jobs:
- uses: actions/setup-java@v3
with:
- java-version: '8'
+ java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- name: Set up QEMU
@@ -71,8 +73,8 @@ jobs:
- name: Package Gravitino
run: |
- ./gradlew build -x test
- ./gradlew compileDistribution -x test
+ ./gradlew build -x test -PjdkVersion=${{ matrix.java-version }}
+ ./gradlew compileDistribution -x test -PjdkVersion=${{ matrix.java-version }}
- name: Setup debug Github Action
if: ${{ contains(github.event.pull_request.labels.*.name, 'debug action') }}
@@ -81,14 +83,13 @@ jobs:
- name: Integration Test
id: integrationTest
run: |
- ./gradlew test --rerun-tasks -PskipTests -PtestMode=embedded
- ./gradlew test --rerun-tasks -PskipTests -PtestMode=deploy
+ ./gradlew test --rerun-tasks -PskipTests -PtestMode=${{ matrix.test-mode }} -PjdkVersion=${{ matrix.java-version }}
- name: Upload integrate tests reports
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.integrationTest.outcome == 'failure' }}
with:
- name: integrate test reports
+ name: integrate test reports
path: |
build/reports
integration-test/build/integration-test.log
diff --git a/bin/common.sh b/bin/common.sh
index 074a98eb46..6f9f37eb7c 100644
--- a/bin/common.sh
+++ b/bin/common.sh
@@ -44,6 +44,7 @@ fi
GRAVITINO_CLASSPATH+=":${GRAVITINO_CONF_DIR}"
+JVM_VERSION=8
function check_java_version() {
if [[ -n "${JAVA_HOME+x}" ]]; then
JAVA="$JAVA_HOME/bin/java"
diff --git a/bin/gravitino.sh b/bin/gravitino.sh
index 651436d454..802bd589e2 100755
--- a/bin/gravitino.sh
+++ b/bin/gravitino.sh
@@ -130,6 +130,30 @@ GRAVITINO_SERVER_NAME=com.datastrato.gravitino.server.GravitinoServer
JAVA_OPTS+=" -Dfile.encoding=UTF-8"
JAVA_OPTS+=" -Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/log4j2.properties"
JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR} ${GRAVITINO_MEM}"
+if [ "$JVM_VERSION" -eq 17 ]; then
+ JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
+ JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.lang.invoke=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.lang.reflect=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.lang=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.math=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.net=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.nio=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.text=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.time=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.util.concurrent=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.util.regex=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/java.util=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/jdk.internal.ref=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.sql/java.sql=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/sun.util.calendar=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/sun.nio.ch=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/sun.nio.cs=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/sun.security.action=ALL-UNNAMED"
+ JAVA_OPTS+=" --add-opens java.base/sun.util.calendar=ALL-UNNAMED"
+fi
addJarInDir "${GRAVITINO_HOME}/libs"
@@ -149,4 +173,4 @@ case "${1}" in
;;
*)
echo ${USAGE}
-esac
\ No newline at end of file
+esac
diff --git a/build.gradle.kts b/build.gradle.kts
index ab9c74558a..9248002692 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -246,7 +246,7 @@ subprojects {
sign(publishing.publications)
}
- tasks.withType<Test> {
+ tasks.configureEach<Test> {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
diff --git a/gradle.properties b/gradle.properties
index 0dbdc6de0a..a342ae14d7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,6 +15,6 @@ version = 0.4.0-SNAPSHOT
SONATYPE_USER = admin
SONATYPE_PASSWORD = password
-#jdkVersion is used to specify the version of JDK to build and test against Gravitino, current
+#jdkVersion is used to specify the version of JDK to build and test Gravitino, current
# supported version is 8, 11, and 17.
jdkVersion = 8
diff --git a/integration-test/build.gradle.kts b/integration-test/build.gradle.kts
index 245e862ad2..3b6a6e9357 100644
--- a/integration-test/build.gradle.kts
+++ b/integration-test/build.gradle.kts
@@ -263,6 +263,8 @@ tasks.test {
fileMode = 0b111101101
}
+ jvmArgs(project.property("extraJvmArgs") as List<*>)
+
// Default use MiniGravitino to run integration tests
environment("GRAVITINO_ROOT_DIR", rootDir.path)
environment("HADOOP_USER_NAME", "datastrato")
diff --git a/integration-test/src/main/java/com/datastrato/gravitino/integration/test/MiniGravitino.java b/integration-test/src/main/java/com/datastrato/gravitino/integration/test/MiniGravitino.java
index 26f2703540..3f2eafcdc1 100644
--- a/integration-test/src/main/java/com/datastrato/gravitino/integration/test/MiniGravitino.java
+++ b/integration-test/src/main/java/com/datastrato/gravitino/integration/test/MiniGravitino.java
@@ -220,14 +220,14 @@ public class MiniGravitino {
Collections.emptyMap(),
ErrorHandlers.restErrorHandler());
} catch (RESTException e) {
- LOG.warn("checkIfServerIsRunning() fails, GravitinoServer is not running");
+ LOG.warn("checkIfServerIsRunning() fails, GravitinoServer is not running", e);
+ return false;
}
if (response != null && response.getCode() == 0) {
return true;
} else {
LOG.warn("checkIfServerIsRunning() fails, GravitinoServer is not running");
+ return false;
}
-
- return false;
}
}