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,67 +88,51 @@ env:
# sources:
# - ubuntu-toolchain-r-test
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
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 \
libffi-dev \
libgdbm-dev \
libgmp-dev \
libjemalloc-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline6-dev \
libssl-dev \
libyaml-dev \
openssl \
valgrind \
zlib1g-dev \
&& break
sleep "$seconds" || exit 1
done
tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
gcc-8 \
libffi-dev \
libgdbm-dev \
libgmp-dev \
libjemalloc-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline6-dev \
libssl-dev \
libyaml-dev \
openssl \
valgrind \
zlib1g-dev
- &clang-8
compiler: clang-8
addons:
apt:
config:
retries: true
# Not doing this manually unlike other sources, because it has been stable.
sources:
- llvm-toolchain-xenial-8
# `packages` are installed in `before_install` for retries.
config:
retries: true
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
travis_apt_get_update
sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
clang-8 \
llvm-8-tools \
libffi-dev \
libgdbm-dev \
libgmp-dev \
libjemalloc-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline6-dev \
libssl-dev \
libyaml-dev \
openssl \
valgrind \
zlib1g-dev \
&& break
sleep "$seconds" || exit 1
done
tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
clang-8 \
llvm-8-tools \
libffi-dev \
libgdbm-dev \
libgmp-dev \
libjemalloc-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline6-dev \
libssl-dev \
libyaml-dev \
openssl \
valgrind \
zlib1g-dev
# --------
@ -290,35 +274,25 @@ env:
# sources:
# - ubuntu-toolchain-r-test
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
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 \
libffi-dev:i386 \
libffi6:i386 \
libgdbm-dev:i386 \
libgdbm3:i386 \
libncurses5-dev:i386 \
libncurses5:i386 \
libncursesw5-dev:i386 \
libreadline6-dev:i386 \
libreadline6:i386 \
libssl-dev:i386 \
libssl1.0.0:i386 \
linux-libc-dev:i386 \
zlib1g-dev:i386 \
zlib1g:i386 \
&& break
sleep "$seconds" || exit 1
done
tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \
gcc-8-multilib \
libffi-dev:i386 \
libffi6:i386 \
libgdbm-dev:i386 \
libgdbm3:i386 \
libncurses5-dev:i386 \
libncurses5:i386 \
libncursesw5-dev:i386 \
libreadline6-dev:i386 \
libreadline6:i386 \
libssl-dev:i386 \
libssl1.0.0:i386 \
linux-libc-dev:i386 \
zlib1g-dev:i386 \
zlib1g:i386
- &pedanticism
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