Skip to content

Instantly share code, notes, and snippets.

@PhilosopherRex
Forked from philiprhoades/maidsafe.sh
Last active January 9, 2016 22:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilosopherRex/b3581ac3cceff3a14b41 to your computer and use it in GitHub Desktop.
Save PhilosopherRex/b3581ac3cceff3a14b41 to your computer and use it in GitHub Desktop.
Script for pulling, building and testing MaidSafe code
#!/bin/bash
######################################## - USER DEFINITIONS
# if you use a proxy add it here otherwise leave blank
gitProxy=
# make sure there is a slash at the end of your installDir definition
installDir="/opt/safenet/src/"
# do you want to build and test? Leave blank if not
# show build and test output via "xterm" (windows),
# "roxterm" (tabs), or "logOnly" --> note case
buildTest="xterm"
######################################## - PROGRAM DEFINITIONS
safeRepo="https://github.com/maidsafe/"
libraries="crust routing maidsafe_client maidsafe_types maidsafe_vault maidsafe_nfs"
logDir="${installDir}logs/$(date +"%T")/"
######################################## - MAIN
if [ ${gitProxy} ]; then
http_proxy=${gitProxy} && HTTP_PROXY=$http_proxy
export http_proxy HTTP_PROXY
git config --global http.proxy $HTTP_PROXY
fi
[ ! -d ${installDir} ] && mkdir ${installDir} && cd ${installDir}
[ ! -d ${installDir}logs/ ] && mkdir ${installDir}logs/
mkdir ${logDir}
for library in $libraries; do
subFolder=${installDir}${library}
if [ ! -d ${subFolder} ]; then
git clone ${safeRepo}${1} |& tee -a ${logDir}cloning.log
cd ${subFolder}
else
cd ${subFolder}
git pull origin master |& tee -a ${logDir}updating.log
fi
cargo clean
export RUST_TEST_THREADS=1
[ ${buildTest} == "xterm" ] && xterm -hold -title ${library} -e "bash -c 'cargo build |& tee -a ${logDir}building-${library}.log; cargo test |& tee -a ${logDir}testing-${library}.log'" &
[ ${buildTest} == "roxterm" ] && roxterm --tab -f -n ${library} -e "bash -c 'cargo build |& tee -a ${logDir}building-${library}.log; cargo test |& tee -a ${logDir}testing-${library}.log'" &
[ ${buildTest} == "logOnly" ] && cargo build > ${logDir}building-${library}.log 2>&1; cargo test > ${logDir}testing-${library}.log 2>&1 &
done
exit 0
@PhilosopherRex
Copy link
Author

This version does logging + option to only pull and not to build and test.

@PhilosopherRex
Copy link
Author

updated to add cargo clean and "export RUST_TEST_THREADS=1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment