Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,18 @@ 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
uses: github/codeql-action/autobuild@v4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
172 changes: 124 additions & 48 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: PR Check

on:
push:
branches: [ 'master', 'release_**' ]
pull_request:
branches: [ 'develop', 'release_**' ]
types: [ opened, edited, synchronize, reopened ]
Expand All @@ -12,6 +14,7 @@ concurrency:
jobs:
pr-lint:
name: PR Lint
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -93,53 +96,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
Expand All @@ -163,20 +130,31 @@ 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 }})
if: github.event.action != 'edited' && !failure()
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-26
os-name: macos
arch: aarch64

steps:
Expand All @@ -197,13 +175,111 @@ 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)
if: github.event.action != 'edited' && !failure()
needs: [pr-lint, checkstyle]
runs-on: ubuntu-latest
timeout-minutes: 60

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: 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

- 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/tests/
**/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)
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)

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: |
/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
92 changes: 92 additions & 0 deletions .github/workflows/system-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: System Test

on:
push:
branches: [ 'master', 'release_**' ]
pull_request:
branches: [ 'develop', 'release_**' ]
types: [ opened, 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
timeout-minutes: 60

steps:
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

- name: Clone system-test
uses: actions/checkout@v4
with:
repository: tronprotocol/system-test
ref: release_workflow
path: system-test

- 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 for it to be ready..."

MAX_ATTEMPTS=60
INTERVAL=5
for i in $(seq 1 $MAX_ATTEMPTS); do
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
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
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

- 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
1 change: 1 addition & 0 deletions framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ check.dependsOn 'lint'
checkstyle {
toolVersion = "${versions.checkstyle}"
configFile = file("config/checkstyle/checkStyleAll.xml")
maxWarnings = 0
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
org.gradle.parallel=true
org.gradle.jvmargs=-Xms1g
org.gradle.caching=true
org.gradle.daemon=false
1 change: 1 addition & 0 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ check.dependsOn 'lint'
checkstyle {
toolVersion = "${versions.checkstyle}"
configFile = file("../framework/config/checkstyle/checkStyleAll.xml")
maxWarnings = 0
}

checkstyleMain {
Expand Down
Loading