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)
This commit is contained in:
pzhokhov
2019-05-10 14:49:16 -07:00
committed by GitHub
parent 32253b5226
commit 8b15512bba
10 changed files with 38 additions and 205 deletions

View File

@@ -1,16 +1,17 @@
sudo: required sudo: required
language: python
services: services:
- docker - docker
env: env:
# - UBUNTU_VER=14.04 - problems with atari-py # - UBUNTU_VER=14.04 - problems with atari-py
- UBUNTU_VER=16.04 - PY_VER=2.7
- UBUNTU_VER=18.04 - PY_VER=3.5
- PY_VER=3.6
- PY_VER=3.7
install: "" # so travis doesn't do pip install requirements.txt install: "" # so travis doesn't do pip install requirements.txt
script: script:
- docker build -f test.dockerfile.${UBUNTU_VER} -t gym-test --build-arg MUJOCO_KEY=$MUJOCO_KEY . - docker build -f py.Dockerfile --build-arg MUJOCO_KEY=$MUJOCO_KEY --build-arg PYTHON_VER=$PY_VER -t gym-test .
- docker run gym-test - docker run gym-test
deploy: deploy:
provider: pypi provider: pypi
@@ -18,4 +19,4 @@ deploy:
password: $TWINE_PASSWORD password: $TWINE_PASSWORD
on: on:
tags: true tags: true
condition: $UBUNTU_VER = 16.04 condition: $PY_VER = 3.5

30
py.Dockerfile Normal file
View File

@@ -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"]

View File

@@ -1,5 +0,0 @@
numpy>=1.10.4
requests>=2.0
six
pyglet>=1.2.0
scipy==0.17.1

View File

@@ -1,5 +0,0 @@
# Testing
pytest
mock
-e .[all]

View File

@@ -31,7 +31,7 @@ setup(name='gym',
if package.startswith('gym')], if package.startswith('gym')],
zip_safe=False, zip_safe=False,
install_requires=[ 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, extras_require=extras,
package_data={'gym': [ package_data={'gym': [

View File

@@ -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"]

View File

@@ -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"]

View File

@@ -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"]

25
tox.ini
View File

@@ -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}

View File

@@ -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