Skip to content

Commit

Permalink
traivs: add rosie dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jun 13, 2019
1 parent 481428d commit e918e71
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: "Test Battery"
before_install:
- export PATH="$PWD/.travis:$PATH"
- now install coverage cylc fcm rose tut_suite
- now install coverage cylc fcm rose rosie tut_suite
script:
- now test battery

Expand Down
72 changes: 59 additions & 13 deletions .travis/now
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ fi
set -eu

APT=()
PIP=()
NPM=()
PIP=()
GIT=()
PY_PATH=()
RC_PATH=("${HOME}")
ROSE_INIT=()
WANDISCO=false

_join () {
local IFS="$1";
Expand All @@ -54,6 +57,35 @@ _build_docs () {
rose make-docs --strict clean html slides latexpdf
}

_gh_extract () { # extract project from GitHub to $HOME
IFS='|' read -ra SPEC <<< "$1"
local USR="${SPEC[0]}"
local REPO="${SPEC[1]}"
local BRANCH="${SPEC[2]}"
local URL="https://github.com/${USR}/${REPO}/archive/${BRANCH}.tar.gz"
local DEST="${HOME}/${REPO}-${BRANCH}"

if [[ -d "${DEST}" ]]; then
# already installed
return
fi

# download + unpack
wget "${URL}" -O - | tar -xz -C "${HOME}"

# in-place installation
if [[ -f "${DEST}/setup.py" ]]; then
pip install -e "${DEST}"
fi
}

_wandisco_configure () { # extract Wandisco stuff
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu \
`lsb_release -cs` svn19" >> /etc/apt/sources.list.d/subversion19.list'
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | \
sudo apt-key add -
}

_install_coverage () {
export COVERAGE_PROCESS_START="${TRAVIS_BUILD_DIR}/.coveragerc"
PIP+=(coverage pytest-cov)
Expand All @@ -66,26 +98,24 @@ _install_rose () {
RC_PATH+=("${TRAVIS_BUILD_DIR}/bin")
}

_install_rosie () {
PIP+=(requests tornado sqlalchemy)
# shellcheck disable=SC2016
ROSE_INIT+=('if [[ -z ${HOME+x} ]]; then . "'"${HOME}"'/.bashrc"; fi')
}

_install_cylc () {
wget 'https://github.com/cylc/cylc-flow/archive/master.tar.gz' \
-O - | tar -xz -C "${HOME}"
pip install -e "${HOME}/cylc-flow-master"
APT+=(at heirloom-mailx)
PIP+=(colorama python-jose pyzmq Jinja2)
GIT+=('cylc|cylc-flow|master')
RC_PATH+=("${HOME}/cylc-master/bin")
}

_install_fcm () {
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu \
`lsb_release -cs` svn19" >> /etc/apt/sources.list.d/subversion19.list'
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | \
sudo apt-key add -
wget 'https://github.com/metomi/fcm/archive/master.tar.gz' \
-O '/tmp/fcm-master.tar.gz'
tar -xvf '/tmp/fcm-master.tar.gz' -C "${HOME}"
APT+=(subversion build-essential gfortran libxml-parser-perl \
libconfig-inifiles-perl libdbi-perl libdbd-sqlite3-perl)
GIT+=('metomi|fcm|master')
RC_PATH+=("${HOME}/fcm-master/bin")
WANDISCO=true
}

_install_sphinx () {
Expand All @@ -106,8 +136,8 @@ _install_pytest () {
}

_install_linters () {
PIP+=(pycodestyle)
NPM+=(eslint)
PIP+=(pycodestyle)
}

_test_units () {
Expand Down Expand Up @@ -140,6 +170,10 @@ install () {
"_install_${arg}"
done

if ${WANDISCO}; then
_wandisco_configure
fi

if [[ ${#PIP[@]} -gt 0 ]]; then
pip install "${PIP[@]}" &
fi
Expand All @@ -153,12 +187,24 @@ install () {
sudo apt-get install -y "${APT[@]}"
fi

if [[ ${#GIT[@]} -gt 0 ]]; then
# wrapping the for loop to avoid unbound variable "GIT[@]" error
for gh_project in "${GIT[@]}"; do
_gh_extract "${gh_project}"
done
fi

wait

cat >"${HOME}/.bashrc" \
<<<"export PATH=\"$(_join ':' "${RC_PATH[@]}"):\$PATH\";"
cat >>"${HOME}/.bashrc" \
<<<"export PYTHONPATH=\"$(_join ':' "${PY_PATH[@]}"):\$PYTHONPATH\";"
cat >"${TRAVIS_BUILD_DIR}/lib/bash/rose_init_site" \
<<<"$(_join '; ' "${ROSE_INIT[@]}")"
# TODO: remove debug line
cat "${TRAVIS_BUILD_DIR}/lib/bash/rose_init_site"
}
report_coverage () {
Expand Down

0 comments on commit e918e71

Please sign in to comment.