Permalink
Browse files

Switch to Docker for tests (#285)

  • Loading branch information...
gdb committed Aug 10, 2016
1 parent be1eeec commit fabb8973111bbcb0c3d698a19b1ddf975eb5cb7c
Showing with 2,076 additions and 59 deletions.
  1. +1 −0 .dockerignore
  2. +8 −43 .travis.yml
  3. +13 −11 Dockerfile
  4. +7 −1 Makefile
  5. +22 −2 bin/docker_entrypoint
  6. +42 −0 test.dockerfile
  7. +28 −2 tox.ini
  8. +1,955 −0 vendor/Xdummy
View
@@ -0,0 +1 @@
.tox
View
@@ -1,50 +1,15 @@
language: python
python:
- "2.7"
- "3.4"
dist: trusty
sudo: required
cache:
apt: true
pip: true
addons:
apt:
sources:
- george-edison55-precise-backports # cmake 3.2.3
- deadsnakes
packages:
- cmake
- cmake-data
- python-dev
- python3.4-dev
- swig
- libav-tools
- python-numpy
- libboost-all-dev
- libsdl2-dev
- libjpeg-dev
- zlib1g-dev
- libblas-dev
- liblapack-dev
- gfortran
- python-opengl
language: python
services:
- docker
before_install:
# Start an X server so rendering works.
- Xvfb :12 -screen 0 800x600x24 +extension RANDR &
# Prime the cache. We currently manually keep this synced.
- docker pull quay.io/openai/gym:test
- docker build -f test.dockerfile -t quay.io/openai/gym:test .
script:
# In a pull request, there are no secrets, and hence no MuJoCo:
# https://docs.travis-ci.com/user/pull-requests#Security-Restrictions-when-testing-Pull-Requests.
- '[ -z ${MUJOCO_KEY_BUNDLE+x} ] || ( mkdir -p ~/.mujoco && curl https://openai-public.s3-us-west-2.amazonaws.com/mujoco/$MUJOCO_KEY_BUNDLE.tar.gz | tar xz -C ~/.mujoco )'
# Without this line, Travis has fork()s fail with an out of memory
# error. (These fork()s are for spawning the subprocess for video
# recording.) We should debug the memory usage at some stage, but
# simply setting overcommit is a good starting point.
- sudo sysctl -w vm.overcommit_memory=1
env:
- DISPLAY=:12
install: travis_wait pip install -r requirements_dev.txt
script: nose2
- docker run -e MUJOCO_KEY_BUNDLE="${MUJOCO_KEY_BUNDLE:-}" quay.io/openai/gym:test tox
notifications:
slack:
View
@@ -2,13 +2,7 @@
FROM ubuntu:14.04
RUN apt-get update \
&& apt-get install -y xorg-dev \
libgl1-mesa-dev \
xvfb \
libxinerama1 \
libxcursor1 \
libglu1-mesa \
libav-tools \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
@@ -17,16 +11,24 @@ RUN apt-get update \
libjpeg-dev \
curl \
cmake \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& easy_install pip
swig \
python-opengl \
libboost-all-dev \
libsdl2-dev \
wget \
unzip \
git \
xpra \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& easy_install pip
WORKDIR /usr/local/gym
RUN mkdir gym && touch gym/__init__.py
COPY ./gym/version.py ./gym
COPY ./requirements.txt .
COPY ./setup.py .
RUN pip install -r requirements.txt
RUN pip install -e .[all]
# Finally, upload our actual code!
COPY . /usr/local/gym
View
@@ -4,9 +4,15 @@ install:
pip install -r requirements.txt
test:
nose2
docker build -f test.dockerfile -t quay.io/openai/gym:test .
upload:
rm -rf dist
python setup.py sdist
twine upload dist/*
docker-build:
docker build -t quay.io/openai/gym .
docker-run:
docker run -ti quay.io/openai/gym bash
View
@@ -4,9 +4,29 @@
set -e
# Set up display; otherwise rendering will cause segfaults
path=$(cd $(dirname "$0") && pwd)
[ -z ${MUJOCO_KEY_BUNDLE+x} ] || ( mkdir -p ~/.mujoco && curl https://openai-public.s3-us-west-2.amazonaws.com/mujoco/$MUJOCO_KEY_BUNDLE.tar.gz | tar xz -C ~/.mujoco )
# Set up display; otherwise rendering will fail
rm -f /tmp/.X12-lock
Xvfb :12 -screen 0 800x600x24 +extension RANDR 2>/dev/null &
"$path/../vendor/Xdummy" :12 &
export DISPLAY=:12
# Wait for the file to come up
display=12
file="/tmp/.X11-unix/X$display"
for i in $(seq 1 10); do
if [ -e "$file" ]; then
break
fi
echo "Waiting for $file to be created (try $i/10)"
sleep "$i"
done
if ! [ -e "$file" ]; then
echo "Timing out: $file was not created"
exit 1
fi
exec "$@"
View
@@ -0,0 +1,42 @@
# A Dockerfile that sets up a full Gym install
FROM ubuntu:14.04
RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
libjpeg-dev \
curl \
cmake \
swig \
python-opengl \
libboost-all-dev \
libsdl2-dev \
wget \
unzip \
git \
xpra \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& easy_install pip
WORKDIR /usr/local/gym
RUN mkdir gym && touch gym/__init__.py
COPY ./gym/version.py ./gym
COPY ./requirements.txt .
COPY ./setup.py .
COPY ./tox.ini .
RUN pip install tox
# Install the relevant dependencies. Keep printing so Travis knows we're alive.
RUN ["bash", "-c", "( while true; do echo '.'; sleep 60; done ) & tox --notest"]
# Finally, upload our actual code!
COPY . /usr/local/gym
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
CMD ["tox"]
View
30 tox.ini
@@ -12,8 +12,21 @@ passenv=DISPLAY TRAVIS*
deps =
nose2
mock
atari_py>=0.0.17
Pillow
PyOpenGL
pachi-py>=0.0.19
box2d-py
PyOpenGL
doom_py>=0.0.11
mujoco_py>=0.4.3
keras
theano
numpy>=1.10.4
requests>=2.0
six
pyglet>=1.2.0
commands =
pip install -e .[all]
nose2 {posargs}
[testenv:py27]
@@ -22,6 +35,19 @@ passenv=DISPLAY TRAVIS*
deps =
nose2
mock
atari_py>=0.0.17
Pillow
PyOpenGL
pachi-py>=0.0.19
box2d-py
PyOpenGL
doom_py>=0.0.11
mujoco_py>=0.4.3
keras
theano
numpy>=1.10.4
requests>=2.0
six
pyglet>=1.2.0
commands =
pip install -e .[all]
nose2 {posargs}
Oops, something went wrong.

0 comments on commit fabb897

Please sign in to comment.