diff --git a/.github/workflows/integration-test-multinode.yml b/.github/workflows/integration-test-multinode.yml deleted file mode 100644 index fadfc2168d2..00000000000 --- a/.github/workflows/integration-test-multinode.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Integration Test Multinode (Full) - -on: - push: - branches: [ 'master', 'release_**' ] - pull_request: - branches: [ 'develop', 'release_**' ] - types: [ opened, synchronize, reopened ] - paths-ignore: [ '**/*.md', '.gitignore', '**/.gitignore', '.editorconfig', - '.gitattributes', 'docs/**', 'CHANGELOG', '.github/ISSUE_TEMPLATE/**', - '.github/PULL_REQUEST_TEMPLATE/**', '.github/CODEOWNERS' ] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - multinode-full: - name: Integration Test Multinode Full (JDK 8 / x86_64) - runs-on: ubuntu-latest - timeout-minutes: 60 - - steps: - - name: Checkout java-tron - uses: actions/checkout@v5 - - - name: Set up JDK 8 - uses: actions/setup-java@v5 - with: - java-version: '8' - distribution: 'temurin' - - - name: Cache Gradle packages - uses: actions/cache@v5 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-multinode-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle-multinode- - - - name: Build FullNode.jar - run: ./gradlew clean build -x test --no-daemon - - - name: Build local java-tron Docker image (wraps PR-built FullNode.jar) - run: | - mkdir -p /tmp/tron-image - cp build/libs/FullNode.jar /tmp/tron-image/ - cat > /tmp/tron-image/Dockerfile <<'EOF' - FROM tronprotocol/java-tron:latest - COPY FullNode.jar /java-tron/lib/FullNode.jar - EOF - docker build -t java-tron-local:pr /tmp/tron-image - - - name: Pull integration-test image - run: docker pull troninfra/troninfra-ci:latest - - - name: Extract compose configs to host (for DinD path-alignment) - run: | - # start-multinode.sh builds HOST_COMPOSE_DIR as: - # ${HOST_WORKDIR}/docker/multi-node - # so the files must live at $HOST_WORKDIR/docker/multi-node/ on the - # host. Set HOST_WORKDIR to the workspace root and extract - # /app/docker/ 1:1 into workspace/docker/ — the subdirectories - # (multi-node/, single-node/) don't collide with java-tron's own - # docker/ files. - docker create --name it-extract troninfra/troninfra-ci:latest - docker cp it-extract:/app/docker/. "${{ github.workspace }}/docker/" - docker rm -f it-extract - - - name: Run multinode full tests - run: | - # --network host: multinode tests talk to nodes via 127.0.0.1:50051 etc. - # DinD socket + HOST_WORKDIR path-alignment lets the container orchestrate - # the 3-witness compose stack via the host daemon. - # Don't override --workdir so the container's default /app entrypoint works. - docker run --name integration-multinode \ - --network host \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v "${{ github.workspace }}:${{ github.workspace }}" \ - -v "${{ github.workspace }}/docker/multi-node:/app/docker/multi-node" \ - -e HOST_WORKDIR="${{ github.workspace }}" \ - -e TRON_IMAGE=java-tron-local:pr \ - -e JAVA_HOME=/usr/lib/jvm/temurin-8 \ - -e JAVA_HOME_17=/opt/java/openjdk \ - troninfra/troninfra-ci:latest \ - --multinode --clean - - - name: Extract test reports from container - if: always() - run: | - mkdir -p integration-reports - docker cp integration-multinode:/app/build/reports/. integration-reports/reports/ 2>/dev/null || true - docker cp integration-multinode:/app/build/test-results/. integration-reports/test-results/ 2>/dev/null || true - docker cp integration-multinode:/app/build/test-output.log integration-reports/ 2>/dev/null || true - - - name: Collect witness node logs - if: always() - run: | - mkdir -p integration-reports/node-logs - for c in tron-mn-node1 tron-mn-node2 tron-mn-node3 tron-mn-mongodb; do - docker logs "$c" > "integration-reports/node-logs/${c}.log" 2>&1 || true - done - - - name: Tear down compose stack - if: always() - run: | - docker rm -f tron-mn-node1 tron-mn-node2 tron-mn-node3 tron-mn-mongodb 2>/dev/null || true - docker network rm multi-node_tron-net 2>/dev/null || true - docker rm -f integration-multinode 2>/dev/null || true - - - name: Upload test reports - if: always() - uses: actions/upload-artifact@v6 - with: - name: integration-multinode-report - path: integration-reports/ - if-no-files-found: warn diff --git a/.github/workflows/integration-test-single-node.yml b/.github/workflows/integration-test-single-node.yml index b0c10247a7f..3c56843c799 100644 --- a/.github/workflows/integration-test-single-node.yml +++ b/.github/workflows/integration-test-single-node.yml @@ -1,4 +1,4 @@ -name: Integration Test Single Node (Full) +name: Integration Test Single Node (Smoke) on: push: @@ -17,7 +17,7 @@ concurrency: jobs: integration: - name: Integration Test Single Node Full (JDK 8 / x86_64) + name: Integration Test Single Node Smoke (JDK 8 / x86_64) runs-on: ubuntu-latest timeout-minutes: 45 @@ -46,7 +46,7 @@ jobs: - name: Pull integration-test image run: docker pull troninfra/troninfra-ci:latest - - name: Run integration tests + - name: Run integration smoke tests run: | # JAVA_HOME=JDK 8 so FullNode runs on the same JVM family as # production (a few assertions check `java.version` starts with @@ -58,9 +58,9 @@ jobs: -e JAVA_HOME_17=/opt/java/openjdk \ -v "${{ github.workspace }}/build/libs/FullNode.jar:/javatron/FullNode.jar:ro" \ troninfra/troninfra-ci:latest \ - --clean + --clean --smoke - - name: Extract test reports from container + - name: Extract smoke test reports from container if: always() run: | mkdir -p integration-reports @@ -71,10 +71,10 @@ jobs: docker cp integration-test:/app/node/data/logs/tron.log integration-reports/ 2>/dev/null || true docker rm -f integration-test 2>/dev/null || true - - name: Upload test reports + - name: Upload smoke test reports if: always() uses: actions/upload-artifact@v6 with: - name: integration-test-report + name: integration-smoke-test-report path: integration-reports/ if-no-files-found: warn diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 00000000000..8e53909a847 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,232 @@ +name: Release JAR Build + +on: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + validate-source: + name: Validate release source + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Require master branch + env: + GIT_REF: ${{ github.ref }} + run: | + if [ "$GIT_REF" != "refs/heads/master" ]; then + echo "Release JARs must be built from master; received $GIT_REF." >&2 + exit 1 + fi + + build-x64: + name: Build x64 JARs (Temurin 8) + needs: validate-source + runs-on: ubuntu-latest + timeout-minutes: 60 + + container: + image: eclipse-temurin:8-jdk + + env: + GRADLE_USER_HOME: /github/home/.gradle + + defaults: + run: + shell: bash + + steps: + - name: Install build dependencies + run: | + set -euxo pipefail + apt-get update + apt-get install -y git unzip build-essential + + - name: Checkout source commit + uses: actions/checkout@v5 + with: + ref: ${{ github.sha }} + + - name: Cache Gradle packages + uses: actions/cache@v5 + with: + path: | + /github/home/.gradle/caches + /github/home/.gradle/wrapper + key: release-x64-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} + restore-keys: release-x64-gradle- + + - name: Record build environment + run: | + set -euo pipefail + mkdir -p release-jars + { + echo "architecture=x64" + echo "commit_sha=$(git rev-parse HEAD)" + echo "git_ref=${GITHUB_REF}" + echo "workflow_run=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + echo "java_version:" + java -version 2>&1 + } > release-jars/build-metadata-x64.txt + + - name: Build release JARs + run: | + ./gradlew :framework:buildFullNodeJar \ + :plugins:buildToolkitJar \ + :plugins:buildArchiveManifestJar \ + --no-daemon \ + --no-build-cache + + - name: Smoke test release JARs + run: | + set -euo pipefail + java -jar framework/build/libs/FullNode.jar --version + java -jar plugins/build/libs/Toolkit.jar help + java -jar plugins/build/libs/ArchiveManifest.jar -h + + - name: Collect x64 JARs + run: | + set -euo pipefail + install -m 0644 framework/build/libs/FullNode.jar release-jars/FullNode-x64.jar + install -m 0644 plugins/build/libs/Toolkit.jar release-jars/Toolkit-x64.jar + install -m 0644 plugins/build/libs/ArchiveManifest.jar release-jars/ArchiveManifest-x64.jar + + - name: Upload x64 JARs + uses: actions/upload-artifact@v6 + with: + name: release-jars-x64 + path: release-jars/ + if-no-files-found: error + retention-days: 1 + overwrite: true + + build-aarch64: + name: Build aarch64 JARs (Temurin 17) + needs: validate-source + runs-on: ubuntu-24.04-arm + timeout-minutes: 60 + + steps: + - name: Checkout source commit + uses: actions/checkout@v5 + with: + ref: ${{ github.sha }} + + - name: Set up Temurin 17 + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: '17' + + - name: Cache Gradle packages + uses: actions/cache@v5 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: release-aarch64-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} + restore-keys: release-aarch64-gradle- + + - name: Record build environment + run: | + set -euo pipefail + mkdir -p release-jars + { + echo "architecture=aarch64" + echo "commit_sha=$(git rev-parse HEAD)" + echo "git_ref=${GITHUB_REF}" + echo "workflow_run=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + echo "java_version:" + java -version 2>&1 + } > release-jars/build-metadata-aarch64.txt + + - name: Build release JARs + run: | + ./gradlew :framework:buildFullNodeJar \ + :plugins:buildToolkitJar \ + :plugins:buildArchiveManifestJar \ + --no-daemon \ + --no-build-cache + + - name: Smoke test release JARs + run: | + set -euo pipefail + java -jar framework/build/libs/FullNode.jar --version + java -jar plugins/build/libs/Toolkit.jar help + java -jar plugins/build/libs/ArchiveManifest.jar -h + + - name: Collect aarch64 JARs + run: | + set -euo pipefail + install -m 0644 framework/build/libs/FullNode.jar release-jars/FullNode-aarch64.jar + install -m 0644 plugins/build/libs/Toolkit.jar release-jars/Toolkit-aarch64.jar + install -m 0644 plugins/build/libs/ArchiveManifest.jar release-jars/ArchiveManifest-aarch64.jar + + - name: Upload aarch64 JARs + uses: actions/upload-artifact@v6 + with: + name: release-jars-aarch64 + path: release-jars/ + if-no-files-found: error + retention-days: 1 + overwrite: true + + assemble: + name: Assemble release JAR artifact + needs: [build-x64, build-aarch64] + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Download x64 JARs + uses: actions/download-artifact@v8 + with: + name: release-jars-x64 + path: staging/x64 + + - name: Download aarch64 JARs + uses: actions/download-artifact@v8 + with: + name: release-jars-aarch64 + path: staging/aarch64 + + - name: Assemble and verify release artifact + run: | + set -euo pipefail + mkdir -p release-jars + cp staging/x64/*.jar release-jars/ + cp staging/aarch64/*.jar release-jars/ + cp staging/x64/build-metadata-x64.txt release-jars/ + cp staging/aarch64/build-metadata-aarch64.txt release-jars/ + + for name in FullNode Toolkit ArchiveManifest; do + cp "release-jars/${name}-x64.jar" "release-jars/${name}.jar" + cmp "release-jars/${name}.jar" "release-jars/${name}-x64.jar" + done + + jar_count=$(find release-jars -maxdepth 1 -type f -name '*.jar' | wc -l) + if [ "$jar_count" -ne 9 ]; then + echo "Expected 9 release JARs, found $jar_count." >&2 + exit 1 + fi + + ( + cd release-jars + sha256sum -- *.jar | sort -k2 > SHA256SUMS + ) + + - name: Upload release JAR artifact + uses: actions/upload-artifact@v6 + with: + name: release-jars-${{ github.sha }} + path: release-jars/ + if-no-files-found: error + retention-days: 30 + overwrite: true diff --git a/README.md b/README.md index be84b44150b..edf99c4df92 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,16 @@ TRON is building the foundational infrastructure for the decentralized internet Before building java-tron, make sure you have: - Hardware with at least 4 CPU cores, 16 GB RAM, 10 GB free disk space for a smooth compilation process. - Operating system: `Linux` or `macOS` (`Windows` is not supported). -- Git and correct JDK (version `8` or `17`) installed based on your CPU architecture. +- Git and the JDK matching your CPU architecture (see the table below). + +The JDK version required to build or run java-tron is currently tied to the CPU architecture; the two versions are not interchangeable: + +| CPU Architecture | Required JDK | +| :--------------- | :----------- | +| `x86_64` / `amd64` | JDK 8 | +| `ARM64` / `aarch64` | JDK 17 | + +> **Note**: `ARM64` / `aarch64` support is available starting with GreatVoyage-v4.8.1. There are two ways to install the required dependencies: @@ -49,8 +58,6 @@ There are two ways to install the required dependencies: chmod +x install_dependencies.sh ./install_dependencies.sh ``` - > **Note**: For production-grade stability with JDK 8 on x86_64 architecture, Oracle JDK 8 is strongly recommended (the script installs OpenJDK 8). - - **Option 2: Manual installation** Follow the [Prerequisites and Installation Guide](https://tronprotocol.github.io/documentation-en/using_javatron/installing_javatron/#prerequisites-before-compiling-java-tron) for step-by-step instructions. diff --git a/docs/modular-deployment-en.md b/docs/modular-deployment-en.md index c93ba6c39d8..b351ecc7797 100644 --- a/docs/modular-deployment-en.md +++ b/docs/modular-deployment-en.md @@ -4,6 +4,17 @@ After modularization, the recommended way to launch java-tron is via the shell s > **Supported platforms**: Linux and macOS. Windows is not supported. +## Prerequisites + +The JDK version required to build and run java-tron is currently tied to the CPU architecture; the two versions are not interchangeable: + +| CPU Architecture | Required JDK | +| :--------------- | :----------- | +| `x86_64` / `amd64` | JDK 8 | +| `ARM64` / `aarch64` | JDK 17 | + +> **Note**: `ARM64` / `aarch64` support is available starting with GreatVoyage-v4.8.1. + ## Download ``` @@ -45,11 +56,9 @@ java-tron-1.0.0/bin/FullNode -c config.conf -w JVM options can also be specified, located in `bin/java-tron.vmoptions`: ``` -# demo (compatible with JDK 8 / JDK 17) +# Heap-size customization example -Xms2g -Xmx9g --XX:+PrintGCDetails --Xloggc:./gc.log --XX:+PrintGCDateStamps --XX:ReservedCodeCacheSize=256m -``` \ No newline at end of file +``` + +The generated `java-tron.vmoptions` file already contains GC options appropriate for the build architecture and its required JDK. Keep those architecture-specific options when changing the heap size; do not copy GC options between JDK 8 and JDK 17 deployments. diff --git a/docs/modular-deployment-zh.md b/docs/modular-deployment-zh.md index 27cc2ab3856..c73670f23a4 100644 --- a/docs/modular-deployment-zh.md +++ b/docs/modular-deployment-zh.md @@ -4,6 +4,17 @@ > **支持平台**:Linux 和 macOS。不支持 Windows。 +## 环境要求 + +当前,构建和运行 java-tron 所需的 JDK 版本与 CPU 架构绑定,两个版本不能互换: + +| CPU 架构 | 所需 JDK | +| :------- | :------- | +| `x86_64` / `amd64` | JDK 8 | +| `ARM64` / `aarch64` | JDK 17 | + +> **注意**:从 GreatVoyage-v4.8.1 开始支持 `ARM64` / `aarch64` 架构。 + ## 下载 ``` @@ -43,11 +54,9 @@ java-tron-1.0.0/bin/FullNode -c config.conf -w java-tron 支持对 jvm 参数进行配置,配置文件为 bin 目录下的 java-tron.vmoptions 文件。 ``` -# demo(兼容 JDK 8 / JDK 17) +# 堆大小自定义示例 -Xms2g -Xmx9g --XX:+PrintGCDetails --Xloggc:./gc.log --XX:+PrintGCDateStamps --XX:ReservedCodeCacheSize=256m -``` \ No newline at end of file +``` + +生成的 `java-tron.vmoptions` 文件已包含与构建架构及其所需 JDK 匹配的 GC 参数。调整堆大小时请保留这些架构专用参数,不要在 JDK 8 和 JDK 17 部署之间复制 GC 参数。