feat(java): support xlang serialization for GraalVM native image #6976
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: Fory CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "releases/**" | |
| - "deploy/**" | |
| - "test*" | |
| tags: | |
| - v* | |
| pull_request: | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - "LICENSE" | |
| - ".vscode/**" | |
| - ".gitignore" | |
| - "licenses/**" | |
| - "DISCLAIMER" | |
| - "NOTICE" | |
| types: ["opened", "reopened", "synchronize"] | |
| jobs: | |
| java: | |
| name: Java CI | |
| runs-on: ubuntu-latest | |
| env: | |
| MY_VAR: "PATH" | |
| strategy: | |
| matrix: | |
| java-version: ["8", "11", "17", "21", "25"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| cache: 'pip' | |
| - name: Run CI with Maven | |
| run: python ./ci/run_ci.py java --version ${{ matrix.java-version }} | |
| - name: Upload Test Report | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: surefire-reports-${{ matrix.java-version }} | |
| path: "**/target/surefire-reports/**" | |
| openj9: | |
| name: Openj9 Java CI | |
| runs-on: ubuntu-latest | |
| env: | |
| MY_VAR: "PATH" | |
| strategy: | |
| matrix: | |
| # String in openj9 1.8 share byte array by offset, fory doesn't allow it. | |
| java-version: ["21"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: "adopt-openj9" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| cache: 'pip' | |
| - name: Run CI with Maven | |
| run: python ./ci/run_ci.py java --version ${{ matrix.java-version }} | |
| java21_windows: | |
| name: Windows Java 21 CI | |
| runs-on: windows-2022 | |
| env: | |
| MY_VAR: "PATH" | |
| strategy: | |
| matrix: | |
| java-version: ["21"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Run CI with Maven | |
| shell: bash | |
| run: python ./ci/run_ci.py java --version windows_java21 | |
| graalvm: | |
| name: GraalVM CI | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java-version: ["17", "21", "25"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: "graalvm" | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| native-image-job-reports: "true" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Build native image and run | |
| shell: bash | |
| run: python ./ci/run_ci.py java --version graalvm | |
| kotlin: | |
| name: Kotlin CI | |
| runs-on: ubuntu-latest | |
| env: | |
| MY_VAR: "PATH" | |
| strategy: | |
| matrix: | |
| java-version: ["8", "11", "17", "21"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install fory java | |
| run: python ./ci/run_ci.py java --install-jdks --install-fory | |
| - name: Run Kotlin CI | |
| run: python ./ci/run_ci.py kotlin | |
| scala: | |
| name: Scala CI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: "temurin" | |
| cache: sbt | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - uses: sbt/setup-sbt@v1 | |
| - name: Install fory java | |
| run: cd java && mvn -T10 --no-transfer-progress clean install -DskipTests && cd - | |
| - name: Test | |
| run: | | |
| cd scala && sbt +test && cd - | |
| integration_tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Run CI | |
| run: python ./ci/run_ci.py java --version integration_tests | |
| javascript: | |
| name: JavaScript CI | |
| strategy: | |
| matrix: | |
| node-version: [18, 20, 24] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache-dependency-path: javascript/package-lock.json | |
| cache: "npm" | |
| - name: Upgrade npm | |
| run: npm install -g npm@8 | |
| # node-gyp needs to use python and relies on the distutils module. | |
| # The distutils module has been removed starting from python 3.12 | |
| # (see https://docs.python.org/3.10/library/distutils.html). Some | |
| # OS (such as macos-latest) uses python3.12 by default, so python 3.8 | |
| # is used here to avoid this problem. | |
| - name: Set up Python3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Run CI with NodeJS | |
| run: python ./ci/run_ci.py javascript | |
| rust: | |
| name: Rust CI | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-14, macos-latest] # macos-14: arm64 | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Set up Java 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: temurin | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Run Rust CI | |
| run: python ./ci/run_ci.py rust | |
| rust_xlang: | |
| name: Rust Xlang Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Run Rust Xlang Test | |
| env: | |
| FORY_RUST_JAVA_CI: "1" | |
| run: | | |
| cd java | |
| mvn -T16 --no-transfer-progress clean install -DskipTests | |
| cd fory-core | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.xlang.RustXlangTest | |
| cpp: | |
| name: C++ CI | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-2022] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| cache: 'pip' | |
| - name: Cache Bazel binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/bin/bazel | |
| ~/.local/bin/bazel | |
| C:\bazel\bazel.exe | |
| key: bazel-binary-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Cache Bazel repository cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/bazel/_bazel_*/*/external | |
| ~/Library/Caches/bazel/_bazel_*/*/external | |
| C:\users\runneradmin\_bazel_runneradmin\*/external | |
| key: bazel-repo-${{ runner.os }}-${{ runner.arch }}-py311-${{ hashFiles('WORKSPACE', '.bazelrc', 'bazel/**') }} | |
| restore-keys: | | |
| bazel-repo-${{ runner.os }}-${{ runner.arch }}-py311- | |
| - name: Cache Bazel build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/bazel | |
| ~/Library/Caches/bazel | |
| C:\users\runneradmin\_bazel_runneradmin | |
| key: bazel-build-cpp-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('cpp/**', 'BUILD', 'WORKSPACE') }} | |
| - name: Run C++ CI with Bazel | |
| run: python ./ci/run_ci.py cpp | |
| cpp_xlang: | |
| name: C++ Xlang Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| cache: 'pip' | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Cache Bazel binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/bin/bazel | |
| ~/.local/bin/bazel | |
| key: bazel-binary-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Install bazel | |
| run: python ./ci/run_ci.py cpp --install-deps-only | |
| - name: Run CPP Xlang Test | |
| env: | |
| FORY_CPP_JAVA_CI: "1" | |
| run: | | |
| cd java | |
| mvn -T16 --no-transfer-progress clean install -DskipTests | |
| cd fory-core | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.xlang.CPPXlangTest | |
| cpp_examples: | |
| name: C++ Examples | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache Bazel binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/bin/bazel | |
| ~/.local/bin/bazel | |
| key: bazel-binary-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Install bazel | |
| run: python ./ci/run_ci.py cpp --install-deps-only | |
| - name: Build and run C++ hello_world example (CMake) | |
| run: | | |
| cd examples/cpp/hello_world | |
| ./run.sh | |
| - name: Build and run C++ hello_row example (CMake) | |
| run: | | |
| cd examples/cpp/hello_row | |
| ./run.sh | |
| - name: Build and run C++ hello_world example (Bazel) | |
| run: | | |
| cd examples/cpp/hello_world | |
| ./run_bazel.sh | |
| - name: Build and run C++ hello_row example (Bazel) | |
| run: | | |
| cd examples/cpp/hello_row | |
| ./run_bazel.sh | |
| python: | |
| name: Python CI | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| python-version: [3.8, 3.12, 3.13.3] | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-2022] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Cache Bazel binary (Unix) | |
| if: runner.os != 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/bin/bazel | |
| ~/.local/bin/bazel | |
| key: bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}- | |
| enableCrossOsArchive: false | |
| - name: Cache Bazel binary (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\bazel\bazel.exe | |
| key: bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Install bazel (Unix) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: python ./ci/run_ci.py cpp --install-deps-only | |
| - name: Install bazel (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: ./ci/run_ci.sh install_bazel_windows | |
| - name: Clean Bazel cache (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| echo "Cleaning Bazel cache to ensure fresh build..." | |
| bazel clean --expunge || true | |
| - name: Run Python CI | |
| shell: bash | |
| run: python ./ci/run_ci.py python | |
| python_xlang: | |
| name: Python Xlang Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| cache: 'pip' | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Install pyfory | |
| run: bash ci/run_ci.sh install_pyfory | |
| - name: Run Python Xlang Test | |
| env: | |
| FORY_PYTHON_JAVA_CI: "1" | |
| run: | | |
| cd java | |
| mvn -T16 --no-transfer-progress clean install -DskipTests | |
| cd fory-core | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.xlang.PythonXlangTest | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.xlang.PyCrossLanguageTest | |
| cd ../fory-format | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.format.CrossLanguageTest | |
| go: | |
| name: Golang CI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Go 1.23 | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.23" | |
| - name: Display Go version | |
| run: go version | |
| - name: Set up Python3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| cache: 'pip' | |
| - name: Cache Bazel binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/bin/bazel | |
| ~/.local/bin/bazel | |
| key: bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }} | |
| restore-keys: | | |
| bazel-binary-v2-${{ runner.os }}-${{ runner.arch }}- | |
| enableCrossOsArchive: false | |
| - name: Install bazel | |
| run: python ./ci/run_ci.py cpp --install-deps-only | |
| - name: Install python dependencies | |
| run: pip install pyarrow cython wheel pytest setuptools -U | |
| - name: Install pyfory for xlang tests | |
| run: pip install -e python/ | |
| - name: Run Golang CI | |
| run: python ./ci/run_ci.py go | |
| go_xlang: | |
| name: Go Xlang Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| - name: Cache Maven local repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Run Go Xlang Test | |
| env: | |
| FORY_GO_JAVA_CI: "1" | |
| run: | | |
| cd java | |
| mvn -T16 --no-transfer-progress clean install -DskipTests | |
| cd fory-core | |
| mvn -T16 --no-transfer-progress test -Dtest=org.apache.fory.xlang.GoXlangTest | |
| lint: | |
| name: Code Style Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "oracle" | |
| - name: Check License Header | |
| uses: korandoru/hawkeye@v3 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - name: Check code style | |
| run: python ./ci/run_ci.py format |