1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Refactor .travis.yml by introducing travis_retry.sh

Not using official travis_retry.bash, because it's not supporting to
modify backoff seconds.
0ad8f1886b/lib/travis/build/bash/travis_retry.bash

Not using official `travis_apt_get_update` function because it does not
propagate exit status to be used by retries.
0ad8f1886b/lib/travis/build/bash/travis_apt_get_update.bash

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Takashi Kokubun 2019-08-07 21:47:03 +09:00
parent e6901cea74
commit 330e3f19c3
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 66 additions and 79 deletions

View file

@ -88,16 +88,10 @@ env:
# sources: # sources:
# - ubuntu-toolchain-r-test # - ubuntu-toolchain-r-test
before_install: before_install:
- tool/travis_retry.sh sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq"
- |- - |-
for seconds in 1 25 100 -1; do tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break
sleep "$seconds" || exit 1
done
- |-
for seconds in 1 25 100 -1; do
travis_apt_get_update
sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
gcc-8 \ gcc-8 \
libffi-dev \ libffi-dev \
libgdbm-dev \ libgdbm-dev \
@ -110,27 +104,21 @@ env:
libyaml-dev \ libyaml-dev \
openssl \ openssl \
valgrind \ valgrind \
zlib1g-dev \ zlib1g-dev
&& break
sleep "$seconds" || exit 1
done
- &clang-8 - &clang-8
compiler: clang-8 compiler: clang-8
addons: addons:
apt: apt:
config: # Not doing this manually unlike other sources, because it has been stable.
retries: true
sources: sources:
- llvm-toolchain-xenial-8 - llvm-toolchain-xenial-8
# `packages` are installed in `before_install` for retries. config:
retries: true
before_install: before_install:
- tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq"
- |- - |-
for seconds in 1 25 100 -1; do tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
travis_apt_get_update
sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
clang-8 \ clang-8 \
llvm-8-tools \ llvm-8-tools \
libffi-dev \ libffi-dev \
@ -144,11 +132,7 @@ env:
libyaml-dev \ libyaml-dev \
openssl \ openssl \
valgrind \ valgrind \
zlib1g-dev \ zlib1g-dev
&& break
sleep "$seconds" || exit 1
done
# -------- # --------
@ -290,16 +274,10 @@ env:
# sources: # sources:
# - ubuntu-toolchain-r-test # - ubuntu-toolchain-r-test
before_install: before_install:
- tool/travis_retry.sh sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq"
- |- - |-
for seconds in 1 25 100 -1; do tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break
sleep "$seconds" || exit 1
done
- |-
for seconds in 1 25 100 -1; do
travis_apt_get_update
sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
gcc-8-multilib \ gcc-8-multilib \
libffi-dev:i386 \ libffi-dev:i386 \
libffi6:i386 \ libffi6:i386 \
@ -314,11 +292,7 @@ env:
libssl1.0.0:i386 \ libssl1.0.0:i386 \
linux-libc-dev:i386 \ linux-libc-dev:i386 \
zlib1g-dev:i386 \ zlib1g-dev:i386 \
zlib1g:i386 \ zlib1g:i386
&& break
sleep "$seconds" || exit 1
done
- &pedanticism - &pedanticism
name: -std=c99 -pedantic name: -std=c99 -pedantic

13
tool/travis_retry.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh -eu
# The modified version of `travis_retry` to support custom backoffs, which is used by .travis.yml.
# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash
for sleep in 0 ${WAITS:- 1 25 100}; do
sleep "$sleep"
echo "+ $@"
if "$@"; then
exit 0
fi
done
exit 1