mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 03:30:19 +01:00
Setup basic CI flow (#38)
Adds automated running of unit, integration tests (and optionally longer running tests)
This commit is contained in:
committed by
Scott Leishman
parent
2cc6abc3c4
commit
16b3e99f37
@@ -1,120 +1,4 @@
|
||||
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
|
||||
|
||||
# https://github.com/NVIDIA/nvidia-docker/issues/619
|
||||
RUN rm /etc/apt/sources.list.d/cuda.list
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
RUN apt-get update && \
|
||||
apt-get install -y python-pip && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
RUN pip install pip --upgrade
|
||||
WORKDIR /root
|
||||
|
||||
################################
|
||||
# Install apt-get Requirements #
|
||||
################################
|
||||
|
||||
# General
|
||||
RUN apt-get update && \
|
||||
apt-get install -y python3-pip cmake zlib1g-dev python3-tk python-opencv && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Boost libraries
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libboost-all-dev && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Scipy requirements
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libblas-dev liblapack-dev libatlas-base-dev gfortran && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Pygame requirements
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Dashboard
|
||||
RUN apt-get update && \
|
||||
apt-get install -y dpkg-dev build-essential python3.5-dev libjpeg-dev libtiff-dev libsdl1.2-dev libnotify-dev \
|
||||
freeglut3 freeglut3-dev libsm-dev libgtk2.0-dev libgtk-3-dev libwebkitgtk-dev libgtk-3-dev \
|
||||
libwebkitgtk-3.0-dev libgstreamer-plugins-base1.0-dev && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Gym
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libav-tools libsdl2-dev swig cmake && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# Mujoco_py
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl libgl1-mesa-dev libgl1-mesa-glx libglew-dev libosmesa6-dev software-properties-common && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
# ViZDoom
|
||||
RUN apt-get update && \
|
||||
apt-get install -y build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
|
||||
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
|
||||
libopenal-dev timidity libwildmidi-dev unzip wget && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
############################
|
||||
# Install Pip Requirements #
|
||||
############################
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install pytest
|
||||
RUN pip3 install pytest-xdist
|
||||
|
||||
# initial installation of coach, so that the docker build won't install everything from scratch
|
||||
RUN pip3 install rl_coach>=0.10.0
|
||||
|
||||
# install additional environments
|
||||
RUN pip3 install gym[atari]==0.10.5
|
||||
RUN pip3 install mujoco_py==1.50.1.56
|
||||
RUN pip3 install vizdoom==1.1.6
|
||||
|
||||
# FROM ubuntu:16.04
|
||||
#
|
||||
# RUN apt-get update \
|
||||
# && apt-get install -y \
|
||||
# python3-pip cmake zlib1g-dev python3-tk python-opencv \
|
||||
# libboost-all-dev \
|
||||
# libblas-dev liblapack-dev libatlas-base-dev gfortran \
|
||||
# libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev \
|
||||
# libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev \
|
||||
# dpkg-dev build-essential python3.5-dev libjpeg-dev libtiff-dev \
|
||||
# libsdl1.2-dev libnotify-dev freeglut3 freeglut3-dev libsm-dev \
|
||||
# libgtk2.0-dev libgtk-3-dev libwebkitgtk-dev libgtk-3-dev \
|
||||
# libwebkitgtk-3.0-dev libgstreamer-plugins-base1.0-dev \
|
||||
# libav-tools libsdl2-dev swig
|
||||
#
|
||||
# # installing python dependencies
|
||||
# RUN pip3 install --upgrade pip
|
||||
|
||||
RUN apt-get update && apt-get install -y wget zip
|
||||
RUN mkdir -p ~/.mujoco \
|
||||
&& wget https://www.roboti.us/download/mjpro150_linux.zip -O mujoco.zip \
|
||||
&& unzip mujoco.zip -d ~/.mujoco \
|
||||
&& rm mujoco.zip
|
||||
ENV LD_LIBRARY_PATH /root/.mujoco/mjpro150/bin:$LD_LIBRARY_PATH
|
||||
|
||||
RUN curl -o /usr/local/bin/patchelf https://s3-us-west-2.amazonaws.com/openai-sci-artifacts/manual-builds/patchelf_0.9_amd64.elf \
|
||||
&& chmod +x /usr/local/bin/patchelf
|
||||
FROM coach-base:master
|
||||
|
||||
RUN mkdir /root/src
|
||||
COPY setup.py /root/src/.
|
||||
|
||||
63
docker/Dockerfile.base
Normal file
63
docker/Dockerfile.base
Normal file
@@ -0,0 +1,63 @@
|
||||
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
|
||||
|
||||
# https://github.com/NVIDIA/nvidia-docker/issues/619
|
||||
RUN rm /etc/apt/sources.list.d/cuda.list
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && apt-get update && \
|
||||
apt-get install -y python-pip && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
RUN pip install pip --upgrade
|
||||
WORKDIR /root
|
||||
|
||||
################################
|
||||
# Install apt-get Requirements #
|
||||
################################
|
||||
|
||||
# General
|
||||
RUN apt-get update && \
|
||||
apt-get install -y python3-pip cmake zlib1g-dev python3-tk python-opencv \
|
||||
# Boost libraries
|
||||
libboost-all-dev \
|
||||
# Scipy requirements
|
||||
libblas-dev liblapack-dev libatlas-base-dev gfortran \
|
||||
# Pygame requirements
|
||||
libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev \
|
||||
libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev \
|
||||
# Dashboard
|
||||
dpkg-dev build-essential python3.5-dev libjpeg-dev libtiff-dev libsdl1.2-dev libnotify-dev \
|
||||
freeglut3 freeglut3-dev libsm-dev libgtk2.0-dev libgtk-3-dev libwebkitgtk-dev libgtk-3-dev \
|
||||
libwebkitgtk-3.0-dev libgstreamer-plugins-base1.0-dev \
|
||||
# Gym
|
||||
libav-tools libsdl2-dev swig cmake \
|
||||
# Mujoco_py
|
||||
curl libgl1-mesa-dev libgl1-mesa-glx libglew-dev libosmesa6-dev software-properties-common \
|
||||
# ViZDoom
|
||||
build-essential zlib1g-dev libsdl2-dev libjpeg-dev \
|
||||
nasm tar libbz2-dev libgtk2.0-dev cmake git libfluidsynth-dev libgme-dev \
|
||||
libopenal-dev timidity libwildmidi-dev unzip wget && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y
|
||||
|
||||
############################
|
||||
# Install Pip Requirements #
|
||||
############################
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install pytest
|
||||
RUN pip3 install pytest-xdist
|
||||
|
||||
# initial installation of coach, so that the docker build won't install everything from scratch
|
||||
RUN pip3 install rl_coach>=0.10.0 && pip3 install gym[atari]==0.10.5 && \
|
||||
pip3 install mujoco_py==1.50.1.56 && pip3 install vizdoom==1.1.6
|
||||
|
||||
RUN mkdir -p ~/.mujoco \
|
||||
&& wget https://www.roboti.us/download/mjpro150_linux.zip -O mujoco.zip \
|
||||
&& unzip mujoco.zip -d ~/.mujoco \
|
||||
&& rm mujoco.zip
|
||||
# COPY ./mjkey.txt /root/.mujoco/
|
||||
ENV LD_LIBRARY_PATH /root/.mujoco/mjpro150/bin:$LD_LIBRARY_PATH
|
||||
|
||||
RUN curl -o /usr/local/bin/patchelf https://s3-us-west-2.amazonaws.com/openai-sci-artifacts/manual-builds/patchelf_0.9_amd64.elf \
|
||||
&& chmod +x /usr/local/bin/patchelf
|
||||
@@ -20,6 +20,11 @@ RUN_ARGUMENTS+=--rm
|
||||
RUN_ARGUMENTS+=--net host
|
||||
RUN_ARGUMENTS+=-v /tmp/checkpoint:/checkpoint
|
||||
|
||||
UNIT_TESTS=python3 -m pytest rl_coach/tests -m unit_test
|
||||
INTEGRATION_TESTS=python3 -m pytest rl_coach/tests -m integration_test -n auto --tb=short
|
||||
GOLDEN_TESTS=python3 -m pytest rl_coach/tests -m golden_test -n auto
|
||||
TRACE_TESTS=python3 rl_coach/tests/trace_tests.py -prl
|
||||
|
||||
CONTEXT = $(realpath ..)
|
||||
|
||||
ifndef DOCKER
|
||||
@@ -35,17 +40,16 @@ shell: build
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} /bin/bash
|
||||
|
||||
unit_tests: build
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} python3 -m pytest rl_coach/tests -m unit_test -n 8
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} ${UNIT_TESTS} -n 8
|
||||
|
||||
integration_tests: build
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} python3 -m pytest rl_coach/tests -m integration_test -n auto --tb=short
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} ${INTEGRATION_TESTS}
|
||||
|
||||
golden_tests: build
|
||||
# ${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} python3 rl_coach/tests/golden_tests.py
|
||||
time ${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} python3 -m pytest rl_coach/tests -m golden_test -n auto
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} ${GOLDEN_TESTS}
|
||||
|
||||
trace_tests: build
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} python3 rl_coach/tests/trace_tests.py -prl
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE} ${TRACE_TESTS}
|
||||
|
||||
run: build
|
||||
${DOCKER} run ${RUN_ARGUMENTS} -it ${IMAGE}
|
||||
@@ -73,3 +77,15 @@ kubernetes: stop_kubernetes
|
||||
push: build
|
||||
${DOCKER} tag ${IMAGE} ${REGISTRY}${IMAGE}
|
||||
${DOCKER} push ${REGISTRY}${IMAGE}
|
||||
|
||||
unit_tests_without_docker:
|
||||
cd .. && ${UNIT_TESTS}
|
||||
|
||||
integration_tests_without_docker:
|
||||
cd .. && ${INTEGRATION_TESTS}
|
||||
|
||||
golden_tests_without_docker:
|
||||
cd .. && ${GOLDEN_TESTS}
|
||||
|
||||
trace_tests_without_docker:
|
||||
cd .. && ${TRACE_TESTS}
|
||||
|
||||
@@ -16,6 +16,4 @@ set -e
|
||||
|
||||
export VIZDOOM_ROOT=`pip show vizdoom 2>/dev/null | awk '/Location/{print $2}'`/vizdoom
|
||||
|
||||
cd /root/src/
|
||||
|
||||
exec "$@"
|
||||
bash -c "$@"
|
||||
|
||||
Reference in New Issue
Block a user