-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ci: add multi-platform build tests and system-test workflows #6574
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
Changes from all commits
2be8685
e560afe
7eacfea
c5ec11c
1b2d1d8
63c17a4
800d827
fb43e54
ccca67c
e426142
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 ] | ||
|
|
@@ -12,6 +14,7 @@ concurrency: | |
| jobs: | ||
| pr-lint: | ||
| name: PR Lint | ||
| if: github.event_name == 'pull_request' | ||
|
Contributor
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. The fix works: One remaining issue: 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. 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.
Contributor
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. 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 Adding 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. Thanks for your feedback. There is no strong need to add |
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
|
|
@@ -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: | ||
|
Contributor
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. Nit (non-blocking): Currently checkstyle is only enabled for 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 idea. The current purpose is to migrate it from buildkite to workflow. Might extends it in another PR. |
||
| name: Checkstyle | ||
| runs-on: ubuntu-latest | ||
| runs-on: ubuntu-24.04-arm | ||
|
Contributor
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. Checkstyle is pure static analysis and architecture-independent. 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. Use a pinned version instead of a mutable version. |
||
|
|
||
| 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 | ||
|
|
@@ -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: | ||
|
|
@@ -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: | ||
|
Contributor
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. I think you can add 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 it. |
||
| 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 | ||
| 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_**' ] | ||
|
Contributor
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. Is there a reason the master branch isn’t considered? 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 suggestion, I will add it later. |
||
| 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 | ||
|
Contributor
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. Using raw git clone + git checkout has a few drawbacks:
Suggest using actions/checkout instead: 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. Optimize it. |
||
| 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 | ||
|
Contributor
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. If the Suggest adding an existence check: 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 it. |
||
| ./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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,7 @@ check.dependsOn 'lint' | |
| checkstyle { | ||
| toolVersion = "${versions.checkstyle}" | ||
| configFile = file("config/checkstyle/checkStyleAll.xml") | ||
| maxWarnings = 0 | ||
|
Contributor
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.
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| 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 |
Uh oh!
There was an error while loading. Please reload this page.
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.
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 eventscontext.payload.pull_requestis undefined, which throws a TypeError and marks this job as failure. Since downstream jobs (build, docker-build-*) depend onpr-lintvianeeds, they will all be skipped on push events.Suggest splitting into two workflows:
pull_requestonly, includespr-lint + checkstyle + builds.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.