Skip to content

Commit

Permalink
[CI] Fix crash logs upload on Windows + compress test data before upl…
Browse files Browse the repository at this point in the history
…oad.
  • Loading branch information
vyazelenko committed Jan 16, 2025
1 parent d3cfe6a commit 15ad44b
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 28 deletions.
52 changes: 38 additions & 14 deletions .github/workflows/ci-low-cadence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,30 @@ jobs:
java-version: 17
- name: Build with Gradle
run: ./gradlew clean build :agrona-concurrency-tests:concurrencyTests
- name: Copy test logs
- name: Copy test logs (Unix)
id: copy_test_logs
if: failure()
if: failure() && runner.os != 'Windows'
run: |
echo "dir=build/test_logs" >> $GITHUB_OUTPUT
./gradlew copyTestLogs
- name: Upload crash logs
if: always() && steps.copy_test_logs.outputs.dir == 'build/test_logs'
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
./gradlew tarTestLogs
- name: Upload crash logs (Unix)
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.dir }}
path: ${{ steps.copy_test_logs.outputs.file }}
- name: Copy test logs (Windows)
id: copy_test_logs_windows
if: runner.os == 'Windows' && failure()
run: |
echo "file=build/distributions/test_logs.tbz2" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
./gradlew tarTestLogs
- name: Upload crash logs (Windows)
if: runner.os == 'Windows' && always() && steps.copy_test_logs_windows.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs_windows.outputs.file }}

ea-build:
name: Java ${{ matrix.java }} (${{ matrix.os }})
Expand Down Expand Up @@ -130,15 +142,27 @@ jobs:
java-version: 17
- name: Build with Gradle
run: ./gradlew clean build :agrona-concurrency-tests:concurrencyTests
- name: Copy test logs
- name: Copy test logs (Unix)
id: copy_test_logs
if: failure()
if: failure() && runner.os != 'Windows'
run: |
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
./gradlew tarTestLogs
- name: Upload crash logs (Unix)
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-ea-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.file }}
- name: Copy test logs (Windows)
id: copy_test_logs_windows
if: runner.os == 'Windows' && failure()
run: |
echo "dir=build/test_logs" >> $GITHUB_OUTPUT
./gradlew copyTestLogs
- name: Upload crash logs
if: always() && steps.copy_test_logs.outputs.dir == 'build/test_logs'
echo "file=build/distributions/test_logs.tbz2" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
./gradlew tarTestLogs
- name: Upload crash logs (Windows)
if: runner.os == 'Windows' && always() && steps.copy_test_logs_windows.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-ea-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.dir }}
path: ${{ steps.copy_test_logs_windows.outputs.file }}
52 changes: 38 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,30 @@ jobs:
java-version: 17
- name: Build with Gradle
run: ./gradlew
- name: Copy test logs
- name: Copy test logs (Unix)
id: copy_test_logs
if: failure()
if: failure() && runner.os != 'Windows'
run: |
echo "dir=build/test_logs" >> $GITHUB_OUTPUT
./gradlew copyTestLogs
- name: Upload crash logs
if: always() && steps.copy_test_logs.outputs.dir == 'build/test_logs'
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
./gradlew tarTestLogs
- name: Upload crash logs (Unix)
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.dir }}
path: ${{ steps.copy_test_logs.outputs.file }}
- name: Copy test logs (Windows)
id: copy_test_logs_windows
if: runner.os == 'Windows' && failure()
run: |
echo "file=build/distributions/test_logs.tbz2" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
./gradlew tarTestLogs
- name: Upload crash logs (Windows)
if: runner.os == 'Windows' && always() && steps.copy_test_logs_windows.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs_windows.outputs.file }}

ea-build:
name: Java ${{ matrix.java }} (${{ matrix.os }})
Expand Down Expand Up @@ -135,15 +147,27 @@ jobs:
java-version: 17
- name: Build with Gradle
run: ./gradlew
- name: Copy test logs
- name: Copy test logs (Unix)
id: copy_test_logs
if: failure()
if: failure() && runner.os != 'Windows'
run: |
echo "file=build/distributions/test_logs.tbz2" >> $GITHUB_OUTPUT
./gradlew tarTestLogs
- name: Upload crash logs (Unix)
if: always() && steps.copy_test_logs.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-ea-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.file }}
- name: Copy test logs (Windows)
id: copy_test_logs_windows
if: runner.os == 'Windows' && failure()
run: |
echo "dir=build/test_logs" >> $GITHUB_OUTPUT
./gradlew copyTestLogs
- name: Upload crash logs
if: always() && steps.copy_test_logs.outputs.dir == 'build/test_logs'
echo "file=build/distributions/test_logs.tbz2" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
./gradlew tarTestLogs
- name: Upload crash logs (Windows)
if: runner.os == 'Windows' && always() && steps.copy_test_logs_windows.outputs.file == 'build/distributions/test_logs.tbz2'
uses: actions/upload-artifact@v4
with:
name: crash-logs-ea-${{ matrix.os }}-java-${{ matrix.java }}
path: ${{ steps.copy_test_logs.outputs.dir }}
path: ${{ steps.copy_test_logs_windows.outputs.file }}
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,10 @@ tasks.named("dependencyUpdates").configure {

tasks.register('copyTestLogs', Copy) {
from '.'
include '**/*.hprof'
include '**/*.log'
include '**/build/reports/tests/**'
include '**/build/test-results/**/*'
include '**/jcstress-results-*.gz'
include 'LICENSE'
exclude 'build'
Expand All @@ -554,6 +557,13 @@ tasks.register('copyTestLogs', Copy) {
includeEmptyDirs = false
}

tasks.register('tarTestLogs', Tar) {
dependsOn tasks.named('copyTestLogs')
archiveBaseName.set('test_logs')
from 'build/test_logs'
compression Compression.BZIP2
}

wrapper {
gradleVersion = libs.versions.gradle.get()
distributionType = 'ALL'
Expand Down

0 comments on commit 15ad44b

Please sign in to comment.