From 8b15512bba2c640b2dd6602f7d9622caa3bfef5b Mon Sep 17 00:00:00 2001 From: pzhokhov Date: Fri, 10 May 2019 14:49:16 -0700 Subject: [PATCH] test docker images based on python images (#1474) * base test docker image on python images * fix py3 build * fixes for python-based dockerfile * re-enable py27 build * remove requirements_dev.txt and unittest.cfg (cleaning up build pipeline) --- .travis.yml | 13 +++++----- py.Dockerfile | 30 +++++++++++++++++++++++ requirements.txt | 5 ---- requirements_dev.txt | 5 ---- setup.py | 2 +- test.dockerfile.14.04 | 44 --------------------------------- test.dockerfile.16.04 | 57 ------------------------------------------- test.dockerfile.18.04 | 51 -------------------------------------- tox.ini | 25 ------------------- unittest.cfg | 11 --------- 10 files changed, 38 insertions(+), 205 deletions(-) create mode 100644 py.Dockerfile delete mode 100644 requirements.txt delete mode 100644 requirements_dev.txt delete mode 100644 test.dockerfile.14.04 delete mode 100644 test.dockerfile.16.04 delete mode 100644 test.dockerfile.18.04 delete mode 100644 tox.ini delete mode 100644 unittest.cfg diff --git a/.travis.yml b/.travis.yml index 774b6f345..07ce73882 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,17 @@ sudo: required -language: python services: - docker env: # - UBUNTU_VER=14.04 - problems with atari-py - - UBUNTU_VER=16.04 - - UBUNTU_VER=18.04 + - PY_VER=2.7 + - PY_VER=3.5 + - PY_VER=3.6 + - PY_VER=3.7 install: "" # so travis doesn't do pip install requirements.txt script: - - docker build -f test.dockerfile.${UBUNTU_VER} -t gym-test --build-arg MUJOCO_KEY=$MUJOCO_KEY . - - docker run gym-test + - docker build -f py.Dockerfile --build-arg MUJOCO_KEY=$MUJOCO_KEY --build-arg PYTHON_VER=$PY_VER -t gym-test . + - docker run gym-test deploy: provider: pypi @@ -18,4 +19,4 @@ deploy: password: $TWINE_PASSWORD on: tags: true - condition: $UBUNTU_VER = 16.04 + condition: $PY_VER = 3.5 diff --git a/py.Dockerfile b/py.Dockerfile new file mode 100644 index 000000000..92ec37ea3 --- /dev/null +++ b/py.Dockerfile @@ -0,0 +1,30 @@ +# A Dockerfile that sets up a full Gym install with test dependencies +ARG PYTHON_VER +FROM python:$PYTHON_VER +RUN apt-get -y update && apt-get install -y unzip libglu1-mesa-dev libgl1-mesa-dev libosmesa6-dev xvfb patchelf ffmpeg +RUN \ +# Download mujoco + mkdir /root/.mujoco && \ + cd /root/.mujoco && \ + curl -O https://www.roboti.us/download/mjpro150_linux.zip && \ + unzip mjpro150_linux.zip && \ + curl -O https://www.roboti.us/download/mujoco200_linux.zip && \ + unzip mujoco200_linux.zip && \ + mv mujoco200_linux mujoco200 + +ARG MUJOCO_KEY +ARG PYTHON_VER +ENV MUJOCO_KEY=$MUJOCO_KEY + +ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin +ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco200/bin +RUN echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt +RUN [ "$PYTHON_VER" != "2.7" ] && pip install box2d-py atari-py mujoco-py || echo "skipping atari-py, mujoco-py and box2d-py" + +COPY . /usr/local/gym/ +RUN cd /usr/local/gym && \ + pip install /usr/local/gym pytest pytest-forked + +WORKDIR /usr/local/gym/ +ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"] +CMD ["pytest","--forked"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c177d8cda..000000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -numpy>=1.10.4 -requests>=2.0 -six -pyglet>=1.2.0 -scipy==0.17.1 diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 92ee43dc1..000000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Testing -pytest -mock - --e .[all] diff --git a/setup.py b/setup.py index 2578168a9..a359128f6 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ setup(name='gym', if package.startswith('gym')], zip_safe=False, install_requires=[ - 'scipy', 'numpy>=1.10.4', 'requests>=2.0', 'six', 'pyglet>=1.2.0', + 'scipy', 'numpy>=1.10.4', 'six', 'pyglet>=1.2.0', ], extras_require=extras, package_data={'gym': [ diff --git a/test.dockerfile.14.04 b/test.dockerfile.14.04 deleted file mode 100644 index 402e3b9a3..000000000 --- a/test.dockerfile.14.04 +++ /dev/null @@ -1,44 +0,0 @@ -# A Dockerfile that sets up a full Gym install with test dependencies -FROM ubuntu:14.04 -# Note that latest version of mujoco-py, 1.5, does not play nicely with ubuntu 14.04 - -# requires patchelf system package not available on 14.04 - -# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection -RUN \ - apt-get -y update && \ - apt-get install -y keyboard-configuration && \ - - apt-get install -y \ - python-setuptools \ - python-pip \ - python3-dev \ - libjpeg-dev \ - cmake \ - swig \ - python-pyglet \ - python3-opengl \ - libboost-all-dev \ - libsdl2-2.0.0 \ - libsdl2-dev \ - libglu1-mesa \ - libglu1-mesa-dev \ - libgles2-mesa-dev \ - xvfb \ - libav-tools \ - freeglut3 \ - wget \ - unzip && \ - - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - pip install tox - - -# install dependencies -COPY . /usr/local/gym/ -RUN cd /usr/local/gym && \ - tox --notest - -WORKDIR /usr/local/gym/ -ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"] -CMD ["tox"] diff --git a/test.dockerfile.16.04 b/test.dockerfile.16.04 deleted file mode 100644 index 442cbcb02..000000000 --- a/test.dockerfile.16.04 +++ /dev/null @@ -1,57 +0,0 @@ -# A Dockerfile that sets up a full Gym install with test dependencies -FROM ubuntu:16.04 - -# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection -RUN \ - apt-get -y update && \ - apt-get install -y keyboard-configuration && \ - -# Maybe Install python3.6 on ubuntu 16.04 ? -# apt-get install -y software-properties-common && \ -# add-apt-repository -y ppa:jonathonf/python-3.6 && \ -# apt-get -y update && \ -# apt-get -y install python3.6 python3.6-distutils python3.6-dev - - apt-get install -y \ - python-setuptools \ - python-pip \ - python3-dev \ - python-pyglet \ - python3-opengl \ - libjpeg-dev \ - libboost-all-dev \ - libsdl2-dev \ - libosmesa6-dev \ - patchelf \ - xvfb \ - ffmpeg \ - wget \ - unzip && \ - - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - pip install tox && \ - -# Download mujoco - mkdir /root/.mujoco && \ - cd /root/.mujoco && \ - wget https://www.roboti.us/download/mjpro150_linux.zip && \ - unzip mjpro150_linux.zip && \ - wget https://www.roboti.us/download/mujoco200_linux.zip && \ - unzip mujoco200_linux.zip && \ - mv mujoco200_linux mujoco200 - -ARG MUJOCO_KEY -ENV MUJOCO_KEY=$MUJOCO_KEY -ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin -ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco200/bin -RUN echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt - -# install dependencies -COPY . /usr/local/gym/ -RUN cd /usr/local/gym && \ - tox --notest - -WORKDIR /usr/local/gym/ -ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"] -CMD ["tox"] diff --git a/test.dockerfile.18.04 b/test.dockerfile.18.04 deleted file mode 100644 index aacb28fad..000000000 --- a/test.dockerfile.18.04 +++ /dev/null @@ -1,51 +0,0 @@ -# A Dockerfile that sets up a full Gym install with test dependencies -FROM ubuntu:18.04 - -# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection -RUN \ - apt -y update && \ - apt install -y keyboard-configuration && \ - - apt install -y \ - python-setuptools \ - python-pip \ - python3-dev \ - python-pyglet \ - python3-opengl \ - libjpeg-dev \ - libboost-all-dev \ - libsdl2-dev \ - libosmesa6-dev \ - patchelf \ - ffmpeg \ - xvfb \ - wget \ - unzip && \ - - apt clean && \ - rm -rf /var/lib/apt/lists/* && \ - pip install tox && \ - -# Download mujoco - mkdir /root/.mujoco && \ - cd /root/.mujoco && \ - wget https://www.roboti.us/download/mjpro150_linux.zip && \ - unzip mjpro150_linux.zip && \ - wget https://www.roboti.us/download/mujoco200_linux.zip && \ - unzip mujoco200_linux.zip && \ - mv mujoco200_linux mujoco200 - -ARG MUJOCO_KEY -ENV MUJOCO_KEY=$MUJOCO_KEY -ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin -ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco200/bin -RUN echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt - -# install dependencies -COPY . /usr/local/gym/ -RUN cd /usr/local/gym && \ - tox --notest - -WORKDIR /usr/local/gym/ -ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"] -CMD ["tox"] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 82bb4b718..000000000 --- a/tox.ini +++ /dev/null @@ -1,25 +0,0 @@ -# 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] -envlist = py27, py3 - -[testenv:py3] -passenv=DISPLAY MUJOCO_KEY LD_LIBRARY_PATH TRAVIS* -deps = - pytest - pytest-forked - -e .[all] -commands = - pytest --forked {posargs} - -[testenv:py27] -passenv=DISPLAY MUJOCO_KEY LD_LIBRARY_PATH TRAVIS* -deps = - pytest - pytest-forked - -e . -commands = - pytest --forked {posargs} diff --git a/unittest.cfg b/unittest.cfg deleted file mode 100644 index 72eb6b6f4..000000000 --- a/unittest.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[log-capture] -always-on = True -clear-handlers = True -date-format = None -filter = -nose -log-level = NOTSET - -[output-buffer] -always-on = True -stderr = True -stdout = True