Skip to content

Commit 9a9c283

Browse files
committed
[CI] Upload crash logs for failed Java builds.
1 parent 43d4cfa commit 9a9c283

File tree

3 files changed

+70
-5
lines changed

3 files changed

+70
-5
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
java: [ '17', '21' ]
31+
java: [ '17', '21', '23' ]
3232
os: [ 'ubuntu-24.04', 'windows-latest', 'macos-latest' ]
3333
steps:
3434
- name: Checkout code
@@ -52,18 +52,49 @@ jobs:
5252
with:
5353
distribution: 'zulu'
5454
java-version: ${{ matrix.java }}
55-
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION
55+
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION (Unix)
56+
if: runner.os != 'Windows'
5657
run: |
5758
java -Xinternalversion
5859
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV
5960
echo "BUILD_JAVA_VERSION=${{ matrix.java }}" >> $GITHUB_ENV
60-
- name: Setup java 17 to run the Gradle script
61+
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION (Windows)
62+
if: runner.os == 'Windows'
63+
run: |
64+
java -Xinternalversion
65+
echo "BUILD_JAVA_HOME=$env:JAVA_HOME" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
66+
echo "BUILD_JAVA_VERSION=${{ matrix.java }}" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
67+
- name: Setup java
6168
uses: actions/setup-java@v4
6269
with:
6370
distribution: 'zulu'
6471
java-version: 17
6572
- name: Build with Gradle
66-
run: ./gradlew --stacktrace
73+
run: ./gradlew
74+
- name: Copy test logs (Unix)
75+
id: copy_test_logs
76+
if: failure() && runner.os != 'Windows'
77+
run: |
78+
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
79+
./gradlew tarTestLogs
80+
- name: Upload crash logs (Unix)
81+
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
85+
path: ${{ steps.copy_test_logs.outputs.file }}
86+
- name: Copy test logs (Windows)
87+
id: copy_test_logs_windows
88+
if: runner.os == 'Windows' && failure()
89+
run: |
90+
echo "file=build/distributions/test_logs.tbz2" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
91+
./gradlew tarTestLogs
92+
- name: Upload crash logs (Windows)
93+
if: runner.os == 'Windows' && always() && steps.copy_test_logs_windows.outputs.file == 'build/distributions/test_logs.tbz2'
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
97+
path: ${{ steps.copy_test_logs_windows.outputs.file }}
6798

6899
csharp-build:
69100
name: C# ${{ matrix.dotnet }}

.github/workflows/slow.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,21 @@ jobs:
5555
run: ./csharp/build.sh
5656
- name: Run property tests
5757
run: ./gradlew propertyTest
58+
- name: Copy test logs (Unix)
59+
id: copy_test_logs
60+
if: failure()
61+
run: |
62+
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
63+
./gradlew tarTestLogs
64+
- name: Upload crash logs (Unix)
65+
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: crash-logs-${{ matrix.os }}-property-tests
69+
path: ${{ steps.copy_test_logs.outputs.file }}
5870
- name: Upload test results
5971
uses: actions/upload-artifact@v4
60-
if: success() || failure()
72+
if: always()
6173
with:
6274
name: property-tests
6375
path: sbe-tool/build/reports/tests/propertyTest

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,28 @@ tasks.named('build').configure {
10791079
dependsOn 'verifyJavaIrCodecsInSync'
10801080
}
10811081

1082+
tasks.register('copyTestLogs', Copy) {
1083+
from '.'
1084+
include '**/build/test-output/**'
1085+
include '**/*.hprof'
1086+
include '**/*.log'
1087+
include '**/*.tlog'
1088+
include '**/build/reports/tests/**'
1089+
include '**/build/test-results/**/*'
1090+
include 'LICENSE'
1091+
exclude 'build'
1092+
into 'build/test_logs'
1093+
1094+
includeEmptyDirs = false
1095+
}
1096+
1097+
tasks.register('tarTestLogs', Tar) {
1098+
dependsOn tasks.named('copyTestLogs')
1099+
archiveBaseName.set('test_logs')
1100+
from 'build/test_logs'
1101+
compression Compression.BZIP2
1102+
}
1103+
10821104
def isNonStable = { String version ->
10831105
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
10841106
def regex = /^[0-9,.v-]+(-r)?$/

0 commit comments

Comments
 (0)