From 81bcef3c39299000d56519893382de9988e5345d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 6 Aug 2024 02:11:40 -0400 Subject: [PATCH] CI: Fix retry action (#306) Co-authored-by: Mathieu Scheltienne --- .github/actions/retry-step/action.yaml | 8 +++++--- .github/workflows/pytest.yaml | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/actions/retry-step/action.yaml b/.github/actions/retry-step/action.yaml index b6dbc68be..21760229e 100644 --- a/.github/actions/retry-step/action.yaml +++ b/.github/actions/retry-step/action.yaml @@ -10,8 +10,7 @@ inputs: default: "3" retry_error_codes: description: "The error code on which to trigger a retry." - required: false - default: "134,139" + required: true command_between_retries: description: "A command to run between retries." required: false @@ -23,6 +22,7 @@ runs: id: retry shell: bash run: | + set -eo pipefail command="${{ inputs.command }}" max_attempts=${{ inputs.max_attempts }} retry_error_codes=${{ inputs.retry_error_codes }} @@ -33,8 +33,10 @@ runs: until [ $attempt -gt $max_attempts ] do - (eval $command) + set +e + eval $command exit_code=$? + set -e retry=false for code in "${retry_codes[@]}"; do diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index cb78a301c..0a593fbda 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -42,6 +42,7 @@ jobs: uses: ./.github/actions/retry-step with: command: pytest mne_lsl --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s + retry_error_codes: "3,134,139" env: MNE_LSL_LOG_LEVEL: DEBUG - name: Upload to codecov @@ -90,6 +91,7 @@ jobs: uses: ./.github/actions/retry-step with: command: pytest mne_lsl --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s + retry_error_codes: "3,134,139" env: MNE_LSL_LOG_LEVEL: DEBUG - name: Upload to codecov @@ -138,6 +140,7 @@ jobs: uses: ./.github/actions/retry-step with: command: pytest mne_lsl --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s + retry_error_codes: "3,134,139" env: MNE_LSL_LOG_LEVEL: DEBUG - name: Upload to codecov