-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from fhasanaj/RCB_227
Rcb 227 - docker image to run examples, unit tests and generate gh-pages
- Loading branch information
Showing
429 changed files
with
107 additions
and
84,507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
0.5.1: first published version. | ||
0.5.2: refactored code and tests. | ||
0.5.3: change github repo for beta | ||
0.8.0: migration to github, added docker images for testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,52 @@ | ||
FROM python:2.7.11 | ||
FROM ubuntu:14.04 | ||
MAINTAINER Fiona Hasanaj | ||
|
||
# install necessary software | ||
RUN apt-get -y update && apt-get install -y vim && apt-get install -y git | ||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN locale-gen en_US.UTF-8 && /usr/sbin/update-locale LANG=en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
|
||
COPY run_python.sh /python/run_python.sh | ||
RUN chmod 755 /python/run_python.sh | ||
WORKDIR /python | ||
# proper init to handle signal propagation and zombie reaping | ||
ADD https://github.com/krallin/tini/releases/download/v0.8.4/tini /tini | ||
RUN chmod +x /tini | ||
ENTRYPOINT ["/tini", "--"] | ||
|
||
RUN apt-get update && \ | ||
apt-get -y install \ | ||
wget \ | ||
libssl-dev \ | ||
libffi-dev \ | ||
python-pip \ | ||
python-software-properties \ | ||
software-properties-common && \ | ||
add-apt-repository -y ppa:fkrull/deadsnakes && \ | ||
apt-get update && \ | ||
apt-get -y install \ | ||
python2.6 \ | ||
python2.7 \ | ||
python3.3 \ | ||
python3.4 \ | ||
python3.5 \ | ||
git\ | ||
pypy && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
RUN mkdir /install && \ | ||
wget -O /install/pypy3-2.4-linux_x86_64-portable.tar.bz2 \ | ||
"https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3-2.4-linux_x86_64-portable.tar.bz2" && \ | ||
tar jxf /install/pypy3-*.tar.bz2 -C /install && \ | ||
rm /install/pypy3-*.tar.bz2 && \ | ||
ln -s /install/pypy3-*/bin/pypy3 /usr/local/bin/pypy3 | ||
|
||
RUN pip install -U pip && pip install tox | ||
|
||
# copy over the necessary files | ||
COPY run_python.sh /python-dev/run_python.sh | ||
RUN chmod 755 /python-dev/run_python.sh | ||
COPY tox.ini /python-dev/tox.ini | ||
WORKDIR /python-dev | ||
|
||
# allow interactive bash inside docker container | ||
CMD ./run_python.sh $API_KEY $ALT_URL | ||
CMD ./run_python.sh $API_KEY $FILENAME $ALT_URL $GIT_USERNAME $VERSION | ||
|
||
VOLUME ["/source"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,17 @@ | |
#Gets called when the user doesn't provide any args | ||
function HELP { | ||
echo -e "\nusage: source_file.py --key API_KEY [--url ALT_URL]" | ||
echo " API_KEY - Rosette API key (required)" | ||
echo " FILENAME - Python source file (optional)" | ||
echo " ALT_URL - Alternate service URL (optional)" | ||
echo "Compiles and runs the source file(s) using the published rosette-api" | ||
echo " API_KEY - Rosette API key (required)" | ||
echo " FILENAME - Python source file (optional)" | ||
echo " ALT_URL - Alternate service URL (optional)" | ||
echo " GIT_USERNAME - Git username where you would like to push regenerated gh-pages (optional)" | ||
echo " VERSION - Build version (optional)" | ||
echo "Compiles and runs the source file(s) using the local development source." | ||
exit 1 | ||
} | ||
|
||
#Gets API_KEY, FILENAME and ALT_URL if present | ||
while getopts ":API_KEY:FILENAME:ALT_URL" arg; do | ||
while getopts ":API_KEY:FILENAME:ALT_URL:GIT_USERNAME:VERSION" arg; do | ||
case "${arg}" in | ||
API_KEY) | ||
API_KEY=${OPTARG} | ||
|
@@ -25,6 +27,14 @@ while getopts ":API_KEY:FILENAME:ALT_URL" arg; do | |
FILENAME=${OPTARG} | ||
usage | ||
;; | ||
GIT_USERNAME) | ||
GIT_USERNAME=${OPTARG} | ||
usage | ||
;; | ||
VERSION) | ||
VERSION={OPTARG} | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
|
@@ -38,14 +48,14 @@ function checkAPI { | |
} | ||
|
||
#Copy the mounted content in /source to current WORKDIR | ||
cp -r /source/* . | ||
cp -r -n /source/* . | ||
|
||
#Run the examples | ||
if [ ! -z ${API_KEY} ]; then | ||
checkAPI | ||
#Prerequisite | ||
python /python/setup.py install | ||
cd examples | ||
python /python-dev/setup.py install | ||
cd /python-dev/examples | ||
if [ ! -z ${FILENAME} ]; then | ||
if [ ! -z ${ALT_URL} ]; then | ||
python ${FILENAME} --key ${API_KEY} --url ${ALT_URL} | ||
|
@@ -60,3 +70,24 @@ if [ ! -z ${API_KEY} ]; then | |
else | ||
HELP | ||
fi | ||
|
||
#Run unit tests | ||
cd /python-dev | ||
tox | ||
|
||
#Generate gh-pages and push them to git account (if git username is provided) | ||
if [ ! -z ${GIT_USERNAME} ] && [ ! -z ${VERSION} ]; then | ||
#clone python git repo | ||
cd / | ||
git clone [email protected]:${GIT_USERNAME}/python.git | ||
cd python | ||
git checkout origin/gh-pages -b gh-pages | ||
git branch -d develop | ||
#generate gh-pages and set ouput dir to git repo (gh-pages branch) | ||
cd /python-dev | ||
.tox/py27/bin/epydoc -v --no-private --no-frames --css epydoc.css -o /python rosette/*.py | ||
cd /python | ||
git add . | ||
git commit -a -m "publish python apidocs ${VERSION}" | ||
git push | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Tox (http://tox.testrun.org/) is a tool for running tests | ||
# in multiple virtualenvs. This configuration file will run the | ||
# test suite on all supported python versions. To use it, "pip install tox" | ||
# and then run "tox" from this directory. | ||
|
||
[tox] | ||
skipsdist = True | ||
envlist = py26, py27, py33, py34 | ||
|
||
[testenv] | ||
commands = | ||
py.test {toxinidir}/tests | ||
deps = | ||
pytest | ||
pytest-pep8 | ||
httpretty==0.8.10 | ||
epydoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
limitations under the License. | ||
""" | ||
|
||
__version__ = '0.7.4' | ||
__version__ = '0.8.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.