Skip to content
Open
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
97 changes: 48 additions & 49 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,43 @@ jobs:
core.info('PR lint passed.');
}

checkstyle:
name: Checkstyle
runs-on: ubuntu-24.04-arm

steps:
- uses: actions/checkout@v4

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

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Checkstyle
run: ./gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain

- name: Upload Checkstyle reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: checkstyle-reports
path: |
framework/build/reports/checkstyle/
plugins/build/reports/checkstyle/

build:
name: Build ${{ matrix.os-name }}(JDK ${{ matrix.java }} / ${{ matrix.arch }})
needs: pr-lint
needs: [pr-lint, checkstyle]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -141,7 +175,7 @@ jobs:

docker-build-rockylinux:
name: Build rockylinux (JDK 8 / x86_64)
needs: pr-lint
needs: [pr-lint, checkstyle]
runs-on: ubuntu-latest

container:
Expand Down Expand Up @@ -207,7 +241,7 @@ jobs:

docker-build-debian11:
name: Build debian11 (JDK 8 / x86_64)
needs: pr-lint
needs: [pr-lint, checkstyle]
runs-on: ubuntu-latest

container:
Expand Down Expand Up @@ -247,7 +281,7 @@ jobs:
run: chmod +x gradlew

- name: Build
run: ./gradlew clean build --no-daemon
run: ./gradlew clean build --no-daemon --no-build-cache


coverage-gate:
Expand Down Expand Up @@ -398,53 +432,18 @@ jobs:
fi

# Rule 3: patch coverage on changed files >= 80%
if [ "$impacted_files" -gt 0 ] && [ "$(echo "$patch_cov > 0" | bc)" -eq 1 ]; then
if [ "$(echo "$patch_cov < 80" | bc)" -eq 1 ]; then
echo "FAIL: Patch coverage is ${patch_cov}% (minimum 80%)."
echo "Please add tests for new/changed code."
exit 1
fi
else
echo "No impacted files or no patch data; skipping patch coverage check."
fi
# if [ "$impacted_files" -gt 0 ] && [ "$(echo "$patch_cov > 0" | bc)" -eq 1 ]; then
# if [ "$(echo "$patch_cov < 80" | bc)" -eq 1 ]; then
# echo "FAIL: Patch coverage is ${patch_cov}% (minimum 80%)."
# echo "Please add tests for new/changed code."
# exit 1
# fi
# else
# echo "No impacted files or no patch data; skipping patch coverage check."
# fi

echo ""
echo "All coverage gates passed!"
echo " Current commit : ${self_cov}%"
echo " Base branch : ${base_branch_cov}%"
echo " Patch coverage : ${patch_cov}%"

checkstyle:
name: Checkstyle
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Checkstyle
run: ./gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain

- name: Upload Checkstyle reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: checkstyle-reports
path: |
framework/build/reports/checkstyle/
plugins/build/reports/checkstyle/

echo " Patch coverage : ${patch_cov}%"
72 changes: 72 additions & 0 deletions .github/workflows/sonar-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: SonarCloud Analysis

on:
pull_request:
branches: [ 'develop_ci', 'release_**' ]
types: [ opened, edited, synchronize, reopened ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
contents: read # don't comment in PR after check

jobs:
sonar-check:
name: SonarCloud Analysis
runs-on: ubuntu-24.04-arm

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cat > /tmp/sonar-init.gradle << 'EOF'
initscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:5.1.0.4882'
}
}
rootProject {
apply plugin: org.sonarqube.gradle.SonarQubePlugin
}
EOF

./gradlew clean classes testClasses sonar --info \
--init-script /tmp/sonar-init.gradle \
-PskipJdkCheck \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=${{ github.repository_owner }} \
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }} \
-Dsonar.qualitygate.wait=false \
-Dsonar.pullrequest.github.summary_comment=false
71 changes: 71 additions & 0 deletions .github/workflows/system-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: System Test

on:
pull_request:
branches: [ 'develop_ci', '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
26 changes: 25 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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}")
}

Expand Down Expand Up @@ -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", ""
}
}
}
}
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
2 changes: 1 addition & 1 deletion framework/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}

Expand Down
26 changes: 26 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,19 @@
<sha256 value="896728b6f49906d7516f182a170197963fe90dce88f14f50b585ac153427ffc2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.parent" name="parent" version="59.0.29">
<artifact name="parent-59.0.29.pom">
<sha256 value="7d2dc7aec9f250ede1c8cdc4cdb563b2ed6c49e209b70024f9f62822d876952a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.api" name="sonar-scanner-api" version="2.16.2.588">
<artifact name="sonar-scanner-api-2.16.2.588.jar">
<sha256 value="4df4526499760242c2d5d76ee8bc38326b4549c344e034e12bc392d2b8a618ac" origin="Generated by Gradle"/>
</artifact>
<artifact name="sonar-scanner-api-2.16.2.588.pom">
<sha256 value="d8c866f087da23f3fa729522cb32864d54d366dd6ce6b400abd657af5bba9010" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.api" name="sonar-scanner-api" version="2.9.0.887">
<artifact name="sonar-scanner-api-2.9.0.887.jar">
<sha256 value="12ba0b2d9fc5b5b896b3b16c96c3c46728094d83da5ea0a6289e21ac9c39f88a" origin="Generated by Gradle"/>
Expand All @@ -2270,6 +2283,11 @@
<sha256 value="d80d568bb60b53d5c748c0f07649608bbb3c0880939f911af6477bd0dc132915" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.api" name="sonar-scanner-api-parent" version="2.16.2.588">
<artifact name="sonar-scanner-api-parent-2.16.2.588.pom">
<sha256 value="c532bb8678ecd5c5e45da5d00211eb67541e9a5ea465b67ba91307b0390b137a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.api" name="sonar-scanner-api-parent" version="2.9.0.887">
<artifact name="sonar-scanner-api-parent-2.9.0.887.pom">
<sha256 value="803f182f822f359678cd1a108fc44cda785859d5555582cf3fe40574a3141943" origin="Generated by Gradle"/>
Expand All @@ -2283,6 +2301,14 @@
<sha256 value="7e733b80012fed1f7a830a80b56ff76cfd3ac9b1cd4cfa9e0833727663bf2f4f" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.gradle" name="sonarqube-gradle-plugin" version="5.1.0.4882">
<artifact name="sonarqube-gradle-plugin-5.1.0.4882.jar">
<sha256 value="0a0a1aa505a1b05c94768bd248a51e1bc61af251ec9819f352b41c2afd8cbcfa" origin="Generated by Gradle"/>
</artifact>
<artifact name="sonarqube-gradle-plugin-5.1.0.4882.module">
<sha256 value="749ab4ce13526279faacc79c6c5416005993d3fee2bf09e8bfc304542cd21d9f" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonatype.oss" name="oss-parent" version="7">
<artifact name="oss-parent-7.pom">
<sha256 value="b51f8867c92b6a722499557fc3a1fdea77bdf9ef574722fe90ce436a29559454" origin="Generated by Gradle"/>
Expand Down
1 change: 0 additions & 1 deletion plugins/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id "org.sonarqube" version "2.6"
}

apply plugin: 'application'
Expand Down