This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f6481461 ci(kotlin): test Kotlin 2.4.10 on JDK 26 (#4002)
4f6481461 is described below

commit 4f648146159608f2860aa535caeb6c7412cb4016
Author: Shawn Yang <[email protected]>
AuthorDate: Mon Aug 31 00:38:10 2026 +0800

    ci(kotlin): test Kotlin 2.4.10 on JDK 26 (#4002)
    
    ## Why?
    
    
    
    ## What does this PR do?
    
    
    
    ## Related issues
    
    
    
    ## AI Contribution Checklist
    
    
    
    - [ ] Substantial AI assistance was used in this PR: `yes` / `no`
    - [ ] If `yes`, I included a completed [AI Contribution
    
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
    in this PR description and the required `AI Usage Disclosure`.
    - [ ] If `yes`, my PR description includes the required `ai_review`
    summary and screenshot evidence or equivalent persisted links of the
    final clean AI review results from both fresh reviewers described in
    `AI_POLICY.md`, the Fory-guided reviewer and the independent general
    reviewer, on the current PR diff or current HEAD after the latest code
    changes.
    
    
    
    ## Does this PR introduce any user-facing change?
    
    
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
---
 .github/workflows/ci.yml | 18 ++++++++++++---
 ci/run_ci.py             |  5 ++++
 ci/tasks/kotlin.py       | 59 ++++++++++++++++++++++++++++++++++--------------
 3 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 16108ec7d..60f070d46 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -728,7 +728,7 @@ jobs:
         run: python ./ci/run_ci.py kotlin --task native-json
 
   kotlin:
-    name: Kotlin CI
+    name: Kotlin CI (${{ matrix.label }})
     needs: changes
     if: needs.changes.outputs.kotlin == 'true'
     runs-on: ubuntu-latest
@@ -736,7 +736,19 @@ jobs:
       MY_VAR: "PATH"
     strategy:
       matrix:
-        java-version: ["8", "11", "17", "21", "25", "26"]
+        include:
+          - java-version: "8"
+            kotlin_args: ""
+            label: JDK 8
+          - java-version: "11"
+            kotlin_args: ""
+            label: JDK 11
+          - java-version: "17"
+            kotlin_args: ""
+            label: JDK 17
+          - java-version: "26"
+            kotlin_args: --kotlin-version 2.4.10
+            label: Kotlin 2.4.10 / JDK 26
     steps:
       - uses: actions/checkout@v5
       - name: Set up JDK ${{ matrix.java-version }}
@@ -756,7 +768,7 @@ jobs:
         with:
           python-version: 3.11
       - name: Run Kotlin CI
-        run: python ./ci/run_ci.py kotlin
+        run: python ./ci/run_ci.py kotlin ${{ matrix.kotlin_args }}
 
   scala:
     name: Scala CI
diff --git a/ci/run_ci.py b/ci/run_ci.py
index 9a78c73ba..4c442afbf 100644
--- a/ci/run_ci.py
+++ b/ci/run_ci.py
@@ -347,6 +347,11 @@ def parse_args():
         default="tests",
         help="Kotlin CI task to execute",
     )
+    kotlin_parser.add_argument(
+        "--kotlin-version",
+        default=None,
+        help="Override the Kotlin compiler and library version",
+    )
     kotlin_parser.set_defaults(func=kotlin.run)
 
     # Python subparser
diff --git a/ci/tasks/kotlin.py b/ci/tasks/kotlin.py
index d9f8b6d0c..02c3b0335 100644
--- a/ci/tasks/kotlin.py
+++ b/ci/tasks/kotlin.py
@@ -63,6 +63,15 @@ def java_major_version():
     return int(version.split(".")[0])
 
 
+def kotlin_version_option(version):
+    """Return the Maven property for an explicit stable Kotlin version."""
+    if version is None:
+        return ""
+    if re.fullmatch(r"\d+\.\d+\.\d+", version) is None:
+        raise ValueError(f"Invalid Kotlin version: {version}")
+    return f"-Dkotlin.version={version}"
+
+
 def install_java_json(include_jpms=False):
     """Install the Java artifacts consumed by Kotlin JSON modules."""
     modules = "fory-json,fory-annotation-processor"
@@ -87,20 +96,24 @@ def install_java_json(include_jpms=False):
     )
 
 
-def install_artifacts(include_corpus=True, modules=PRODUCTION_MODULES):
+def install_artifacts(
+    include_corpus=True, modules=PRODUCTION_MODULES, kotlin_version=None
+):
     """Install Kotlin production artifacts and the shared JSON corpus."""
     # Artifact consumers need only main JARs. Test stages compile their own 
test sources later.
+    version_option = kotlin_version_option(kotlin_version)
     common.cd_project_subdir("kotlin")
     common.exec_cmd(
         "mvn -T16 --batch-mode --no-transfer-progress "
         f"-pl {modules} -am clean install -Dmaven.test.skip=true "
-        "-Ddokka.skip=true -Dmaven.source.skip=true"
+        f"-Ddokka.skip=true -Dmaven.source.skip=true {version_option}"
     )
     if include_corpus:
         common.cd_project_subdir("integration_tests/kotlin_json_corpus")
         common.exec_cmd(
             "mvn -T16 --batch-mode --no-transfer-progress clean install "
-            "-Dmaven.test.skip=true -Ddokka.skip=true -Dmaven.source.skip=true"
+            "-Dmaven.test.skip=true -Ddokka.skip=true -Dmaven.source.skip=true 
"
+            f"{version_option}"
         )
         verify_corpus_artifact()
 
@@ -164,24 +177,30 @@ def _kotlin_version():
     return version
 
 
-def run_tests():
+def run_tests(kotlin_version=None):
     """Run the Kotlin JVM matrix for the active JDK."""
     logging.info("Executing fory kotlin tests")
     os.environ.setdefault("ENABLE_FORY_DEBUG_OUTPUT", "1")
     major = java_major_version()
+    version_option = kotlin_version_option(kotlin_version)
     install_java_json(include_jpms=major == 25)
     modules = PRODUCTION_MODULES if major >= 17 else LOW_JDK_MODULES
-    install_artifacts(include_corpus=major >= 17, modules=modules)
+    install_artifacts(
+        include_corpus=major >= 17,
+        modules=modules,
+        kotlin_version=kotlin_version,
+    )
     common.cd_project_subdir("kotlin")
     if major >= 17:
         common.exec_cmd(
-            "mvn -T16 --batch-mode --no-transfer-progress test 
-DfailIfNoTests=false"
+            "mvn -T16 --batch-mode --no-transfer-progress test "
+            f"-DfailIfNoTests=false {version_option}"
         )
         common.exec_cmd("mvn -T16 --batch-mode --no-transfer-progress 
spotless:check")
         common.cd_project_subdir("integration_tests/kotlin_json_corpus")
         common.exec_cmd(
             "mvn -T16 --batch-mode --no-transfer-progress clean test "
-            "-DfailIfNoTests=false"
+            f"-DfailIfNoTests=false {version_option}"
         )
     else:
         logging.info(
@@ -189,14 +208,14 @@ def run_tests():
         )
         common.exec_cmd(
             "mvn -T16 --batch-mode --no-transfer-progress "
-            f"-pl {LOW_JDK_MODULES} -am test -DfailIfNoTests=false"
+            f"-pl {LOW_JDK_MODULES} -am test -DfailIfNoTests=false 
{version_option}"
         )
     if major == 25:
         common.cd_project_subdir("kotlin")
         common.exec_cmd(
             "mvn -T16 --batch-mode --no-transfer-progress "
             f"-pl {PRODUCTION_MODULES} -am package -DskipTests "
-            "-Dgpg.skip=true -Papache-release"
+            f"-Dgpg.skip=true -Papache-release {version_option}"
         )
         common.cd_project_subdir("")
         common.exec_cmd("python ci/release.py verify_kotlin_artifacts")
@@ -206,28 +225,34 @@ def run_tests():
     logging.info("Executing fory kotlin tests succeeds")
 
 
-def run_native_json():
+def run_native_json(kotlin_version=None):
     """Build and execute the dedicated Kotlin JSON Native Image fixture."""
     os.environ.setdefault("ENABLE_FORY_DEBUG_OUTPUT", "1")
+    version_option = kotlin_version_option(kotlin_version)
     install_java_json()
-    install_artifacts(include_corpus=True)
+    install_artifacts(include_corpus=True, kotlin_version=kotlin_version)
     common.cd_project_subdir("integration_tests/graalvm_kotlin_tests")
     common.exec_cmd(
-        "mvn --batch-mode --no-transfer-progress -DskipTests=true -Pnative 
clean package"
+        "mvn --batch-mode --no-transfer-progress -DskipTests=true -Pnative 
clean package "
+        f"{version_option}"
     )
     common.exec_cmd("./target/main")
 
 
-def run(task="tests"):
+def run(task="tests", kotlin_version=None):
     """Run the selected Kotlin CI task."""
     if task == "tests":
-        run_tests()
+        run_tests(kotlin_version)
     elif task == "install-json":
         install_java_json()
-        install_artifacts(include_corpus=True, modules=JSON_MODULES)
+        install_artifacts(
+            include_corpus=True,
+            modules=JSON_MODULES,
+            kotlin_version=kotlin_version,
+        )
     elif task == "install-kotlin":
-        install_artifacts(include_corpus=True)
+        install_artifacts(include_corpus=True, kotlin_version=kotlin_version)
     elif task == "native-json":
-        run_native_json()
+        run_native_json(kotlin_version)
     else:
         raise ValueError(f"Unsupported Kotlin CI task: {task}")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to