From f9287cddd16f5e1b5aa41ceed35a6391f1dee090 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 12 Sep 2024 10:20:53 +0100 Subject: [PATCH] Add `run-retry` action to workaround `integtest` `gcovr` issue (#7507) * Add `run-retry` composite action to workaround `integtest` `gcovr` issue * Update ChangeLog * Add comment explaining retry --- .github/actions/run-retry/action.yml | 31 +++++++++++++++++++++++ .github/workflows/sonarcloud-analysis.yml | 5 +++- ChangeLog | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/actions/run-retry/action.yml diff --git a/.github/actions/run-retry/action.yml b/.github/actions/run-retry/action.yml new file mode 100644 index 000000000..8b9ce13cd --- /dev/null +++ b/.github/actions/run-retry/action.yml @@ -0,0 +1,31 @@ +name: "Retry command" +description: "Retries a specified command up to a specified number of times." +inputs: + run: + description: "The command to run" + required: true + retries: + description: "Number of retries" + required: false + default: 3 +runs: + using: "composite" + steps: + - name: Run Command with Retry + shell: bash + run: | + command="${{ inputs.run }}" + retries=${{ inputs.retries }} + delay=${{ inputs.delay }} + attempt=1 + + until $command; do + if [ $attempt -ge $retries ]; then + echo "Attempt $attempt failed! No more retries left." + exit 1 + fi + echo "Attempt $attempt failed! Retrying in $delay seconds..." + attempt=$((attempt + 1)) + done + + echo "Command succeeded on attempt $attempt." diff --git a/.github/workflows/sonarcloud-analysis.yml b/.github/workflows/sonarcloud-analysis.yml index 958d896fe..2b11d7d34 100644 --- a/.github/workflows/sonarcloud-analysis.yml +++ b/.github/workflows/sonarcloud-analysis.yml @@ -78,10 +78,13 @@ jobs: QT_QPA_PLATFORM: offscreen run: cmake --build build --target coverage-unittests + # Retry integtests coverae as gcovr intermittently fails to parse .gcda files. - name: Integration tests coverage env: QT_QPA_PLATFORM: offscreen - run: cmake --build build --target coverage-integtests + uses: ./.github/actions/run-retry + with: + run: cmake --build build --target coverage-integtests - name: Get coverage report paths id: coverage-paths diff --git a/ChangeLog b/ChangeLog index 3216711f3..d1e7e4fcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ Enhancements: - #7503 Make package filenames consistent with previous versions - #7505 Remove static link of libportal from Debian Trixie CI - #7506 Make `APPLE_CODESIGN_ID` env var optional for CE CI +- #7507 Add `run-retry` action to workaround `integtest` `gcovr` issue # 1.16.0