Skip to content

Commit 61dec9f

Browse files
committed
DO NOT MERGE - Debug Script
1 parent 88d321f commit 61dec9f

7 files changed

+97
-293
lines changed

.github/workflows/branches-and-prs.yml

-69
This file was deleted.

.github/workflows/codeql-analysis.yml

-62
This file was deleted.

.github/workflows/debug-script.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Debug Script'
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
- gh-pages
8+
pull_request:
9+
merge_group:
10+
11+
# https://stackoverflow.com/a/72408109/16358266
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build-and-verify:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
variant: ['3.0', '4.0']
23+
java: ['21', '22']
24+
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
# Codecov needs fetch-depth > 1
29+
fetch-depth: 2
30+
- name: 'Set up JDKs'
31+
uses: ./.github/actions/setup-build-env
32+
with:
33+
additional-java-version: ${{ matrix.java }}
34+
- name: 'Build Spock'
35+
# secrets are not injected for pull requests
36+
env:
37+
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
38+
run: ./repeatUntilFailure.sh ./gradlew --stacktrace :spock-specs:test --rerun "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}"

.github/workflows/docs-pr.yml

-38
This file was deleted.

.github/workflows/gradle-wrapper-validation.yml

-10
This file was deleted.

.github/workflows/release.yml

-114
This file was deleted.

repeatUntilFailure.sh

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# Ensure that a command is provided as an argument
4+
if [ $# -eq 0 ]; then
5+
echo "No command provided. Usage: ./run_until_fail.sh <command>"
6+
exit 1
7+
fi
8+
9+
# Command to run (passed as script arguments)
10+
COMMAND="$@"
11+
MAX_RETRIES=10 # Set the maximum number of retries
12+
COUNTER=0 # Initialize the retry counter
13+
CHECK_INTERVAL=5 # Interval in seconds to check if the command is still running
14+
ALERT_INTERVAL=120 # Interval in seconds to run jcmd if the command is still running
15+
16+
while [ $COUNTER -lt $MAX_RETRIES ]; do
17+
# Increment the retry counter
18+
COUNTER=$((COUNTER + 1))
19+
echo "Attempt $COUNTER of $MAX_RETRIES..."
20+
21+
# Start the command in the background
22+
bash -c "$COMMAND" &
23+
COMMAND_PID=$!
24+
25+
# Track elapsed time
26+
ELAPSED_TIME=0
27+
28+
# Check periodically if the command has completed
29+
while ps -p $COMMAND_PID > /dev/null; do
30+
sleep $CHECK_INTERVAL
31+
ELAPSED_TIME=$((ELAPSED_TIME + CHECK_INTERVAL))
32+
33+
# Run jcmd every ALERT_INTERVAL (60 seconds)
34+
if [ $((ELAPSED_TIME % ALERT_INTERVAL)) -eq 0 ]; then
35+
echo "Warning: The command has been running for more than $ELAPSED_TIME seconds."
36+
echo "\n\n----------------------------------------------------------------------------------------\n\n"
37+
38+
# Run the jcmd command to print thread information
39+
jcmd $(jps -v | grep SpockTestConfig.groovy | awk '{print $1}') Thread.print
40+
echo "\n\n----------------------------------------------------------------------------------------\n\n"
41+
fi
42+
done
43+
44+
# Capture the exit status
45+
wait $COMMAND_PID
46+
STATUS=$?
47+
48+
# Check if the command failed
49+
if [ $STATUS -ne 0 ]; then
50+
echo "The command failed with exit status $STATUS. Exiting loop."
51+
break
52+
fi
53+
54+
# Check if the retry limit has been reached
55+
if [ $COUNTER -ge $MAX_RETRIES ]; then
56+
echo "Reached the maximum number of retries ($MAX_RETRIES). Exiting."
57+
break
58+
fi
59+
done

0 commit comments

Comments
 (0)