diff --git a/.github/workflows/audio.yml b/.github/workflows/audio.yml index f2d7d49e..fd7ec4a5 100644 --- a/.github/workflows/audio.yml +++ b/.github/workflows/audio.yml @@ -102,7 +102,16 @@ jobs: run: | # The man-db index rebuild after dpkg is slow on hosted runners. sudo rm -f /var/lib/man-db/auto-update - (sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends ffmpeg) > "$RUNNER_TEMP/apt.log" 2>&1 & + # A mirror can stall for most of the job's time limit, and the next try usually gets a good one. + install_ffmpeg() { + for attempt in 1 2 3; do + timeout -k 10 180 sudo sh -c 'apt-get update -qq && apt-get install -y -qq --no-install-recommends ffmpeg' && return 0 + echo "apt: attempt $attempt failed with exit code $?" + sudo dpkg --configure -a || true + done + return 1 + } + install_ffmpeg > "$RUNNER_TEMP/apt.log" 2>&1 & apt=$! cargo test -p craft-audio --all-features --locked --no-run wait "$apt" || { cat "$RUNNER_TEMP/apt.log"; exit 1; }