Skip to content

Commit

Permalink
Attempting to fix the Travis CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
kigster committed Aug 4, 2020
1 parent 3400581 commit 4837537
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ after_script:
env:
global:
- CI=true
- SCREEN_WIDTH=70
- RBENV_ROOT="${HOME}/.rbenv"
- BUNDLE_PATH="${HOME}/.bundle/gems"
- PATH="${HOME}/.rbenv/bin:${HOME}/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:/opt/local/bin:${PATH}"
- BAZEL_OPTS="--host_jvm_args=-Xmx1200m --host_jvm_args=-Xms1200m"
Expand Down
60 changes: 54 additions & 6 deletions bin/setup-linux
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,62 @@
# https://github.com/kigster/bashmatic
#
# The framework is pretty light-weight, and is installed in your $HOME/.bashmatic folder.
# You can safely remove that folder after the setup if you wish, although re-running the
# You can safely remove that folder after the setup if you wish, although re-running the
# setup will re-install it.
# —————————————————————————————————————————————————————————————————————————————————————

set -e
source "bin/deps"

setup.linux.bazel() {
run "sudo apt update -y || true"
run "sudo apt-get install -y libreadline-dev zlib1g-dev"
run "sudo curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-linux-amd64"
run "sudo chmod +x /usr/bin/bazel"
}

setup.linux.rbenv() {
local rbenv_home="${HOME}/.rbenv"
local ruby_version="$(cat .ruby-version | tr -d '\n')"

if [[ -n $(command -v ruby) ]]; then
local installed_version="$(ruby -e 'puts RUBY_VERSION' | tr -d '\n')"
if [[ ${installed_version} == ${ruby_version} ]]; then
info "Linux installation already has RUBY version ${bldylw}${ruby_version}"
return 0
fi
fi

run "sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev"

[[ -d "${rbenv_home}" ]] || run "git clone https://github.com/rbenv/rbenv.git ${rbenv_home}"

export PATH="${rbenv_home}/bin:${PATH}"
command -v rbenv || {
echo "Can't find rbenv in the PATH?"
echo "PATH=${PATH}"
echo "which rbvenv: $(which rbenv)"
exit 1
}

# see if we even need to install anything:
local ruby_sdk_marker="$(rbenv versions | grep "${ruby_version}" | cut -d ' ' -f 1)"
if [[ ${ruby_sdk_marker} == "*" ]]; then
info "Ruby Version ${ruby_version} is already present, and is RBENV default."
info "Skipping the rest of RBENV setup."
return 0
fi

eval "$(rbenv init -)"
run "mkdir -p ${rbenv_home}/plugins"
run "git clone https://github.com/rbenv/ruby-build.git ${rbenv_home}/plugins/ruby-build"
run "rbenv rehash"
hash -r

run "rbenv install -s ${ruby_version}"
run "rbenv global ${ruby_version}"
}

setup.linux() {
[[ -n $(command -v rvm) ]] && {
run "rvm implode --force"
Expand All @@ -19,9 +68,8 @@ setup.linux() {

[[ -f ${HOME}/.bazelrc ]] || run "cp -v .circleci/.bazelrc ${HOME}"

run "sudo apt update -y || true"
run "sudo apt-get install -y libreadline-dev zlib1g-dev"
run "sudo curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-linux-amd64"
run "sudo chmod +x /usr/bin/bazel"
}
run.set-all abort-on-error

setup.linux.bazel
setup.linux.rbenv
}
22 changes: 13 additions & 9 deletions bin/show-env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
#
# vim: ft=bash
# When run, shows current runtime environment, locations of Ruby, Bazel,
# python, etc.
#
Expand All @@ -10,11 +10,10 @@
# https://github.com/kigster/bashmatic
#
# The framework is pretty light-weight, and is installed in your $HOME/.bashmatic folder.
# You can safely remove that folder after the setup if you wish, although re-running the
# You can safely remove that folder after the setup if you wish, although re-running the
# setup will re-install it.
# —————————————————————————————————————————————————————————————————————————————————————


set -e
[[ -x bin/deps ]] && source "bin/deps"

Expand All @@ -23,7 +22,7 @@ function setup.table-rows() {
local value="$2"
#$value="$(printf "%s" "${value}" | head -1 | tr -C -d '[:digit:][:punct:]' | sed 's/([0-9]+.[0-9]+.[0+9]+)//g;s/[()]/-/g')"
value="$(printf "%s" "${value}" | head -1 | cut -b -40)"
printf "${bldylw}%12.12s : ${bldblu}%40.40s | ${txtpur}%s\n${clr}" "$1" "${value}" "$3"
printf "${bldylw}%10.10s : ${bldblu}%40.40s | ${txtpur}%s\n${clr}" "$1" "${value}" "$3"

}

Expand All @@ -35,15 +34,20 @@ function setup.print-versions() {
echo
setup.table-rows 'Bazel' "$(bazel --version)" "$(command -v bazel)"
setup.table-rows 'Bazelisk' "${bazelisk_version}"
setup.table-rows 'Python ' "$(python --version 2>&1)" "$(command -v python) -> $(readlink "$(command -v python)")"
setup.table-rows 'Python2' "$(python2 --version 2>&1)" "$(command -v python2)"
setup.table-rows 'Python3' "$(python3 --version 2>&1)" "$(command -v python3)"
setup.table-rows 'Ruby' "$(ruby --version | sed -E 's/p[0-9]+.*$//g' 2>&1)" "$(command -v ruby)"
setup.table-rows 'BASH' "$(bash --version 2>/dev/null | tr -d ',')" "$(command -v bash)"
setup.table-rows 'CC' "$(cc --version 2>/dev/null)" "$(cc --version | grep clang)"
setup.table-rows 'GO' "$(go version 2>/dev/null)" "$(command -v go)"
set -e
hr
setup.table-rows 'Ruby' "$(ruby --version | sed -E 's/p[0-9]+.*$//g' 2>&1)" "$(command -v ruby)"
setup.table-rows 'RBENV' "$(rbenv --version 2>/dev/null)" "$(command -v rbenv)"
setup.table-rows 'RUBIES' " " "$(rbenv versions 2>/dev/null | sed 's/ (.*//g; s/[ \*]//g' | tr '\n' '|')"
hr
setup.table-rows 'Python' "$(python --version 2>&1)" "$(command -v python) -> $(readlink "$(command -v python)")"
setup.table-rows 'Python2' "$(python2 --version 2>&1)" "$(command -v python2)"
setup.table-rows 'Python3' "$(python3 --version 2>&1)" "$(command -v python3)"
hr
set -e

echo
}

Expand Down
2 changes: 1 addition & 1 deletion ruby/private/rspec.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def ruby_rspec(
rspec_gems = ["%s:%s" % (bundle, gem) for gem in DEFAULT_RSPEC_GEMS]

deps += rspec_gems
deps += ["%s:bin" % bundle]
deps.append("%s:bin" % bundle)

ruby_rspec_test(
name = name,
Expand Down

0 comments on commit 4837537

Please sign in to comment.