-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (67 loc) · 2.62 KB
/
Copy pathtest.yml
File metadata and controls
77 lines (67 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Tests
on:
workflow_call:
jobs:
test:
name: Tests (PostgreSQL ${{ matrix.postgres-version }})
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
postgres-version: [ 15, 16, 17, 18 ]
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- uses: aboutbits/github-actions-java/setup-with-gradle@v4
with:
java-version: 25
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build & Test
run: |
mkdir -p thread-dumps
# Run Gradle in the background and pipe output to a file
./gradlew \
--console=plain \
:operator:test \
--fail-fast \
-Dquarkus.test.profile=test-pg${{ matrix.postgres-version }} > gradle-output.log 2>&1 &
GRADLE_PID=$!
# Background watcher: tail the log and look for the exception
tail -f gradle-output.log | while read -r line; do
echo "$line" # Print the line to standard output so you still see the CI logs
# Check if the line contains our target exception
if [[ "$line" == *"listSyncAndWatch failed for"* ]]; then
echo "========================================"
echo "Exception detected! Taking thread dumps..."
echo "========================================"
# Take 3 consecutive thread dumps 2 seconds apart to see if threads are moving
for i in 1 2 3; do
jps -q | while read -r pid; do
dump_file="thread-dumps/threaddump-pid${pid}-run${i}.txt"
echo "Taking thread dump $i for PID $pid at $(date)" > "$dump_file"
jcmd "$pid" Thread.print >> "$dump_file" 2>&1 || true
done
sleep 1
done
# We break out of the loop after taking the dumps
break
fi
done &
WATCH_PID=$!
# Wait for the Gradle build to finish
wait $GRADLE_PID || true
# Cleanup watcher
kill $WATCH_PID || true
env:
GITHUB_USER_NAME: ${{ github.actor }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Thread Dumps
if: always()
uses: actions/upload-artifact@v7
with:
name: thread-dumps-pg${{ matrix.postgres-version }}
path: thread-dumps/*.txt
retention-days: 7
compression-level: 3