Skip to content

Commit 2be8685

Browse files
committed
init workflow
1 parent 5044c82 commit 2be8685

10 files changed

Lines changed: 255 additions & 77 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,16 @@ jobs:
2929

3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333

3434
# Initializes the CodeQL tools for scanning.
3535
- name: Initialize CodeQL
36-
uses: github/codeql-action/init@v3
36+
uses: github/codeql-action/init@v4
3737
with:
3838
languages: ${{ matrix.language }}
39-
# If you wish to specify custom queries, you can do so here or in a config file.
40-
# By default, queries listed here will override any specified in a config file.
41-
# Prefix the list here with "+" to use these queries and those in the config file.
42-
43-
# 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
44-
# queries: security-extended,security-and-quality
45-
46-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
47-
# If this step fails, then you should remove it and run the build manually (see below)
48-
- name: Autobuild
49-
uses: github/codeql-action/autobuild@v3
50-
51-
# ℹ️ Command-line programs to run using the OS shell.
52-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
53-
54-
# If the Autobuild fails above, remove it and uncomment the following three lines.
55-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
56-
57-
# - run: |
58-
# echo "Run, Build Application using script"
59-
# ./location_of_script_within_repo/buildscript.sh
39+
build-mode: none
6040

6141
- name: Perform CodeQL Analysis
62-
uses: github/codeql-action/analyze@v3
42+
uses: github/codeql-action/analyze@v4
6343
with:
6444
category: "/language:${{matrix.language}}"

.github/workflows/pr-check.yml

Lines changed: 124 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -93,53 +93,17 @@ jobs:
9393
core.info('PR lint passed.');
9494
}
9595
96-
build:
97-
name: Build (JDK ${{ matrix.java }} / ${{ matrix.arch }})
98-
needs: pr-lint
99-
runs-on: ${{ matrix.runner }}
100-
strategy:
101-
fail-fast: false
102-
matrix:
103-
include:
104-
- java: '8'
105-
runner: ubuntu-latest
106-
arch: x86_64
107-
- java: '17'
108-
runner: ubuntu-24.04-arm
109-
arch: aarch64
110-
111-
steps:
112-
- uses: actions/checkout@v4
113-
114-
- name: Set up JDK ${{ matrix.java }}
115-
uses: actions/setup-java@v4
116-
with:
117-
java-version: ${{ matrix.java }}
118-
distribution: 'temurin'
119-
120-
- name: Cache Gradle packages
121-
uses: actions/cache@v4
122-
with:
123-
path: |
124-
~/.gradle/caches
125-
~/.gradle/wrapper
126-
key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
127-
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle-
128-
129-
- name: Build
130-
run: ./gradlew clean build -x test
131-
13296
checkstyle:
13397
name: Checkstyle
134-
runs-on: ubuntu-latest
98+
runs-on: ubuntu-24.04-arm
13599

136100
steps:
137101
- uses: actions/checkout@v4
138102

139-
- name: Set up JDK 8
103+
- name: Set up JDK 17
140104
uses: actions/setup-java@v4
141105
with:
142-
java-version: '8'
106+
java-version: '17'
143107
distribution: 'temurin'
144108

145109
- name: Cache Gradle packages
@@ -163,20 +127,29 @@ jobs:
163127
framework/build/reports/checkstyle/
164128
plugins/build/reports/checkstyle/
165129
166-
test:
167-
name: Unit Tests (JDK ${{ matrix.java }} / ${{ matrix.arch }})
130+
build:
131+
name: Build ${{ matrix.os-name }}(JDK ${{ matrix.java }} / ${{ matrix.arch }})
132+
needs: [pr-lint, checkstyle]
168133
runs-on: ${{ matrix.runner }}
169-
needs: build
170-
timeout-minutes: 60
171134
strategy:
172135
fail-fast: false
173136
matrix:
174137
include:
175138
- java: '8'
176139
runner: ubuntu-latest
140+
os-name: ubuntu
177141
arch: x86_64
178142
- java: '17'
179143
runner: ubuntu-24.04-arm
144+
os-name: ubuntu
145+
arch: aarch64
146+
- java: '8'
147+
runner: macos-26-intel
148+
os-name: macos
149+
arch: x86_64
150+
- java: '17'
151+
runner: macos-latest
152+
os-name: macos
180153
arch: aarch64
181154

182155
steps:
@@ -197,13 +170,115 @@ jobs:
197170
key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
198171
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle-
199172

200-
- name: Run tests
201-
run: ./gradlew test
173+
- name: Build
174+
run: ./gradlew clean build --no-daemon
202175

203-
- name: Upload test reports
204-
if: failure()
176+
docker-build-rockylinux:
177+
name: Build rockylinux (JDK 8 / x86_64)
178+
needs: [pr-lint, checkstyle]
179+
runs-on: ubuntu-latest
180+
181+
container:
182+
image: rockylinux:8
183+
184+
env:
185+
GRADLE_USER_HOME: /github/home/.gradle
186+
LANG: en_US.UTF-8
187+
LC_ALL: en_US.UTF-8
188+
189+
steps:
190+
- name: Checkout code
191+
uses: actions/checkout@v4
192+
193+
- name: Install dependencies (Rocky 8 + JDK8)
194+
run: |
195+
set -euxo pipefail
196+
dnf -y install java-1.8.0-openjdk-devel git wget unzip which jq bc curl glibc-langpack-en
197+
dnf -y groupinstall "Development Tools"
198+
199+
- name: Check Java version
200+
run: java -version
201+
202+
- name: Cache Gradle
203+
uses: actions/cache@v4
204+
with:
205+
path: |
206+
/github/home/.gradle/caches
207+
/github/home/.gradle/wrapper
208+
key: ${{ runner.os }}-rockylinux-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
209+
restore-keys: |
210+
${{ runner.os }}-rockylinux-gradle-
211+
212+
- name: Prepare checkstyle config copy
213+
run: |
214+
set -euxo pipefail
215+
cp -f config/checkstyle/checkStyle.xml config/checkstyle/checkStyleAll.xml || true
216+
217+
- name: Grant execute permission
218+
run: chmod +x gradlew
219+
220+
- name: Stop Gradle daemon
221+
run: ./gradlew --stop || true
222+
223+
- name: Build
224+
run: ./gradlew clean build --no-daemon --no-build-cache
225+
#run: |
226+
# ./gradlew clean build -x test --no-daemon --no-build-cache
227+
# ./gradlew framework:test --tests org.tron.core.zksnark.ShieldedReceiveTest
228+
229+
- name: Generate JaCoCo report
230+
run: ./gradlew jacocoTestReport --no-daemon --no-build-cache
231+
232+
- name: Upload JaCoCo artifacts
205233
uses: actions/upload-artifact@v4
206234
with:
207-
name: test-reports-${{ matrix.arch }}
235+
name: jacoco-rockylinux
236+
path: |
237+
**/build/reports/jacoco/test/jacocoTestReport.xml
238+
**/build/reports/**
239+
**/build/test-results/**
240+
if-no-files-found: error
241+
242+
docker-build-debian11:
243+
name: Build debian11 (JDK 8 / x86_64)
244+
needs: [pr-lint, checkstyle]
245+
runs-on: ubuntu-latest
246+
247+
container:
248+
image: eclipse-temurin:8-jdk # base image is Debian 11 (Bullseye)
249+
250+
defaults:
251+
run:
252+
shell: bash
253+
254+
env:
255+
GRADLE_USER_HOME: /github/home/.gradle
256+
257+
steps:
258+
- name: Checkout code
259+
uses: actions/checkout@v4
260+
261+
- name: Install dependencies (Debian + build tools)
262+
run: |
263+
set -euxo pipefail
264+
apt-get update
265+
apt-get install -y git wget unzip build-essential curl jq
266+
267+
- name: Check Java version
268+
run: java -version
269+
270+
- name: Cache Gradle
271+
uses: actions/cache@v4
272+
with:
208273
path: |
209-
**/build/reports/tests/
274+
/github/home/.gradle/caches
275+
/github/home/.gradle/wrapper
276+
key: ${{ runner.os }}-debian11-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
277+
restore-keys: |
278+
${{ runner.os }}-debian11-gradle-
279+
280+
- name: Grant execute permission
281+
run: chmod +x gradlew
282+
283+
- name: Build
284+
run: ./gradlew clean build --no-daemon --no-build-cache

.github/workflows/system-test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: System Test
2+
3+
on:
4+
pull_request:
5+
branches: [ 'develop', 'release_**' ]
6+
types: [ opened, edited, synchronize, reopened ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
system-test:
14+
name: System Test (JDK 8 / x86_64)
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Set up JDK 8
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '8'
22+
distribution: 'temurin'
23+
24+
- name: Clone system-test
25+
run: |
26+
git clone https://github.com/tronprotocol/system-test.git
27+
cd system-test
28+
git checkout release_workflow
29+
30+
- name: Checkout java-tron
31+
uses: actions/checkout@v4
32+
with:
33+
path: java-tron
34+
35+
- name: Cache Gradle packages
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/.gradle/caches
40+
~/.gradle/wrapper
41+
key: ${{ runner.os }}-gradle-system-test-${{ hashFiles('java-tron/**/*.gradle', 'java-tron/**/gradle-wrapper.properties') }}
42+
restore-keys: ${{ runner.os }}-gradle-system-test-
43+
44+
- name: Build java-tron
45+
working-directory: java-tron
46+
run: ./gradlew clean build -x test --no-daemon
47+
48+
- name: Copy config and start FullNode
49+
run: |
50+
cp system-test/testcase/src/test/resources/config-system-test.conf java-tron/
51+
cd java-tron
52+
nohup java -jar build/libs/FullNode.jar --witness -c config-system-test.conf > fullnode.log 2>&1 &
53+
echo "FullNode started, waiting 30 seconds..."
54+
sleep 30
55+
echo "=== FullNode log (last 30 lines) ==="
56+
tail -30 fullnode.log || true
57+
58+
- name: Run system tests
59+
working-directory: system-test
60+
run: |
61+
cp solcDIR/solc-linux-0.8.6 solcDIR/solc
62+
./gradlew clean --no-daemon
63+
./gradlew --info stest --no-daemon
64+
65+
- name: Upload FullNode log
66+
if: always()
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: fullnode-log
70+
path: java-tron/fullnode.log
71+
if-no-files-found: warn

build.gradle

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import org.gradle.nativeplatform.platform.internal.Architectures
22
import org.gradle.internal.os.OperatingSystem
3+
34
allprojects {
45
version = "1.0.0"
56
apply plugin: "java-library"
@@ -40,7 +41,7 @@ ext.archInfo = [
4041
VMOptions: isArm64 ? "${rootDir}/gradle/jdk17/java-tron.vmoptions" : "${rootDir}/gradle/java-tron.vmoptions"
4142
]
4243

43-
if (!archInfo.java.is(archInfo.requires.JavaVersion)) {
44+
if (!archInfo.java.is(archInfo.requires.JavaVersion) && !project.hasProperty('skipJdkCheck')) {
4445
throw new GradleException("Java ${archInfo.requires.JavaVersion} is required for ${archInfo.name}. Detected version ${archInfo.java}")
4546
}
4647

@@ -165,3 +166,26 @@ gradle.buildFinished {
165166
}
166167
}
167168
}
169+
170+
// SonarQube configuration — only activates when the plugin is applied (via CI init script)
171+
pluginManager.withPlugin('org.sonarqube') {
172+
sonar {
173+
properties {
174+
property "sonar.sourceEncoding", "UTF-8"
175+
}
176+
}
177+
178+
// Skip these projects
179+
["protocol", "platform", "example:actuator-example"].each { name ->
180+
project(":${name}").sonar.skipProject = true
181+
}
182+
183+
// Only analyze main sources, exclude test sources
184+
subprojects {
185+
sonar {
186+
properties {
187+
property "sonar.tests", ""
188+
}
189+
}
190+
}
191+
}

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

framework/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "org.gradle.test-retry" version "1.5.9"
3-
id "org.sonarqube" version "2.6"
3+
44
id "com.gorylenko.gradle-git-properties" version "2.4.1"
55
}
66

framework/src/main/java/org/tron/core/config/args/Args.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ private static String getCommitIdAbbrev() {
344344
InputStream in = Thread.currentThread()
345345
.getContextClassLoader().getResourceAsStream("git.properties");
346346
properties.load(in);
347-
} catch (IOException e) {
347+
} catch (Exception e) {
348348
logger.warn("Load resource failed,git.properties {}", e.getMessage());
349349
}
350350
return properties.getProperty("git.commit.id.abbrev");

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
org.gradle.parallel=true
22
org.gradle.jvmargs=-Xms1g
3+
org.gradle.caching=true
4+
org.gradle.daemon=false

0 commit comments

Comments
 (0)