Skip to content

Commit c24590c

Browse files
committed
DO NOT MERGE - Debug Script
1 parent 58ec2e7 commit c24590c

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+
15+
while [ $COUNTER -lt $MAX_RETRIES ]; do
16+
# Increment the retry counter
17+
COUNTER=$((COUNTER + 1))
18+
echo "Attempt $COUNTER of $MAX_RETRIES..."
19+
20+
# Start the command in the background
21+
bash -c "$COMMAND" &
22+
COMMAND_PID=$!
23+
24+
# Track elapsed time
25+
ELAPSED_TIME=0
26+
27+
# Check periodically if the command has completed
28+
while ps -p $COMMAND_PID > /dev/null; do
29+
sleep $CHECK_INTERVAL
30+
ELAPSED_TIME=$((ELAPSED_TIME + CHECK_INTERVAL))
31+
32+
if [ $ELAPSED_TIME -ge 60 ]; then
33+
echo "Warning: The command has been running for more than 1 minute."
34+
35+
# Run the jcmd command to print thread information
36+
jcmd $(jps -v | grep SpockTestConfig.groovy | awk '{print $1}') Thread.print
37+
38+
# Wait for the command to complete
39+
wait $COMMAND_PID
40+
break
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)