From 2be86853e234fdde23311ff597a45814eb4f4338 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 11:51:37 +0800 Subject: [PATCH 01/11] init workflow --- .github/workflows/codeql.yml | 28 +-- .github/workflows/pr-check.yml | 173 +++++++++++++----- .github/workflows/system-test.yml | 71 +++++++ build.gradle | 26 ++- codecov.yml | 1 + framework/build.gradle | 2 +- .../java/org/tron/core/config/args/Args.java | 2 +- gradle.properties | 2 + gradle/verification-metadata.xml | 26 +++ plugins/build.gradle | 1 - 10 files changed, 255 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/system-test.yml create mode 100644 codecov.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5a0f120e116..95f78c50a6c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,36 +29,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + build-mode: none - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index f4593f64d48..d4fd3f3b7ed 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -93,53 +93,17 @@ jobs: core.info('PR lint passed.'); } - build: - name: Build (JDK ${{ matrix.java }} / ${{ matrix.arch }}) - needs: pr-lint - runs-on: ${{ matrix.runner }} - strategy: - fail-fast: false - matrix: - include: - - java: '8' - runner: ubuntu-latest - arch: x86_64 - - java: '17' - runner: ubuntu-24.04-arm - arch: aarch64 - - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - - - name: Cache Gradle packages - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle- - - - name: Build - run: ./gradlew clean build -x test - checkstyle: name: Checkstyle - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 - - name: Set up JDK 8 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '8' + java-version: '17' distribution: 'temurin' - name: Cache Gradle packages @@ -163,20 +127,29 @@ jobs: framework/build/reports/checkstyle/ plugins/build/reports/checkstyle/ - test: - name: Unit Tests (JDK ${{ matrix.java }} / ${{ matrix.arch }}) + build: + name: Build ${{ matrix.os-name }}(JDK ${{ matrix.java }} / ${{ matrix.arch }}) + needs: [pr-lint, checkstyle] runs-on: ${{ matrix.runner }} - needs: build - timeout-minutes: 60 strategy: fail-fast: false matrix: include: - java: '8' runner: ubuntu-latest + os-name: ubuntu arch: x86_64 - java: '17' runner: ubuntu-24.04-arm + os-name: ubuntu + arch: aarch64 + - java: '8' + runner: macos-26-intel + os-name: macos + arch: x86_64 + - java: '17' + runner: macos-latest + os-name: macos arch: aarch64 steps: @@ -197,13 +170,115 @@ jobs: key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle- - - name: Run tests - run: ./gradlew test + - name: Build + run: ./gradlew clean build --no-daemon - - name: Upload test reports - if: failure() + docker-build-rockylinux: + name: Build rockylinux (JDK 8 / x86_64) + needs: [pr-lint, checkstyle] + runs-on: ubuntu-latest + + container: + image: rockylinux:8 + + env: + GRADLE_USER_HOME: /github/home/.gradle + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies (Rocky 8 + JDK8) + run: | + set -euxo pipefail + dnf -y install java-1.8.0-openjdk-devel git wget unzip which jq bc curl glibc-langpack-en + dnf -y groupinstall "Development Tools" + + - name: Check Java version + run: java -version + + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + /github/home/.gradle/caches + /github/home/.gradle/wrapper + key: ${{ runner.os }}-rockylinux-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-rockylinux-gradle- + + - name: Prepare checkstyle config copy + run: | + set -euxo pipefail + cp -f config/checkstyle/checkStyle.xml config/checkstyle/checkStyleAll.xml || true + + - name: Grant execute permission + run: chmod +x gradlew + + - name: Stop Gradle daemon + run: ./gradlew --stop || true + + - name: Build + run: ./gradlew clean build --no-daemon --no-build-cache + #run: | + # ./gradlew clean build -x test --no-daemon --no-build-cache + # ./gradlew framework:test --tests org.tron.core.zksnark.ShieldedReceiveTest + + - name: Generate JaCoCo report + run: ./gradlew jacocoTestReport --no-daemon --no-build-cache + + - name: Upload JaCoCo artifacts uses: actions/upload-artifact@v4 with: - name: test-reports-${{ matrix.arch }} + name: jacoco-rockylinux + path: | + **/build/reports/jacoco/test/jacocoTestReport.xml + **/build/reports/** + **/build/test-results/** + if-no-files-found: error + + docker-build-debian11: + name: Build debian11 (JDK 8 / x86_64) + needs: [pr-lint, checkstyle] + runs-on: ubuntu-latest + + container: + image: eclipse-temurin:8-jdk # base image is Debian 11 (Bullseye) + + defaults: + run: + shell: bash + + env: + GRADLE_USER_HOME: /github/home/.gradle + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies (Debian + build tools) + run: | + set -euxo pipefail + apt-get update + apt-get install -y git wget unzip build-essential curl jq + + - name: Check Java version + run: java -version + + - name: Cache Gradle + uses: actions/cache@v4 + with: path: | - **/build/reports/tests/ + /github/home/.gradle/caches + /github/home/.gradle/wrapper + key: ${{ runner.os }}-debian11-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-debian11-gradle- + + - name: Grant execute permission + run: chmod +x gradlew + + - name: Build + run: ./gradlew clean build --no-daemon --no-build-cache diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml new file mode 100644 index 00000000000..36bef7a460a --- /dev/null +++ b/.github/workflows/system-test.yml @@ -0,0 +1,71 @@ +name: System Test + +on: + pull_request: + branches: [ 'develop', 'release_**' ] + types: [ opened, edited, synchronize, reopened ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + system-test: + name: System Test (JDK 8 / x86_64) + runs-on: ubuntu-latest + + steps: + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + + - name: Clone system-test + run: | + git clone https://github.com/tronprotocol/system-test.git + cd system-test + git checkout release_workflow + + - name: Checkout java-tron + uses: actions/checkout@v4 + with: + path: java-tron + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-system-test-${{ hashFiles('java-tron/**/*.gradle', 'java-tron/**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-gradle-system-test- + + - name: Build java-tron + working-directory: java-tron + run: ./gradlew clean build -x test --no-daemon + + - name: Copy config and start FullNode + run: | + cp system-test/testcase/src/test/resources/config-system-test.conf java-tron/ + cd java-tron + nohup java -jar build/libs/FullNode.jar --witness -c config-system-test.conf > fullnode.log 2>&1 & + echo "FullNode started, waiting 30 seconds..." + sleep 30 + echo "=== FullNode log (last 30 lines) ===" + tail -30 fullnode.log || true + + - name: Run system tests + working-directory: system-test + run: | + cp solcDIR/solc-linux-0.8.6 solcDIR/solc + ./gradlew clean --no-daemon + ./gradlew --info stest --no-daemon + + - name: Upload FullNode log + if: always() + uses: actions/upload-artifact@v4 + with: + name: fullnode-log + path: java-tron/fullnode.log + if-no-files-found: warn diff --git a/build.gradle b/build.gradle index 12a0622db99..6f00196994d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ import org.gradle.nativeplatform.platform.internal.Architectures import org.gradle.internal.os.OperatingSystem + allprojects { version = "1.0.0" apply plugin: "java-library" @@ -40,7 +41,7 @@ ext.archInfo = [ VMOptions: isArm64 ? "${rootDir}/gradle/jdk17/java-tron.vmoptions" : "${rootDir}/gradle/java-tron.vmoptions" ] -if (!archInfo.java.is(archInfo.requires.JavaVersion)) { +if (!archInfo.java.is(archInfo.requires.JavaVersion) && !project.hasProperty('skipJdkCheck')) { throw new GradleException("Java ${archInfo.requires.JavaVersion} is required for ${archInfo.name}. Detected version ${archInfo.java}") } @@ -165,3 +166,26 @@ gradle.buildFinished { } } } + +// SonarQube configuration — only activates when the plugin is applied (via CI init script) +pluginManager.withPlugin('org.sonarqube') { + sonar { + properties { + property "sonar.sourceEncoding", "UTF-8" + } + } + + // Skip these projects + ["protocol", "platform", "example:actuator-example"].each { name -> + project(":${name}").sonar.skipProject = true + } + + // Only analyze main sources, exclude test sources + subprojects { + sonar { + properties { + property "sonar.tests", "" + } + } + } +} diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..69cb76019a4 --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: false diff --git a/framework/build.gradle b/framework/build.gradle index 59d070e066d..42e905fda67 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -1,6 +1,6 @@ plugins { id "org.gradle.test-retry" version "1.5.9" - id "org.sonarqube" version "2.6" + id "com.gorylenko.gradle-git-properties" version "2.4.1" } diff --git a/framework/src/main/java/org/tron/core/config/args/Args.java b/framework/src/main/java/org/tron/core/config/args/Args.java index 38f1fe4f959..b99b7f54b76 100644 --- a/framework/src/main/java/org/tron/core/config/args/Args.java +++ b/framework/src/main/java/org/tron/core/config/args/Args.java @@ -344,7 +344,7 @@ private static String getCommitIdAbbrev() { InputStream in = Thread.currentThread() .getContextClassLoader().getResourceAsStream("git.properties"); properties.load(in); - } catch (IOException e) { + } catch (Exception e) { logger.warn("Load resource failed,git.properties {}", e.getMessage()); } return properties.getProperty("git.commit.id.abbrev"); diff --git a/gradle.properties b/gradle.properties index 031a8cddc89..09532810ad4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,4 @@ org.gradle.parallel=true org.gradle.jvmargs=-Xms1g +org.gradle.caching=true +org.gradle.daemon=false \ No newline at end of file diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 4d0bf1013d6..3dd82f7e74d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -2262,6 +2262,19 @@ + + + + + + + + + + + + + @@ -2270,6 +2283,11 @@ + + + + + @@ -2283,6 +2301,14 @@ + + + + + + + + diff --git a/plugins/build.gradle b/plugins/build.gradle index e03e9a7c49a..6f18f2b9d41 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -1,5 +1,4 @@ plugins { - id "org.sonarqube" version "2.6" } apply plugin: 'application' From e560afe5794ecd30a9a756fe10269ac3c9edb958 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 12:58:43 +0800 Subject: [PATCH 02/11] init workflow --- .github/workflows/pr-check.yml | 2 +- .github/workflows/system-test.yml | 2 +- build.gradle | 26 +------------------------- codecov.yml | 1 - framework/build.gradle | 2 +- gradle/verification-metadata.xml | 26 -------------------------- plugins/build.gradle | 1 + 7 files changed, 5 insertions(+), 55 deletions(-) delete mode 100644 codecov.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index d4fd3f3b7ed..05312933cd5 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -3,7 +3,7 @@ name: PR Check on: pull_request: branches: [ 'develop', 'release_**' ] - types: [ opened, edited, synchronize, reopened ] + types: [ opened, synchronize, reopened ] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml index 36bef7a460a..d83c42f82cd 100644 --- a/.github/workflows/system-test.yml +++ b/.github/workflows/system-test.yml @@ -3,7 +3,7 @@ name: System Test on: pull_request: branches: [ 'develop', 'release_**' ] - types: [ opened, edited, synchronize, reopened ] + types: [ opened, synchronize, reopened ] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} diff --git a/build.gradle b/build.gradle index 6f00196994d..12a0622db99 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ import org.gradle.nativeplatform.platform.internal.Architectures import org.gradle.internal.os.OperatingSystem - allprojects { version = "1.0.0" apply plugin: "java-library" @@ -41,7 +40,7 @@ ext.archInfo = [ VMOptions: isArm64 ? "${rootDir}/gradle/jdk17/java-tron.vmoptions" : "${rootDir}/gradle/java-tron.vmoptions" ] -if (!archInfo.java.is(archInfo.requires.JavaVersion) && !project.hasProperty('skipJdkCheck')) { +if (!archInfo.java.is(archInfo.requires.JavaVersion)) { throw new GradleException("Java ${archInfo.requires.JavaVersion} is required for ${archInfo.name}. Detected version ${archInfo.java}") } @@ -166,26 +165,3 @@ gradle.buildFinished { } } } - -// SonarQube configuration — only activates when the plugin is applied (via CI init script) -pluginManager.withPlugin('org.sonarqube') { - sonar { - properties { - property "sonar.sourceEncoding", "UTF-8" - } - } - - // Skip these projects - ["protocol", "platform", "example:actuator-example"].each { name -> - project(":${name}").sonar.skipProject = true - } - - // Only analyze main sources, exclude test sources - subprojects { - sonar { - properties { - property "sonar.tests", "" - } - } - } -} diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 69cb76019a4..00000000000 --- a/codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: false diff --git a/framework/build.gradle b/framework/build.gradle index 42e905fda67..59d070e066d 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -1,6 +1,6 @@ plugins { id "org.gradle.test-retry" version "1.5.9" - + id "org.sonarqube" version "2.6" id "com.gorylenko.gradle-git-properties" version "2.4.1" } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 3dd82f7e74d..4d0bf1013d6 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -2262,19 +2262,6 @@ - - - - - - - - - - - - - @@ -2283,11 +2270,6 @@ - - - - - @@ -2301,14 +2283,6 @@ - - - - - - - - diff --git a/plugins/build.gradle b/plugins/build.gradle index 6f18f2b9d41..e03e9a7c49a 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -1,4 +1,5 @@ plugins { + id "org.sonarqube" version "2.6" } apply plugin: 'application' From 7eacfea1e91c51bc7aacb877ad5e52ff01e248bd Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 16:11:43 +0800 Subject: [PATCH 03/11] add timeout for system-test; add master for push; trigger PR lint if event is edited --- .github/workflows/pr-check.yml | 7 ++++++- .github/workflows/system-test.yml | 24 ++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 05312933cd5..4e993b5ec6c 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,9 +1,11 @@ name: PR Check on: + push: + branches: [ 'master', 'release_**' ] pull_request: branches: [ 'develop', 'release_**' ] - types: [ opened, synchronize, reopened ] + types: [ opened, edited, synchronize, reopened ] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} @@ -129,6 +131,7 @@ jobs: build: name: Build ${{ matrix.os-name }}(JDK ${{ matrix.java }} / ${{ matrix.arch }}) + if: github.event.action != 'edited' needs: [pr-lint, checkstyle] runs-on: ${{ matrix.runner }} strategy: @@ -175,6 +178,7 @@ jobs: docker-build-rockylinux: name: Build rockylinux (JDK 8 / x86_64) + if: github.event.action != 'edited' needs: [pr-lint, checkstyle] runs-on: ubuntu-latest @@ -241,6 +245,7 @@ jobs: docker-build-debian11: name: Build debian11 (JDK 8 / x86_64) + if: github.event.action != 'edited' needs: [pr-lint, checkstyle] runs-on: ubuntu-latest diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml index d83c42f82cd..25ab65e4495 100644 --- a/.github/workflows/system-test.yml +++ b/.github/workflows/system-test.yml @@ -1,6 +1,8 @@ name: System Test on: + push: + branches: [ 'master', 'release_**' ] pull_request: branches: [ 'develop', 'release_**' ] types: [ opened, synchronize, reopened ] @@ -13,6 +15,7 @@ jobs: system-test: name: System Test (JDK 8 / x86_64) runs-on: ubuntu-latest + timeout-minutes: 60 steps: - name: Set up JDK 8 @@ -50,10 +53,23 @@ jobs: cp system-test/testcase/src/test/resources/config-system-test.conf java-tron/ cd java-tron nohup java -jar build/libs/FullNode.jar --witness -c config-system-test.conf > fullnode.log 2>&1 & - echo "FullNode started, waiting 30 seconds..." - sleep 30 - echo "=== FullNode log (last 30 lines) ===" - tail -30 fullnode.log || true + echo "FullNode started, waiting for it to be ready..." + + MAX_ATTEMPTS=60 + INTERVAL=5 + for i in $(seq 1 $MAX_ATTEMPTS); do + if curl -s --fail "http://localhost:9090/wallet/getblockbynum?num=1" > /dev/null 2>&1; then + echo "FullNode is ready! (attempt $i)" + exit 0 + fi + echo "Waiting... (attempt $i/$MAX_ATTEMPTS)" + sleep $INTERVAL + done + + echo "FullNode failed to start within $((MAX_ATTEMPTS * INTERVAL)) seconds." + echo "=== FullNode log (last 50 lines) ===" + tail -50 fullnode.log || true + exit 1 - name: Run system tests working-directory: system-test From c5ec11c5d774a21c46cde764e422c89ec9900533 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 16:21:37 +0800 Subject: [PATCH 04/11] add maxWarnings = 0 for checkstyle job --- .github/workflows/system-test.yml | 2 +- framework/build.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml index 25ab65e4495..4da1a9cdfeb 100644 --- a/.github/workflows/system-test.yml +++ b/.github/workflows/system-test.yml @@ -58,7 +58,7 @@ jobs: MAX_ATTEMPTS=60 INTERVAL=5 for i in $(seq 1 $MAX_ATTEMPTS); do - if curl -s --fail "http://localhost:9090/wallet/getblockbynum?num=1" > /dev/null 2>&1; then + if curl -s --fail "http://localhost:8090/wallet/getblockbynum?num=1" > /dev/null 2>&1; then echo "FullNode is ready! (attempt $i)" exit 0 fi diff --git a/framework/build.gradle b/framework/build.gradle index 59d070e066d..16a0d481f5e 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -69,6 +69,7 @@ check.dependsOn 'lint' checkstyle { toolVersion = "${versions.checkstyle}" configFile = file("config/checkstyle/checkStyleAll.xml") + maxWarnings = 0 } From 1b2d1d8d34b77fb4e0bd7b1d537754ea3997b250 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 16:30:22 +0800 Subject: [PATCH 05/11] restore Autobuild for codeql; add maxWarnings for plugin gradle --- .github/workflows/codeql.yml | 4 +++- plugins/build.gradle | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 95f78c50a6c..2fc16f3155b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -36,7 +36,9 @@ jobs: uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} - build-mode: none + + - name: Autobuild + uses: github/codeql-action/autobuild@v4 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 diff --git a/plugins/build.gradle b/plugins/build.gradle index e03e9a7c49a..85dcdd2342d 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -58,6 +58,7 @@ check.dependsOn 'lint' checkstyle { toolVersion = "${versions.checkstyle}" configFile = file("../framework/config/checkstyle/checkStyleAll.xml") + maxWarnings = 0 } checkstyleMain { From 63c17a4c3aaaa4be80251a75af22ed892a9d30ae Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 17:14:44 +0800 Subject: [PATCH 06/11] remove checkstyle copy --- .github/workflows/pr-check.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 4e993b5ec6c..030a2d7306d 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -213,11 +213,6 @@ jobs: restore-keys: | ${{ runner.os }}-rockylinux-gradle- - - name: Prepare checkstyle config copy - run: | - set -euxo pipefail - cp -f config/checkstyle/checkStyle.xml config/checkstyle/checkStyleAll.xml || true - - name: Grant execute permission run: chmod +x gradlew From 800d827d8db0865a804352cff7252c0963682d35 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 17:26:10 +0800 Subject: [PATCH 07/11] fix the image runner macos-26 --- .github/workflows/pr-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 030a2d7306d..0e1d7d11d2e 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -151,7 +151,7 @@ jobs: os-name: macos arch: x86_64 - java: '17' - runner: macos-latest + runner: macos-26 os-name: macos arch: aarch64 From fb43e54219f9ee1ac0bf1acd8ae2224b60b61c0b Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 10 Mar 2026 18:46:26 +0800 Subject: [PATCH 08/11] remove test code --- .github/workflows/pr-check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 0e1d7d11d2e..92e3cd9126f 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -221,9 +221,6 @@ jobs: - name: Build run: ./gradlew clean build --no-daemon --no-build-cache - #run: | - # ./gradlew clean build -x test --no-daemon --no-build-cache - # ./gradlew framework:test --tests org.tron.core.zksnark.ShieldedReceiveTest - name: Generate JaCoCo report run: ./gradlew jacocoTestReport --no-daemon --no-build-cache From ccca67c3dc066c9c370bed18b195ebeaa1063df5 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Wed, 11 Mar 2026 10:18:26 +0800 Subject: [PATCH 09/11] skip pr-lint when push; When the PR lint job succeeds or is skipped, the jobs depending on it can still run. --- .github/workflows/pr-check.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 92e3cd9126f..8a253c0a8e3 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -14,6 +14,7 @@ concurrency: jobs: pr-lint: name: PR Lint + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: @@ -131,7 +132,7 @@ jobs: build: name: Build ${{ matrix.os-name }}(JDK ${{ matrix.java }} / ${{ matrix.arch }}) - if: github.event.action != 'edited' + if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ${{ matrix.runner }} strategy: @@ -178,7 +179,7 @@ jobs: docker-build-rockylinux: name: Build rockylinux (JDK 8 / x86_64) - if: github.event.action != 'edited' + if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ubuntu-latest @@ -237,7 +238,7 @@ jobs: docker-build-debian11: name: Build debian11 (JDK 8 / x86_64) - if: github.event.action != 'edited' + if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ubuntu-latest From e426142c056c52ff48776f6ddc7a884258d20eb9 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Wed, 11 Mar 2026 14:49:15 +0800 Subject: [PATCH 10/11] optimize checkout --- .github/workflows/pr-check.yml | 3 +++ .github/workflows/system-test.yml | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 8a253c0a8e3..82fa4bcd358 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -135,6 +135,7 @@ jobs: if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ${{ matrix.runner }} + timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -182,6 +183,7 @@ jobs: if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ubuntu-latest + timeout-minutes: 60 container: image: rockylinux:8 @@ -241,6 +243,7 @@ jobs: if: github.event.action != 'edited' && !failure() needs: [pr-lint, checkstyle] runs-on: ubuntu-latest + timeout-minutes: 60 container: image: eclipse-temurin:8-jdk # base image is Debian 11 (Bullseye) diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml index 4da1a9cdfeb..4c234d4bf33 100644 --- a/.github/workflows/system-test.yml +++ b/.github/workflows/system-test.yml @@ -25,10 +25,11 @@ jobs: distribution: 'temurin' - name: Clone system-test - run: | - git clone https://github.com/tronprotocol/system-test.git - cd system-test - git checkout release_workflow + uses: actions/checkout@v4 + with: + repository: tronprotocol/system-test + ref: release_workflow + path: system-test - name: Checkout java-tron uses: actions/checkout@v4 @@ -74,6 +75,10 @@ jobs: - name: Run system tests working-directory: system-test run: | + if [ ! -f solcDIR/solc-linux-0.8.6 ]; then + echo "ERROR: solc binary not found at solcDIR/solc-linux-0.8.6" + exit 1 + fi cp solcDIR/solc-linux-0.8.6 solcDIR/solc ./gradlew clean --no-daemon ./gradlew --info stest --no-daemon From fc95a014b58fea76e77a2bae09a480c0c2c56082 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Wed, 11 Mar 2026 16:54:59 +0800 Subject: [PATCH 11/11] init PR coverage check --- .github/workflows/codecov-upload.yml | 56 ++++++++++++++++++++++++++++ codecov.yml | 11 ++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/codecov-upload.yml create mode 100644 codecov.yml diff --git a/.github/workflows/codecov-upload.yml b/.github/workflows/codecov-upload.yml new file mode 100644 index 00000000000..733b46e407f --- /dev/null +++ b/.github/workflows/codecov-upload.yml @@ -0,0 +1,56 @@ +name: Codecov Upload + +on: + workflow_run: + workflows: ["PR Check"] + types: [completed] + +jobs: + upload-coverage: + name: Upload Coverage + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + + permissions: + contents: read + actions: read + + steps: + - name: Get PR info from triggering workflow + id: pr-info + uses: actions/github-script@v7 + with: + script: | + const prs = context.payload.workflow_run.pull_requests; + if (!prs || prs.length === 0) { + core.setFailed('No pull request associated with this workflow run.'); + return; + } + const pr = prs[0]; + core.setOutput('pr_number', pr.number); + core.setOutput('head_sha', pr.head.sha); + core.setOutput('head_ref', pr.head.ref); + core.setOutput('run_id', context.payload.workflow_run.id); + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.pr-info.outputs.head_sha }} + + - name: Download JaCoCo artifacts from PR Check + uses: actions/download-artifact@v4 + with: + name: jacoco-rockylinux + path: artifacts/jacoco-rockylinux + run-id: ${{ steps.pr-info.outputs.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: artifacts/jacoco-rockylinux + override_commit: ${{ steps.pr-info.outputs.head_sha }} + override_branch: ${{ steps.pr-info.outputs.head_ref }} + override_pr: ${{ steps.pr-info.outputs.pr_number }} + fail_ci_if_error: true diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..4be840d7b5e --- /dev/null +++ b/codecov.yml @@ -0,0 +1,11 @@ +comment: false + +coverage: + status: + project: + default: + target: auto # must not decrease from base branch + threshold: 0.1% # allow 0.1% fluctuation + patch: + default: + target: 0% # minimum coverage for changed lines