Repository navigation
refactor: move test constant out of production code and rename NET_CONF #6555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b9ad5c8
fix: resolve flaky unit tests in ApiUtilTest and BaseNetTest
9386e25
fix: use random port for P2P listener in BaseNetTest to avoid port co…
76f0a7f
revert: restore ApiUtilTest.java to original version
386400f
refactor: move TEST_CONF to test module and rename TESTNET_CONF to NE…
c0f9e25
merge: sync with origin/develop and resolve conflicts
d9400ed
style: fix import order and line length for TestConstants
dd46d22
docs: fix formatting and consistency issues in README
9a003cd
ci: add PR check workflow for build, checkstyle, tests and PR lint
2365d2e
ci: add PR check workflow for build, checkstyle, tests and PR lint
6aab86a
ci: add multi-platform build matrix (JDK 8/x86_64 + JDK 17/aarch64)
cb647f6
ci: add JDK 17/aarch64 to test matrix
2cd267d
Merge branch 'develop' into develop
kuny0707 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| name: PR Check | ||
|
|
||
| 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: | ||
| pr-lint: | ||
| name: PR Lint | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check PR title format | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const title = context.payload.pull_request.title; | ||
|
|
||
| const errors = []; | ||
|
|
||
| // Title should not be empty or too short | ||
| if (!title || title.trim().length < 10) { | ||
| errors.push('PR title is too short (minimum 10 characters).'); | ||
| } | ||
|
|
||
| // Title should not exceed 72 characters | ||
| if (title.length > 72) { | ||
| errors.push(`PR title is too long (${title.length}/72 characters).`); | ||
| } | ||
|
|
||
| // Title should follow conventional format: type: description | ||
| // Allowed types: feat, fix, refactor, docs, style, test, chore, ci, perf, build, revert | ||
| const conventionalRegex = /^(feat|fix|refactor|docs|style|test|chore|ci|perf|build|revert)(\(.+\))?:\s.+/; | ||
| if (!conventionalRegex.test(title)) { | ||
| errors.push( | ||
| 'PR title must follow conventional format: `type: description`\n' + | ||
| 'Allowed types: feat, fix, refactor, docs, style, test, chore, ci, perf, build, revert\n' + | ||
| 'Example: `feat: add new transaction validation`' | ||
| ); | ||
| } | ||
|
|
||
| if (errors.length > 0) { | ||
| const message = '### PR Title Check Failed\n\n' + errors.map(e => `- ${e}`).join('\n'); | ||
| core.setFailed(message); | ||
| } else { | ||
| core.info('PR title format is valid.'); | ||
| } | ||
|
|
||
| - name: Check PR description | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const body = context.payload.pull_request.body; | ||
|
|
||
| if (!body || body.trim().length < 20) { | ||
| core.setFailed( | ||
| '### PR Description Check Failed\n\n' + | ||
| 'PR description is too short or empty. Please describe what this PR does and why.' | ||
| ); | ||
| } else { | ||
| core.info('PR description is valid.'); | ||
| } | ||
|
|
||
| build: | ||
| name: Build | ||
| 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: Build | ||
| run: ./gradlew clean build -x test | ||
|
|
||
| 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/ | ||
|
|
||
| test: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| timeout-minutes: 60 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 8 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '8' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add JDK17 for aarch64 Test?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Will add JDK 17/aarch64 to the test matrix as well. |
||
| 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 tests | ||
| run: ./gradlew test | ||
|
|
||
| - name: Upload test reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-reports | ||
| path: | | ||
| **/build/reports/tests/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package org.tron.common; | ||
|
|
||
| public class TestConstants { | ||
|
|
||
| public static final String TEST_CONF = "config-test.conf"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add JDK17 for aarch64 Build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Build job now uses a matrix strategy with both JDK 8/x86_64 and JDK 17/aarch64. See the latest commit.