Skip to content

Add retry to running demo projects for macOs platforms in CI #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/other/retry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ for ((attempt=0; attempt<limit; attempt++)); do
if "$@"; then
# Command succeeded, exit the loop
echo "Done."
break
# Exit with success status code.
exit 0
fi

# Calculate the sleep duration using the retry interval from the array
Expand All @@ -26,3 +27,7 @@ for ((attempt=0; attempt<limit; attempt++)); do
echo "Retry #$attempt in $sleepDuration seconds..."
sleep "$sleepDuration"
done

echo "Failed to execute command '$1'."
# Exit with an error code.
exit 1
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,20 @@ jobs:
include:
# macOS

# macOS builds fail semi-randomly with an `libc++abi: Pure virtual function called!` error.
# For now on run them with retry; resort to compiling only if it won't be enough (i.e. first time when it will fail three times in the row).
# See: https://github.com/godot-rust/demo-projects/issues/12
- name: macos-x86
os: macos-13
artifact-name: macos-x86-nightly
godot-binary: godot.macos.editor.dev.x86_64
retry: true

- name: macos-arm
os: macos-latest
artifact-name: macos-arm-nightly
godot-binary: godot.macos.editor.dev.arm64
retry: true

# Windows

Expand Down Expand Up @@ -214,17 +219,25 @@ jobs:
run: cargo build --release ${{ matrix.rust-extra-args }}

- name: "Run examples for short time"
env:
RETRY: ${{ matrix.retry }}
run: |
# Enable extended globbing to allow pattern exclusion.
shopt -s extglob

# Match all directories/files except `target` and any starting with `.`.
files='!(target|.*)/'

if [[ $RETRY == "true" ]]; then
# macOS – retry running demo projects several times on fail.
echo "Running examples with retry"
RETRY_CMD="./.github/other/retry.sh"
else
RETRY_CMD=""
fi
# List all folders in current directory. Don't quote $files variable.
for demo in $files; do
# Strip trailing '/' from folder name.
./.github/other/check-example.sh "${demo%/}"
$RETRY_CMD ./.github/other/check-example.sh "${demo%/}"
done


Expand Down
Loading