Skip to content

Commit 7138118

Browse files
committed
Improve build CI to try cleaning cache and retrying upon failure.
1 parent 1079281 commit 7138118

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/ci.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,20 @@ jobs:
4545
${{ runner.os }}-cargo-
4646
4747
- name: Run tests
48-
run: make test
48+
run: |
49+
# First attempt
50+
if ! make test; then
51+
# Check if the error matches the pattern indicating a cache issue
52+
if [[ $? -eq 2 ]] && [[ $(cat /tmp/test_output 2>&1) =~ "unknown revision" ]]; then
53+
echo "Tests failed with cache-related error. Cleaning Go cache and retrying..."
54+
go clean -cache -modcache
55+
# Second attempt after cleaning cache
56+
make test
57+
else
58+
# If it failed for a different reason, exit with the original error
59+
exit 1
60+
fi
61+
fi
4962
env:
5063
TARGETPLATFORM: linux/amd64
5164

0 commit comments

Comments
 (0)