From c24590c8e79953c61de684c5c000a7bba19f1ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Tue, 20 Aug 2024 20:20:18 +0200 Subject: [PATCH] DO NOT MERGE - Debug Script --- .github/workflows/branches-and-prs.yml | 69 ----------- .github/workflows/codeql-analysis.yml | 62 ---------- .github/workflows/debug-script.yml | 38 ++++++ .github/workflows/docs-pr.yml | 38 ------ .../workflows/gradle-wrapper-validation.yml | 10 -- .github/workflows/release.yml | 114 ------------------ repeatUntilFailure.sh | 59 +++++++++ 7 files changed, 97 insertions(+), 293 deletions(-) delete mode 100644 .github/workflows/branches-and-prs.yml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/debug-script.yml delete mode 100644 .github/workflows/docs-pr.yml delete mode 100644 .github/workflows/gradle-wrapper-validation.yml delete mode 100644 .github/workflows/release.yml create mode 100755 repeatUntilFailure.sh diff --git a/.github/workflows/branches-and-prs.yml b/.github/workflows/branches-and-prs.yml deleted file mode 100644 index 83c0753656..0000000000 --- a/.github/workflows/branches-and-prs.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: 'Verify Branches and PRs' - -on: - push: - branches-ignore: - - master - - gh-pages - pull_request: - merge_group: - -# https://stackoverflow.com/a/72408109/16358266 -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build-and-verify: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - variant: ['2.5', '3.0', '4.0'] - java: ['8', '11', '17', '21', '22'] - os: ['ubuntu-latest'] - exclude: - - variant: '2.5' - java: '17' - os: 'ubuntu-latest' - - variant: '2.5' - java: '21' - os: 'ubuntu-latest' - - variant: '2.5' - java: '22' - os: 'ubuntu-latest' - include: - - variant: '2.5' - java: '8' - os: 'windows-latest' - - variant: '3.0' - java: '8' - os: 'windows-latest' - - variant: '4.0' - java: '8' - os: 'windows-latest' - - variant: '2.5' - java: '8' - os: 'macos-latest' - - variant: '3.0' - java: '8' - os: 'macos-latest' - - variant: '4.0' - java: '8' - os: 'macos-latest' - steps: - - uses: actions/checkout@v4 - with: - # Codecov needs fetch-depth > 1 - fetch-depth: 2 - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - with: - additional-java-version: ${{ matrix.java }} - - name: 'Build Spock' - # secrets are not injected for pull requests - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - run: ./gradlew --stacktrace ghActionsBuild "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" - - name: 'Upload to Codecov.io' - uses: codecov/codecov-action@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index a9d632bb86..0000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: "Code scanning - action" - -on: - push: - branches: - - '!dependabot/**' - pull_request: - merge_group: - schedule: - - cron: '0 15 * * 2' - -# https://stackoverflow.com/a/72408109/16358266 -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - CodeQL-Build: - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - variant: [ '2.5', '3.0', '4.0' ] - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Manually added: Install and setup JDK - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - # Override language selection by uncommenting this and choosing your languages - # with: - # languages: go, javascript, csharp, python, cpp, java - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below). - #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following - # three lines and modify them (or add more) to build your code if your - # project uses a compiled language - - #- run: | - # make bootstrap - # make release - - # Manually added: build - # we have to disable build cache for now as it seems to be necessary for the compiler to run during the build - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-the-codeql-workflow#no-code-found-during-the-build - - name: 'Build Spock Classes' - run: ./gradlew --stacktrace --no-build-cache testClasses "-Dvariant=${{ matrix.variant }}" - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/debug-script.yml b/.github/workflows/debug-script.yml new file mode 100644 index 0000000000..f40b1cc259 --- /dev/null +++ b/.github/workflows/debug-script.yml @@ -0,0 +1,38 @@ +name: 'Debug Script' + +on: + push: + branches-ignore: + - master + - gh-pages + pull_request: + merge_group: + +# https://stackoverflow.com/a/72408109/16358266 +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-and-verify: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + variant: ['3.0', '4.0'] + java: ['21', '22'] + os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] + steps: + - uses: actions/checkout@v4 + with: + # Codecov needs fetch-depth > 1 + fetch-depth: 2 + - name: 'Set up JDKs' + uses: ./.github/actions/setup-build-env + with: + additional-java-version: ${{ matrix.java }} + - name: 'Build Spock' + # secrets are not injected for pull requests + env: + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + run: ./repeatUntilFailure.sh ./gradlew --stacktrace :spock-specs:test --rerun "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml deleted file mode 100644 index 518b745d9d..0000000000 --- a/.github/workflows/docs-pr.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: 'Verify Docs' - -on: - push: - branches-ignore: - - master - - gh-pages - pull_request: - merge_group: - -# https://stackoverflow.com/a/72408109/16358266 -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - docs-and-javadoc: - runs-on: 'ubuntu-latest' - steps: - - uses: actions/checkout@v4 - with: - # Codecov needs fetch-depth > 1 - fetch-depth: 2 - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - with: - additional-java-version: 21 - - name: 'Install GraphViz' - run: sudo apt update && sudo apt install --yes graphviz - - name: 'Build Docs' - run: ./gradlew --stacktrace asciidoctor javadoc "-Dvariant=4.0" "-DjavaVersion=21" - - name: 'Archive and upload docs' - uses: actions/upload-artifact@v4 - with: - name: docs - path: | - build/docs/** - build/javadoc/** diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index a95413f88c..0000000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: "Validate Gradle Wrapper" -on: [push, pull_request, merge_group] - -jobs: - validation: - name: "Validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 75b7dd4bf2..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: 'Build and Release Spock' - -on: - push: - branches: - - master - tags: - - 'spock-*' - -jobs: - build-and-verify: - runs-on: ${{ matrix.os }} - if: github.repository == 'spockframework/spock' - strategy: - fail-fast: false - matrix: - variant: ['2.5', '3.0', '4.0'] - java: [ '8', '11', '17', '21', '22' ] - os: [ 'ubuntu-latest' ] - exclude: - - variant: '2.5' - java: '17' - os: 'ubuntu-latest' - - variant: '2.5' - java: '21' - os: 'ubuntu-latest' - - variant: '2.5' - java: '22' - os: 'ubuntu-latest' - include: - - variant: '2.5' - java: '8' - os: 'windows-latest' - - variant: '3.0' - java: '8' - os: 'windows-latest' - - variant: '4.0' - java: '8' - os: 'windows-latest' - - variant: '2.5' - java: '8' - os: 'macos-latest' - - variant: '3.0' - java: '8' - os: 'macos-latest' - - variant: '4.0' - java: '8' - os: 'macos-latest' - steps: - - uses: actions/checkout@v4 - with: - # Codecov needs fetch-depth > 1 - fetch-depth: 2 - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - with: - additional-java-version: ${{ matrix.java }} - - name: 'Build Spock' - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - run: ./gradlew --stacktrace ghActionsBuild "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-build" - - name: 'Stop Daemon' - run: | - ./gradlew --stop - - name: 'Upload to Codecov.io' - uses: codecov/codecov-action@v4 - - release-spock: - runs-on: ${{ matrix.os }} - needs: [ 'build-and-verify' ] - strategy: - matrix: - os: [ 'ubuntu-latest' ] - variant: [ '2.5', '3.0', '4.0' ] # publish needs to be done for all versions - java: [ '8' ] # publish needs the min supported java version - steps: - - uses: actions/checkout@v4 - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - with: - additional-java-version: ${{ matrix.java }} - - name: 'Publish Spock' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONATYPE_OSS_USER: ${{ secrets.SONATYPE_OSS_USER }} - SONATYPE_OSS_PASSWORD: ${{ secrets.SONATYPE_OSS_PASSWORD }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_GPG_PASSWORD }} - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - run: ./gradlew --no-parallel --stacktrace ghActionsPublish "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-publish" - - publish-release-docs: - runs-on: ${{ matrix.os }} - needs: ['release-spock'] - strategy: - matrix: - os: ['ubuntu-latest'] - variant: ['4.0'] # docs need the highest variant - java: ['21'] # docs need the highest java version - steps: - - uses: actions/checkout@v4 - - name: 'Set up JDKs' - uses: ./.github/actions/setup-build-env - with: - additional-java-version: ${{ matrix.java }} - - name: 'Create Temporary Branch' - run: | - git checkout -b "docs-$GITHUB_SHA" - - name: Install GraphViz - run: sudo apt update && sudo apt install --yes graphviz - - name: 'Publish Docs' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - run: ./gradlew --no-parallel --stacktrace ghActionsDocs "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-docs" diff --git a/repeatUntilFailure.sh b/repeatUntilFailure.sh new file mode 100755 index 0000000000..1fba2ee12b --- /dev/null +++ b/repeatUntilFailure.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Ensure that a command is provided as an argument +if [ $# -eq 0 ]; then + echo "No command provided. Usage: ./run_until_fail.sh " + exit 1 +fi + +# Command to run (passed as script arguments) +COMMAND="$@" +MAX_RETRIES=10 # Set the maximum number of retries +COUNTER=0 # Initialize the retry counter +CHECK_INTERVAL=5 # Interval in seconds to check if the command is still running + +while [ $COUNTER -lt $MAX_RETRIES ]; do + # Increment the retry counter + COUNTER=$((COUNTER + 1)) + echo "Attempt $COUNTER of $MAX_RETRIES..." + + # Start the command in the background + bash -c "$COMMAND" & + COMMAND_PID=$! + + # Track elapsed time + ELAPSED_TIME=0 + + # Check periodically if the command has completed + while ps -p $COMMAND_PID > /dev/null; do + sleep $CHECK_INTERVAL + ELAPSED_TIME=$((ELAPSED_TIME + CHECK_INTERVAL)) + + if [ $ELAPSED_TIME -ge 60 ]; then + echo "Warning: The command has been running for more than 1 minute." + + # Run the jcmd command to print thread information + jcmd $(jps -v | grep SpockTestConfig.groovy | awk '{print $1}') Thread.print + + # Wait for the command to complete + wait $COMMAND_PID + break + fi + done + + # Capture the exit status + wait $COMMAND_PID + STATUS=$? + + # Check if the command failed + if [ $STATUS -ne 0 ]; then + echo "The command failed with exit status $STATUS. Exiting loop." + break + fi + + # Check if the retry limit has been reached + if [ $COUNTER -ge $MAX_RETRIES ]; then + echo "Reached the maximum number of retries ($MAX_RETRIES). Exiting." + break + fi +done