Skip to content
Merged
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
22 changes: 21 additions & 1 deletion .github/scripts/install-playwright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# The dependency dry run uses the pinned driver's package list without updating apt.
set -euo pipefail

# A healthy apt install takes under a minute. A stalled mirror download otherwise holds the
# install, and with it the whole suite step's budget, with no output: apt's inactivity timeout
# misses a download that trickles. Each retry resumes apt's partial downloads.
DEPS_ATTEMPT_SECONDS=120
DEPS_ATTEMPTS=3

browsers=()
for argument in "$@"; do
case "$argument" in
Expand All @@ -11,6 +17,20 @@ for argument in "$@"; do
done

if ! bunx --no-install playwright install-deps --dry-run "${browsers[@]}"; then
bunx --no-install playwright install-deps "${browsers[@]}"
for attempt in $(seq "$DEPS_ATTEMPTS"); do
if timeout --kill-after=15 "$DEPS_ATTEMPT_SECONDS" \
bunx --no-install playwright install-deps "${browsers[@]}"; then
break
fi
if [ "$attempt" -eq "$DEPS_ATTEMPTS" ]; then
echo "::error::Browser system packages did not install in $DEPS_ATTEMPTS attempts." >&2
exit 1
fi
echo "Browser system package install attempt $attempt failed or stalled; retrying." >&2
# An attempt cut off while dpkg was unpacking leaves it interrupted, which blocks the retry.
if ! timeout --kill-after=15 "$DEPS_ATTEMPT_SECONDS" sudo dpkg --configure -a; then
echo "Browser system package recovery failed or stalled; retrying anyway." >&2
fi
done
fi
exec bunx --no-install playwright install "$@"
Loading