ci: add multi-platform build tests and system-test workflows#6574
ci: add multi-platform build tests and system-test workflows#6574kuny0707 merged 10 commits intotronprotocol:developfrom
Conversation
.github/workflows/pr-check.yml
Outdated
| pull_request: | ||
| branches: [ 'develop', 'release_**' ] | ||
| types: [ opened, edited, synchronize, reopened ] | ||
| types: [ opened, synchronize, reopened ] |
There was a problem hiding this comment.
Removing edited from the trigger types means pr-lint won't re-run when the PR title or description is modified after opening. A contributor could pass the lint check initially, then edit the title to a non-conventional format before merging.
If the goal is to avoid unnecessary build/test runs on description edits, consider keeping edited in the workflow trigger and adding if: github.event.action != 'edited' to the build/test jobs so they skip edit-triggered runs while pr-lint still re-validates on every edit.
There was a problem hiding this comment.
Good suggestion, I will optimize it.
.github/workflows/pr-check.yml
Outdated
| - name: Prepare checkstyle config copy | ||
| run: | | ||
| set -euxo pipefail | ||
| cp -f config/checkstyle/checkStyle.xml config/checkstyle/checkStyleAll.xml || true |
There was a problem hiding this comment.
why here || true ?also the same question for other two places
There was a problem hiding this comment.
Because this step begins with set -euxo pipelinefail, any command returning a non-zero status will immediately terminate the script. true ensures that the script will continue execution even if checkStyle.xml does not exist (cp fails). it can delete here.
./gradlew --stop || true It cannot be removed. If there is no running daemon, --stop will return a non-zero value, which needs to be considered to prevent step failure.
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ 'develop', 'release_**' ] |
There was a problem hiding this comment.
Is there a reason the master branch isn’t considered?
There was a problem hiding this comment.
Good suggestion, I will add it later.
| run: ./gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain | ||
|
|
||
| - name: Upload Checkstyle reports | ||
| if: failure() |
There was a problem hiding this comment.
checkstyle {
toolVersion = "${versions.checkstyle}"
configFile = file("config/checkstyle/checkStyleAll.xml")
// no failure condition configured
}
Since checkStyleAll.xml sets <property name="severity" value="warning"/>, all violations are reported as warnings. Gradle's Checkstyle plugin only fails the task on error-level violations, so the task always succeeds regardless of how many violations exist. The CI job is effectively a no-op — violations never block PR merges.
Two Fix Options
Option A: Change severity to error in checkStyleAll.xml
Violations are promoted to error level, causing the Gradle task to fail by default (ignoreFailures=false).
<property name="severity" value="error"/>Option B: Add maxWarnings = 0 in Gradle
checkstyle {
toolVersion = "${versions.checkstyle}"
configFile = file("config/checkstyle/checkStyleAll.xml")
maxWarnings = 0
}
There was a problem hiding this comment.
If we fix it as suggested above, the behavior may differ from the previous implementation. But we can try.
| checkstyle { | ||
| toolVersion = "${versions.checkstyle}" | ||
| configFile = file("config/checkstyle/checkStyleAll.xml") | ||
| maxWarnings = 0 |
There was a problem hiding this comment.
plugins need this, too.
.github/workflows/pr-check.yml
Outdated
| os-name: macos | ||
| arch: x86_64 | ||
| - java: '17' | ||
| runner: macos-latest |
There was a problem hiding this comment.
Just a minor thought: since macos-latest is a floating alias that could shift to a newer version over time, would it make sense to pin it to macos-26 to stay consistent with macos-26-intel?
It looks like macos-26 is already generally available (actions/runner-images#13739).
If there's a specific reason for using macos-latest here, I'd love to learn more about it!
There was a problem hiding this comment.
Is there available image for macos-26 aarch64 ? I will fix it as macos-26.
There was a problem hiding this comment.
Yes, according to actions/runner-images#13739, macos-26 points to Apple Silicon (aarch64) by default.
Thanks for the quick fix!
| name: PR Check | ||
|
|
||
| on: | ||
| push: |
There was a problem hiding this comment.
This may be a bug: the pr-lint will crash on push events.
This workflow(line 15) triggers on both push (line 4-5) and pull_request (line 6-8).
The script accesses context.payload.pull_request.title, but on push events context.payload.pull_request is undefined, which throws a TypeError and marks this job as failure. Since downstream jobs (build, docker-build-*) depend on pr-lint via needs, they will all be skipped on push events.
Suggest splitting into two workflows:
- pr-check.yml: triggered by
pull_requestonly, includespr-lint + checkstyle + builds. - post-merge.yml: triggered by
pushonly, includescheckstyle + builds (no pr-lint).
This avoids the need for conditional if / always() workarounds on the needs chain.
There was a problem hiding this comment.
Thanks for you issue. I fix it as this: skip pr-lint when push; When the PR lint job succeeds or is skipped, the jobs depending on it can still run.
…the jobs depending on it can still run.
| jobs: | ||
| pr-lint: | ||
| name: PR Lint | ||
| if: github.event_name == 'pull_request' |
There was a problem hiding this comment.
The fix works: adding if: github.event_name == 'pull_request' to pr-lint and !failure() to downstream jobs correctly handles the push/PR scenarios.
One remaining issue: !failure() also returns true when jobs are cancelled. If a user manually cancels the workflow, build jobs will still start. Suggest adding !cancelled():
if: github.event.action != 'edited' && !failure() && !cancelled()
There was a problem hiding this comment.
Users cannot manually cancel only the PR lint job. When the PR is updated, the running PR lint job will be canceled and all jobs will be triggered again.
There was a problem hiding this comment.
Thanks for the clarification. You're right that the concurrency group handles the PR update case well — the entire old run is cancelled and a new one starts fresh.
The !cancelled() is more about the manual "Cancel workflow run" case from the Actions UI. In that scenario, !failure() alone would briefly allow pending jobs to start before GitHub cancels them again. The practical impact is minimal — at most a few seconds of wasted runner time.
Adding !cancelled() is a best practice for correctness, but I agree it's not a blocking issue. Feel free to address it or leave as-is.
There was a problem hiding this comment.
Thanks for your feedback. There is no strong need to add !cancelled() now. If a similar scenario occurs during execution, we can add it later.
|
|
||
| - name: Upload test reports | ||
| if: failure() | ||
| docker-build-rockylinux: |
There was a problem hiding this comment.
I think you can add timeout-minutes: 60 as the system-test job.
Besides, build and docker-build-debian11 can also add timeout-minutes.
| java-version: '8' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Clone system-test |
There was a problem hiding this comment.
Using raw git clone + git checkout has a few drawbacks:
- The release_workflow branch is hardcoded — if it's deleted or renamed, CI breaks with no clear error.
- No GitHub token auth — will fail if the repo ever becomes private.
- No shallow clone optimization.
Suggest using actions/checkout instead:
- name: Clone system-test
uses: actions/checkout@v4
with:
repository: tronprotocol/system-test
ref: release_workflow
path: system-test
| - name: Run system tests | ||
| working-directory: system-test | ||
| run: | | ||
| cp solcDIR/solc-linux-0.8.6 solcDIR/solc |
There was a problem hiding this comment.
If the system-test repo updates the solc version or changes the directory structure, this cp will fail and may produce confusing downstream test errors.
Suggest adding an existence check:
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
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} |
There was a problem hiding this comment.
Cache key glob patterns are inconsistent — checkstyle and build(line 174) use **/*.gradle, while rockylinux(line 213) and debian11(line 274) use **/*.gradle*. Both work the same for this project, but suggest standardizing to one pattern for maintainability.
There was a problem hiding this comment.
It doesn't matter much. If needed, I will change it next time.
| checkstyle: | ||
| name: Checkstyle | ||
| runs-on: ubuntu-latest | ||
| runs-on: ubuntu-24.04-arm |
There was a problem hiding this comment.
Checkstyle is pure static analysis and architecture-independent.
Why do you use ARM instead of ubuntu-latest (x86)?
There was a problem hiding this comment.
Use a pinned version instead of a mutable version.
| - name: Build | ||
| run: ./gradlew clean build -x test | ||
|
|
||
| checkstyle: |
There was a problem hiding this comment.
Nit (non-blocking): Currently checkstyle is only enabled for framework and plugins. It might be worth considering extending it to other modules (actuator, chainbase, common, etc.) in a follow-up PR to enforce consistent code style across the whole project.
There was a problem hiding this comment.
Good idea. The current purpose is to migrate it from buildkite to workflow. Might extends it in another PR.
Summary
This PR enhances the CI pipeline by introducing multi-platform build tests, Checkstyle and system tests workflows.
Changes
1. Multi-platform build tests
Add build tests across multiple platforms and architectures:
eclipse-temurin:8-jdkbase image.2. Rocky Linux build test
Since CentOS 7 and CentOS 8 images are not supported in GitHub-hosted runners, as described in the
GitHub-hosted runners documentation, a Rocky Linux build test has been added as a compatible replacement for CentOS 8.
3. Checkstyle workflow
Add a workflow to perform Checkstyle code style checks.
4. System test workflow
Add a workflow to execute a subset of daily build test cases from https://github.com/tronprotocol/system-test.
The workflow performs the following steps:
5. Upgrade CodeQL from v3 to v4