Skip to content

Commit 9924b46

Browse files
authored
Merge pull request #11 from Yarwin/allow-macos-pipeline-to-fail
Add retry to running demo projects for macOs platforms in CI
2 parents a5f1404 + 7d8c2ff commit 9924b46

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

.github/other/retry.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ for ((attempt=0; attempt<limit; attempt++)); do
1515
if "$@"; then
1616
# Command succeeded, exit the loop
1717
echo "Done."
18-
break
18+
# Exit with success status code.
19+
exit 0
1920
fi
2021

2122
# Calculate the sleep duration using the retry interval from the array
@@ -26,3 +27,7 @@ for ((attempt=0; attempt<limit; attempt++)); do
2627
echo "Retry #$attempt in $sleepDuration seconds..."
2728
sleep "$sleepDuration"
2829
done
30+
31+
echo "Failed to execute command '$1'."
32+
# Exit with an error code.
33+
exit 1

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,20 @@ jobs:
151151
include:
152152
# macOS
153153

154+
# macOS builds fail semi-randomly with an `libc++abi: Pure virtual function called!` error.
155+
# 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).
156+
# See: https://github.com/godot-rust/demo-projects/issues/12
154157
- name: macos-x86
155158
os: macos-13
156159
artifact-name: macos-x86-nightly
157160
godot-binary: godot.macos.editor.dev.x86_64
161+
retry: true
158162

159163
- name: macos-arm
160164
os: macos-latest
161165
artifact-name: macos-arm-nightly
162166
godot-binary: godot.macos.editor.dev.arm64
167+
retry: true
163168

164169
# Windows
165170

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

216221
- name: "Run examples for short time"
222+
env:
223+
RETRY: ${{ matrix.retry }}
217224
run: |
218225
# Enable extended globbing to allow pattern exclusion.
219226
shopt -s extglob
220227
221228
# Match all directories/files except `target` and any starting with `.`.
222229
files='!(target|.*)/'
223-
230+
if [[ $RETRY == "true" ]]; then
231+
# macOS – retry running demo projects several times on fail.
232+
echo "Running examples with retry"
233+
RETRY_CMD="./.github/other/retry.sh"
234+
else
235+
RETRY_CMD=""
236+
fi
224237
# List all folders in current directory. Don't quote $files variable.
225238
for demo in $files; do
226239
# Strip trailing '/' from folder name.
227-
./.github/other/check-example.sh "${demo%/}"
240+
$RETRY_CMD ./.github/other/check-example.sh "${demo%/}"
228241
done
229242
230243

0 commit comments

Comments
 (0)