File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,10 +68,15 @@ jobs:
6868 cp -r /tmp/wordpress-develop/tests/phpunit/* /tmp/wordpress-tests-lib/
6969
7070 if [ "${{ matrix.wp-version }}" = "latest" ]; then
71- wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz
71+ WP_URL=" https://wordpress.org/latest.tar.gz"
7272 else
73- wget -O /tmp/wordpress.tar.gz https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz
73+ WP_URL=" https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz"
7474 fi
75+ for i in 1 2 3 4 5; do
76+ wget -nv -O /tmp/wordpress.tar.gz "$WP_URL" && break
77+ echo "Download attempt $i failed, retrying in $((i * 15))s..."
78+ sleep $((i * 15))
79+ done
7580 tar -xzf /tmp/wordpress.tar.gz -C /tmp/
7681 }
7782
Original file line number Diff line number Diff line change @@ -18,11 +18,18 @@ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
1818WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR / wordpress}
1919
2020download () {
21- if [ ` which curl` ]; then
22- curl -s " $1 " > " $2 " ;
23- elif [ ` which wget` ]; then
24- wget -nv -O " $2 " " $1 "
25- fi
21+ local max_retries=5
22+ for i in $( seq 1 $max_retries ) ; do
23+ if [ ` which curl` ]; then
24+ curl -sSf --retry 3 --retry-delay 10 " $1 " > " $2 " && return 0
25+ elif [ ` which wget` ]; then
26+ wget -nv --tries=3 --waitretry=10 -O " $2 " " $1 " && return 0
27+ fi
28+ echo " Download attempt $i /$max_retries failed for $1 , retrying in $(( i * 15 )) s..."
29+ sleep $(( i * 15 ))
30+ done
31+ echo " All download attempts failed for $1 "
32+ return 1
2633}
2734
2835if [[ $WP_VERSION =~ ^[0-9]+\. [0-9]+\- (beta| RC)[0-9]+$ ]]; then
You can’t perform that action at this time.
0 commit comments