Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2129] make evm and cask setup more reliable in travis #2139

Merged
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cache:

env:
global:
- PATH=$HOME/local/bin:$PATH
- PATH=$HOME/local/bin:$HOME/local/evm/bin:$HOME/local/cask/bin:$PATH
matrix:
- EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test
- EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test-bytecomp
Expand All @@ -41,11 +41,11 @@ env:
- EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test-checks

before_script:
- sudo sh travis-ci/travis-gnutls.sh
- sh travis-ci/install-gnutls.sh
- gnutls-cli -v
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
- sh travis-ci/install-evm.sh
- evm install $EMACS_BINARY --use --skip
- make elpa
- sh travis-ci/install-cask.sh
script:
- emacs --version
- make $MAKE_TEST
Expand Down
33 changes: 33 additions & 0 deletions travis-ci/install-cask.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Install cask for Travis CI
# or if already installed, then check for updates

set -x

WORKDIR=${HOME}/local
CASKDIR=$WORKDIR/cask

. travis-ci/retry.sh

cask_upgrade_cask_or_reset() {
cask upgrade-cask || { rm -rf $HOME/.emacs.d/.cask && false; }
}

cask_install_or_reset() {
cask install || { rm -rf .cask && false; }
}

# Bootstrap the cask tool and its dependencies
if [ -d $CASKDIR ]
then
travis_retry cask_upgrade_cask_or_reset
else
git clone https://github.com/cask/cask.git $CASKDIR
travis_retry cask_upgrade_cask_or_reset
fi

# Install dependencies for cider as descriped in ./Cask
# Effect is identical to "make elpa", but here we can retry
# in the event of network failures.
travis_retry cask_install_or_reset && touch elpa-emacs
21 changes: 21 additions & 0 deletions travis-ci/install-evm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Install evm for Travis CI
# or if already installed, then check for updates

set -x

WORKDIR=${HOME}/local
EVMDIR=$WORKDIR/evm

. travis-ci/retry.sh

if [ -d $EVMDIR ]
then
cd $EVMDIR
git pull origin master
else
git clone https://github.com/rejeep/evm.git $EVMDIR
evm config path /tmp
travis_retry evm install emacs-24.3-travis --use --skip
fi
5 changes: 3 additions & 2 deletions travis-ci/travis-gnutls.sh → travis-ci/install-gnutls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ then
fi

# delete cache and rebuild
rm -rf $WORKDIR
mkdir $WORKDIR
rm -rf $WORKDIR/bin $WORKDIR/lib $WORKDIR/share $WORKDIR/include
rm -rf $WORKDIR/nettle* $WORKDIR/gnutls*

cd $WORKDIR
curl -O https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_VERSION}.tar.gz \
&& tar xfz nettle-${NETTLE_VERSION}.tar.gz \
Expand Down
27 changes: 27 additions & 0 deletions travis-ci/retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copied retry logic from Travis CI [http://bit.ly/2jPDCtV]

ANSI_RED="\033[31;1m"
ANSI_GREEN="\033[32;1m"
ANSI_RESET="\033[0m"
ANSI_CLEAR="\033[0K"

travis_retry() {
local result=0
local count=1
while [ $count -le 3 ]; do
[ $result -ne 0 ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
}
"$@"
result=$?
[ $result -eq 0 ] && break
count=$(($count + 1))
sleep 1
done

[ $count -gt 3 ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
}

return $result
}